Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Local .DSL - Handling, Local Extension of MyDslPanel< Next Oldest | Next Newest >
struppi Offline





Group: Members
Posts: 93
Joined: Dec. 2004
Posted: April 25 2005,13:41 QUOTE

hi. i think the dsl 1.0 version of the mydslPanel is really good - for downloading extensions from the repository.

but what about all the local stored extensions? the last, perl+dillo version was able to load extensions from the internet _and_ from local drives.

so i tried to modify the flua mydslPanel. This is the result:

mydslPanel2.lua:
Code Sample
#!/bin/flua

-- (C) Robert Shingledecker 2005
--
-- Main GUI loop for myDSL Extensions
-- Modified by Struppi

w = Window{430,170, "DSL Download Extension Panel"}

b1 = Button{10,10,130,30, "&Apps"}
function b1.callback()
  execute("mydslBrowser.lua apps")
end

b2 = Button{10,50,130,30, "&Multimedia"}
function b2:callback()
  execute("mydslBrowser.lua multimedia")
end

b3 = Button{10,90,130,30, "&Themes"}
function b3:callback()
  execute("mydslBrowser.lua themes")
end

b4 = Button{150,10,130,30, "&Games"}
function b4:callback()
  execute("mydslBrowser.lua games")
end

b5 = Button{150,50,130,30, "&Net"}
function b5:callback()
  execute("mydslBrowser.lua net")
end

b6 = Button{150,90,130,30, "&UCI"}
function b6:callback()
  execute("mydslBrowser.lua uci")
end

b7 = Button{290,10,130,30, "G&tk2"}
function b7:callback()
  execute("mydslBrowser.lua gtk2")
end

b8 = Button{290,50,130,30, "&System"}
function b8:callback()
  execute("mydslBrowser.lua system")
end

b9 = Button{290,90,130,30, "&WM_Apps"}
function b9:callback()
  execute("mydslBrowser.lua wm_apps")
end

inp = Input{130,130,140,25,"MyDsl - Directory:"; callback=cb}
b10 = Return_Button{290,127,100,30, "OK"}
function b10:callback()
  myDslDir=inp.value
  execute("mydslLocalBrowser.lua " .. myDslDir)
end

w:end_layout()
w:show()


myDslLocalBrowser.lua:
Code Sample
#!/bin/flua -f

-- (c) 2005 Robert Shingledecker
-- myDSL extension browser noramlly called from mydslPanel
-- Local modification by Struppi

function parseInfo(s)
 local i,j = strfind(s,".dsl")
 if not i then
    return nil
 end
 local t=strsub(s,1,j)
 --local k,l = strfind(t,'"')
 --s=strsub(t,k+1)
 s=t
 return s
end

-- Main
if getn(arg) == 1 then
  myDslDir = arg[1]
else
  print("usage: mydslBrowser.lua [library_name]")
  exit(1)
end

execute('ls /mnt/' .. myDslDir .. '/optional/*.dsl >index.txt')
local file,err = openfile("index.txt", "r")

if not file then
  print("Cannot open file index.txt: ".. err)
  exit(1)
end

filetable = {}
fname = tmpname()
filelist = openfile(fname,"w")
line = read(file, "*l")
while line do
  result = parseInfo(line)
  if result then
     tinsert(filetable,result)
     write(filelist, result .. "\n")
  end
  line = read(file,"*l")
end
closefile(file)
closefile(filelist)

w = Window{300,400,'/mnt/'..myDslDir; box=Boxtype.none}
function w:callback()
 remove(fname)
 remove('index.txt')
 exit(0)
end
browser = Select_Browser{0,0,300,400; type=Browsertype.single}

function browser:callback()
  selected_item = filetable[self.value]

  if fl_ask("Install DSL-Extension " .. selected_item ..  " ?") then
     execute("mydsl-load " .. selected_item )
     remove(fname)
     remove('index.txt')
     exit(0)
   else
      return
   end

  --execute('mydslInfo.lua ' .. myDslDir .. ' ' .. selected_item)
end

if not browser:load(fname) then
  print("can't load ", fname)
  exit(1)
end

browser.position = 0
w.resizable = browser
w:show()


i'm not a programmer and i think the two scripts are full of unneeded things, but it works. the user can enter the device and the script looks for all .dsl-files (.uci and .tar.gz can be added quite easy) in the /mnt/<device>/optional directory. one click on an extension asks whether to install it or not.

perhaps this is an idea for robert an the other 'dsl-professionals' :)

struppi
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: April 25 2005,14:12 QUOTE

very cool =o)

This apparently builds a new list every time the script is called, and then removes the list when you install a package?
What about the possiblity to select multiple packages to install?


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
struppi Offline





Group: Members
Posts: 93
Joined: Dec. 2004
Posted: April 25 2005,14:30 QUOTE

Quote
What about the possiblity to select multiple packages to install?


i forgot this: change the browser:callback() function and you can load them one after another...

Code Sample
function browser:callback()
 selected_item = filetable[self.value]

 if fl_ask("Install DSL-Extension " .. selected_item ..  " ?") then
    execute("mydsl-load " .. selected_item )
    return
  else
     return
  end
end


it's not that elegant, but it works :)

the better idea would be to change the browser properties to make it possible to select and deselect the extensions. clicking on an "install" button would start the installation of all selected items.
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: April 25 2005,20:47 QUOTE

I have thought of local extensions. but then that seems to duplicate the already inbuilt support for the local extensions in emelfm,
namely the myDSL button, and the double click to install/unistall uci types.
We seem to use emelfm as the swiss army knife for the local stores.

This is the same reason why I didn't make a GUI for excel viewer, or powerpoint viewer, we save space and use emelfm as the launching GUI for both of these. Just  use emelfm to browser the local stores and double click to launch. Same concept and save code.
Back to top
Profile PM WEB 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: April 25 2005,22:32 QUOTE

Emelfm is the most efficient way to navigate and launch files.  In my opinion, it is the second most important purpose of a file manager program and Emelfm does a great job in this area.

The only advantage to a local+network myDSLgui is that you have "one stop shopping" for your extensions instead of using two different interfaces.

However, in my case I prefer to just use the whole "/optional" concept and then I let the fluxbox menu system become my personal "localMyDSLGui".

But I can understand the confusion with newbies who don't get the big picture yet.

Besides these forums, a real eye opener is all of the people over at the X-DSL XBOX port website that quickly slap the distro into their xbox and start clicking on stuff without reading any of the manuals / faqs and then start posting about how their extensions disappear when they reboot :laugh:

My personal opinion is that a new button ("Help") on the myDSL gui that opens up a web page with some FAQ-like help that explains how the system works will go a long way to prevent these questions.  Maybe a direct dillo link to a specific DSL documentation website page?
Back to top
Profile PM 
7 replies since April 25 2005,13:41 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: Local .DSL - Handling

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code