GTK3: working plugin manager

svn: r20148
This commit is contained in:
Benny Malengier 2012-07-30 18:36:21 +00:00
parent 36d3973984
commit f080cb1b3c

View File

@ -142,7 +142,7 @@ class PluginStatus(ManagedWindow):
self.__load_btn = Gtk.Button(_("Load")) self.__load_btn = Gtk.Button(_("Load"))
hbutbox.add(self.__load_btn) hbutbox.add(self.__load_btn)
self.__load_btn.connect('clicked', self.__load, self.list_reg, 4) # id_col self.__load_btn.connect('clicked', self.__load, self.list_reg, 4) # id_col
vbox_reg.pack_start(hbutbox, expand=False, padding=5) vbox_reg.pack_start(hbutbox, False, False, 0)
notebook.append_page(vbox_reg, notebook.append_page(vbox_reg,
tab_label=Gtk.Label(label=_('Registered Plugins'))) tab_label=Gtk.Label(label=_('Registered Plugins')))
@ -199,7 +199,7 @@ class PluginStatus(ManagedWindow):
self.__load_btn.set_sensitive(False) self.__load_btn.set_sensitive(False)
hbutbox.add(self.__load_btn) hbutbox.add(self.__load_btn)
self.__load_btn.connect('clicked', self.__load, self.list, 4) # id_col self.__load_btn.connect('clicked', self.__load, self.list, 4) # id_col
vbox_loaded.pack_start(hbutbox, expand=False, padding=5) vbox_loaded.pack_start(hbutbox, False, False, 5)
notebook.append_page(vbox_loaded, notebook.append_page(vbox_loaded,
tab_label=Gtk.Label(label=_('Loaded Plugins'))) tab_label=Gtk.Label(label=_('Loaded Plugins')))
@ -236,7 +236,7 @@ class PluginStatus(ManagedWindow):
self.addon_list.connect('cursor-changed', self.button_press_addon) self.addon_list.connect('cursor-changed', self.button_press_addon)
install_row = Gtk.HBox() install_row = Gtk.HBox()
install_row.pack_start(Gtk.Label(_("Path to Addon:", True, True, 0)), expand=False) install_row.pack_start(Gtk.Label(label=_("Path to Addon:")), False, True, 0)
self.install_addon_path = Gtk.Entry() self.install_addon_path = Gtk.Entry()
button = Gtk.Button() button = Gtk.Button()
@ -245,14 +245,14 @@ class PluginStatus(ManagedWindow):
button.add(img) button.add(img)
button.connect('clicked', self.__select_file) button.connect('clicked', self.__select_file)
install_row.pack_start(self.install_addon_path, True, True, 0) install_row.pack_start(self.install_addon_path, True, True, 0)
install_row.pack_start(button, expand=False, fill=False) install_row.pack_start(button, False, False, 0)
scrolled_window.add(self.addon_list) scrolled_window.add(self.addon_list)
install_page.pack_start(scrolled_window, True, True, 0) install_page.pack_start(scrolled_window, True, True, 0)
#add some spce under the scrollbar #add some spce under the scrollbar
install_page.pack_start(Gtk.Label('', True, True, 0), expand=False, fill=False) install_page.pack_start(Gtk.Label(label=''), False, False, 0)
#path to addon path line #path to addon path line
install_page.pack_start(install_row, expand=False, fill=False) install_page.pack_start(install_row, False, False, 0)
hbutbox = Gtk.HButtonBox() hbutbox = Gtk.HButtonBox()
hbutbox.set_layout(Gtk.ButtonBoxStyle.SPREAD) hbutbox.set_layout(Gtk.ButtonBoxStyle.SPREAD)
@ -265,12 +265,12 @@ class PluginStatus(ManagedWindow):
self.__refresh_btn = Gtk.Button(_("Refresh Addon List")) self.__refresh_btn = Gtk.Button(_("Refresh Addon List"))
hbutbox.add(self.__refresh_btn) hbutbox.add(self.__refresh_btn)
self.__refresh_btn.connect('clicked', self.__refresh_addon_list) self.__refresh_btn.connect('clicked', self.__refresh_addon_list)
install_page.pack_start(hbutbox, expand=False, padding=5) install_page.pack_start(hbutbox, False, True, 5)
# notebook.append_page(install_page, # notebook.append_page(install_page,
# tab_label=Gtk.Label(label=_('Install Addons'))) # tab_label=Gtk.Label(label=_('Install Addons')))
#add the notebook to the window #add the notebook to the window
self.window.get_content_area().add(notebook) self.window.get_content_area().pack_start(notebook, True, True, 0)
if __debug__: if __debug__:
# Only show the "Reload" button when in debug mode # Only show the "Reload" button when in debug mode
@ -520,10 +520,11 @@ class PluginStatus(ManagedWindow):
def cursor_changed(self, obj): def cursor_changed(self, obj):
if __debug__: if __debug__:
selection = obj.get_selection() selection = obj.get_selection()
model, node = selection.get_selected() if selection:
if node: model, node = selection.get_selected()
data = model.get_value(node, 3) if node:
self.__load_btn.set_sensitive(data is not None) data = model.get_value(node, 3)
self.__load_btn.set_sensitive(data is not None)
def button_press(self, obj, event): def button_press(self, obj, event):
""" Callback function from the user clicking on a line """ """ Callback function from the user clicking on a line """
@ -545,10 +546,11 @@ class PluginStatus(ManagedWindow):
""" """
import urllib import urllib
selection = self.addon_list.get_selection() selection = self.addon_list.get_selection()
model, node = selection.get_selected() if selection:
if node: model, node = selection.get_selected()
url = model.get_value(node, 9) if node:
self.install_addon_path.set_text(url) url = model.get_value(node, 9)
self.install_addon_path.set_text(url)
def build_menu_names(self, obj): def build_menu_names(self, obj):
return (self.title, "") return (self.title, "")