It would be nice, but Guitoo is apparently going to be a native KDE app, not just a QT app...configuration all set up in the KDE Control Center, using KDE libs throughout, etc.; there would be massive parts that would need a re-write, not just the frontend, unfortunately, it seems =( The backend shouldn't even take me that long, anyway -- I've never written a UI in GTK2 before, though, so it might take me a bit before I cobble together something that I'm happy with =Pfloffe wrote:That would all be nice. Couldn't you cooperate with guitoo for a backend, and just write different frontends? That would probably save both of you some work...
You can do that already: http://forums.gentoo.org/viewtopic.php? ... pdate+meldslarti] wrote:Would it be possible to blend something like Meld into an etc-update utility?

Kesereti wrote:The backend shouldn't even take me that long, anyway -- I've never written a UI in GTK2 before, though, so it might take me a bit before I cobble together something that I'm happy with =P


PORTHOLE PORTHOLE PORTHOLE PORTHOLE PORTHOLE!Drooling Iguana wrote:I just want a version of Portage with a progress bar, even if it's just an ASCII bar that would go across the bottom of the terminal for the regular, console based interface.
charlieg wrote:You're talking about an existing project, and that wasn't the original poster's question, and besides, porthole only encompassess part of the functionality planned for guitoo. Invalid.Drooling Iguana wrote:I just want a version of Portage with a progress bar, even if it's just an ASCII bar that would go across the bottom of the terminal for the regular, console based interface.
Hell, I'd prefer it that way, actually, but having a nice, user-friendly GUI w
PORTHOLE PORTHOLE PORTHOLE PORTHOLE PORTHOLE!
Again:
PORTHOLE
Sheesh, can people not read any more?
![]()
![]()
![]()
![]()

There is none. There is no way of knowing how long an emerge will take, although I believe someone made a util that displays a progress bar based on statistics from earlier emerges.Drooling Iguana wrote:I haven't tried Porthole since it's masked, but I've looked at the screenshots adn I didn't see any progress bar.

Code: Select all
#!/usr/bin/env python
import sys
import os
import gobject
import gtk
from gtk import TRUE, FALSE
testing = False
class Item(gobject.GObject):
name = ''
run_levels = []
running = False
gobject.type_register(Item)
def refresh(model):
global full_list
global run_levels
l = os.listdir("/etc/init.d")
full_list = []
for i in l:
if i[-3:] != ".sh":
full_list.append(i)
full_list_id = {}
for i in range(len(full_list)):
full_list_id[full_list[i]] = i
run_levels = os.listdir("/etc/runlevels")
services = []
for i in range(len(full_list)):
a = Item()
a.name = full_list[i];
a.run_levels = []
a.running = False
for j in range(len(run_levels)):
a.run_levels.append(False)
services.append(a)
for i in range(len(run_levels)):
for j in os.listdir("/etc/runlevels/"+run_levels[i]):
services[full_list_id[j]].run_levels[i] = True
for i in range(len(full_list)):
print "Checking " + full_list[i]
status = os.spawnl(os.P_WAIT,"/etc/init.d/"+full_list[i],full_list[i],'--quiet','status');
services[i].running = status == 0
model.clear()
for item in services:
iter = model.append()
model.set(iter, 0, item)
def create_model():
store = gtk.ListStore(Item)
refresh(store)
return store
def add_columns(treeview):
model = treeview.get_model()
# service name
column = gtk.TreeViewColumn()
column.set_title('Service')
renderer = gtk.CellRendererText()
column.pack_start(renderer,True)
column.set_cell_data_func(renderer,macro_set_func_text)
treeview.append_column(column)
# column for fixed toggles
column = gtk.TreeViewColumn()
column.set_title('Running')
renderer = gtk.CellRendererToggle()
renderer.connect('toggled',running_toggled,model)
column.pack_start(renderer,True)
column.set_cell_data_func(renderer,macro_set_func_running)
treeview.append_column(column)
for i in range(len(run_levels)):
# column for fixed toggles
column = gtk.TreeViewColumn()
column.set_title(run_levels[i])
renderer = gtk.CellRendererToggle()
renderer.connect('toggled',runlevel_toggled,[model,i])
column.pack_start(renderer,True)
column.set_cell_data_func(renderer,macro_set_func_toggle,i)
treeview.append_column(column)
def macro_set_func_text(tree, cell, model, iter):
info = model.get_value(iter, 0)
cell.set_property('text', info.name)
def macro_set_func_toggle(tree, cell, model, iter, data):
info = model.get_value(iter, 0)
cell.set_property('active', info.run_levels[data])
def macro_set_func_running(tree, cell, model, iter):
info = model.get_value(iter, 0)
cell.set_property('active', info.running)
def running_toggled(cell,path,model):
iter = model.get_iter(path)
item = model.get_value(iter,0)
new_status = not cell.get_active()
if new_status != item.running:
if new_status:
cmd = 'start'
else:
cmd = 'stop'
if testing:
print "/etc/init.d/%s %s" % (item.name,cmd)
status = 0
else:
status = os.spawnl(os.P_WAIT,"/etc/init.d/"+item.name,item.name,cmd)
if status != 0:
print "error"
item.running = new_status
cell.set_active(item.running)
def runlevel_toggled(cell,path,data):
model = data[0]
index = data[1]
iter = model.get_iter(path)
item = model.get_value(iter,0)
new_status = not cell.get_active()
if new_status != item.run_levels[index]:
if new_status:
cmd = 'add'
else:
cmd = 'del'
if testing:
print "/sbin/rc-update %s %s %s" % (cmd,item.name,run_levels[index])
status = 0
else:
status = os.spawnl(os.P_WAIT,"/sbin/rc-update",'rc-update',cmd,item.name,run_levels[index])
if status != 0:
print "error"
item.run_levels[index] = new_status
cell.set_active(item.run_levels[index])
def main():
if len(sys.argv) > 1 and sys.argv[1] == "--test":
print "Testing mode"
global testing
testing = True
win = gtk.Window()
win.connect('destroy', lambda win: gtk.main_quit())
win.set_title('Gtk rc-update')
win.set_border_width(8)
vbox = gtk.VBox(FALSE, 8)
win.add(vbox)
sw = gtk.ScrolledWindow()
sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
sw.set_policy(gtk.POLICY_NEVER,
gtk.POLICY_AUTOMATIC)
vbox.pack_start(sw)
model = create_model()
treeview = gtk.TreeView(model)
sw.add(treeview)
add_columns(treeview)
hbox = gtk.HButtonBox()
vbox.pack_start(hbox, FALSE, FALSE)
b = gtk.Button('_Close')
b.connect('clicked', lambda l1: gtk.main_quit())
hbox.pack_start(b)
b = gtk.Button('_Refresh')
b.connect('clicked', lambda l2: refresh(model))
hbox.pack_start(b)
win.set_default_size(280, 250)
win.show_all()
gtk.main()
if __name__ == '__main__':
main()