diff --git a/spritz/src/dialogs.py b/spritz/src/dialogs.py index 700f7cb9d..b3dc0d580 100644 --- a/spritz/src/dialogs.py +++ b/spritz/src/dialogs.py @@ -419,9 +419,10 @@ class AboutDialog(gtk.Window): gobject.timeout_add(0, self.__scroll, begin) - -def inputBox( parent, title, text): +def inputBox( parent, title, text, input_text = None): dlg = EntryDialog( parent, title, text) + if input_text: + dlg.entry.set_text(input_text) rc = dlg.run() dlg.destroy() return rc diff --git a/spritz/src/etpgui/widgets.py b/spritz/src/etpgui/widgets.py index c11b4cf3f..6b6538b1a 100644 --- a/spritz/src/etpgui/widgets.py +++ b/spritz/src/etpgui/widgets.py @@ -177,11 +177,14 @@ class UI(gtk.glade.XML): class Controller: """Base class for all controllers of glade-derived UIs.""" - def __init__(self, ui): + def __init__(self, ui, addrepo_ui): """Initialize a new instance. `ui' is the user interface to be controlled.""" self.ui = ui + self.addrepo_ui = addrepo_ui self.ui.signal_autoconnect(self._getAllMethods()) + self.addrepo_ui.signal_autoconnect(self._getAllMethods()) + self.addrepo_ui.addRepoWin.set_transient_for(self.ui.main) def _getAllMethods(self): """Get a dictionary of all methods in self's class hierarchy.""" diff --git a/spritz/src/gui.py b/spritz/src/gui.py index 9d78fc088..5bf48caf1 100644 --- a/spritz/src/gui.py +++ b/spritz/src/gui.py @@ -277,6 +277,7 @@ class SpritzGUI: self.catPackages = EntropyPackageView(self.ui.tvCatPackages,self.queueView) self.catDesc = TextViewConsole(self.ui.catDesc) self.repoView = EntropyRepoView(self.ui.viewRepo) + self.repoMirrorsView = EntropyRepositoryMirrorsView(self.addrepo_ui.mirrorsView) # Left Side Toolbar self.pageButtons = {} # Dict with page buttons self.firstButton = None # first button @@ -289,9 +290,9 @@ class SpritzGUI: self.packageRB = {} self.lastPkgPB = 'updates' self.tooltip = gtk.Tooltips() + + # setup add repository window self.console_menu_xml = gtk.glade.XML( const.GLADE_FILE, "terminalMenu",domain="yumex" ) - self.console_menu = self.console_menu_xml.get_widget( "terminalMenu" ) - self.console_menu_xml.signal_autoconnect(self) def setupGUI(self): ''' Setup the GUI''' @@ -306,7 +307,7 @@ class SpritzGUI: self.console = SpritzConsole() self.console.set_scrollback_lines(1024) self.console.set_scroll_on_output(True) - self.console.connect("button-press-event", self.console_click) + self.console.connect("button-press-event", self.on_console_click) termScroll = gtk.VScrollbar(self.console.get_adjustment()) self.ui.vteBox.pack_start(self.console, True, True) self.ui.termScrollBox.pack_start(termScroll, False) @@ -316,7 +317,7 @@ class SpritzGUI: self.ui.rbAll.hide() self.setupPkgFilter() - def console_click(self, widget, event): + def on_console_click(self, widget, event): self.console_menu.popup( None, None, None, event.button, event.time ) return True diff --git a/spritz/src/spritz.glade b/spritz/src/spritz.glade index 1cb3ac15b..d8f2739b6 100644 --- a/spritz/src/spritz.glade +++ b/spritz/src/spritz.glade @@ -298,73 +298,11 @@ True True True + gtk-add + True GTK_RELIEF_NORMAL True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Add - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - @@ -373,73 +311,24 @@ True True True + gtk-remove + True GTK_RELIEF_NORMAL True + + - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - R_emove - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - + + + True + True + True + gtk-edit + True + GTK_RELIEF_NORMAL + True + @@ -651,7 +540,7 @@ True - _Regenerate Cache + R_egenerate Cache True False GTK_JUSTIFY_LEFT @@ -4312,6 +4201,7 @@ True True True + True gtk-ok True GTK_RELIEF_NORMAL @@ -4418,2783 +4308,6 @@ - - True - Spritz Package Manager - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 800 - 600 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 0 - - - - 1 - True - GTK_PACK_DIRECTION_LTR - GTK_PACK_DIRECTION_LTR - - - - True - _File - True - - - - - - - True - gtk-quit - True - - - - - - - - - - - True - _Edit - True - - - - - - - True - gtk-preferences - True - - - - - - - - - - - True - _Profiles - True - - - - - - - True - gtk-new - True - - - - - - - True - gtk-save - True - - - - - - - True - - - - - - - - - - True - _Tools - True - - - - - - - True - _Yum Clean All - True - - - - - True - gtk-properties - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Help - True - - - - - - - True - gtk-about - True - - - - - - - - - - 0 - False - False - - - - - - True - True - 50 - - - - 5 - True - True - False - - - - 60 - True - False - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - False - - - - - - True - True - True - False - GTK_POS_TOP - True - False - - - - 6 - True - False - 6 - - - - True - False - 6 - - - - True - <span size="xx-large" color="black">Repository Store</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - gtk-refresh - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - GTK_PACK_END - - - - - 0 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_END - 6 - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-refresh - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Update Repositories - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-redo - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Regenerate Cache - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 5 - False - False - GTK_PACK_END - - - - - False - False - - - - - - True - 0 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - False - 0 - - - - True - False - 0 - - - - - - - - - - - - True - <b>Packages</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.479999989271 - 0.490000009537 - 8 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - True - Updates - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Available - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Installed - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - All - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - True - True - 0 - - - - - - - - True - True - 250 - - - - True - False - 0 - - - - 4 - True - False - 12 - - - - True - False - 6 - - - - True - True - True - True - 0 - - True - * - False - - - - 0 - True - True - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-find - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-cancel - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - False - True - - - - - - True - True - False - 0 - - - - True - False - 0 - - - - True - False - 0 - - - - 70 - True - True - Repos - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 0 - False - False - - - - - - True - False - True - True - True - 0 - - True - - False - - - - 0 - True - True - - - - - - 70 - True - True - Arch - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 0 - False - False - - - - - - True - False - True - True - True - 0 - - True - - False - - - - 0 - True - True - - - - - 0 - False - False - - - - - - - - True - Search Options - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - True - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - True - False - True - True - False - False - - - - - - 0 - True - True - - - - - True - False - - - - - - True - True - True - True - GTK_POS_BOTTOM - False - False - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - 3 - True - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - False - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - False - True - - - - - - True - _Description - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - False - True - - - - - - True - I_nformation - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - False - True - - - - - - True - Fi_les - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - False - True - - - - - - True - C_hangelog - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - False - True - - - - - - True - _Other - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - True - False - - - - - True - True - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_END - 6 - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Add All - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.490000009537 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Remove All - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-go-forward - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Process Queue - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 5 - False - False - - - - - False - True - - - - - - True - 1 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 6 - True - False - 6 - - - - True - False - 0 - - - - True - True - False - - - - True - True - False - - - - 30 - True - False - 6 - - - - True - gtk-dialog-info - 6 - 0.5 - 0.5 - 0 - 0 - - - 4 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 0 - 0 - - - - True - False - 6 - - - - True - <span size="large"><b>Action</b></span> - - False - True - GTK_JUSTIFY_LEFT - False - False - 0.0500000007451 - 0 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - <b>SUBACTION</b> - - False - True - GTK_JUSTIFY_LEFT - False - False - 0.0399999991059 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - True - True - - - - - - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-media-forward - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Skip - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - True - Extra - False - False - GTK_JUSTIFY_LEFT - False - False - 0.0399999991059 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - 0 - True - True - - - - - - - - - 0 - False - False - - - - - - True - True - False - - - - True - False - 6 - - - - True - GTK_PROGRESS_LEFT_TO_RIGHT - 0 - 0.00999999977648 - - PANGO_ELLIPSIZE_NONE - - - 3 - False - False - - - - - - - 0 - True - True - - - - - - True - GTK_PROGRESS_LEFT_TO_RIGHT - 0 - 0.00999999977648 - - PANGO_ELLIPSIZE_NONE - - - 9 - False - False - - - - - - True - GTK_BUTTONBOX_END - 0 - - - 0 - True - True - - - - - 1 - False - False - - - - - - True - - - 0 - False - True - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_IN - - - - True - False - 0 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 0 - True - True - - - - - - - - - 10 - True - True - - - - - - True - False - 0 - - - - - - - 0 - False - True - - - - - False - False - - - - - - True - 2 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 6 - True - False - 6 - - - - True - False - 0 - - - - True - <span size="xx-large" color="black">Group View</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - gtk-missing-image - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - GTK_PACK_END - - - - - 0 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_IN - - - - True - False - 0 - - - - True - False - 0 - - - - True - False - 0 - - - - True - True - 290 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - - True - False - - - - - - True - False - 0 - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_IN - - - - True - False - 0 - - - - True - True - True - False - False - True - False - False - False - - - - 0 - True - True - - - - - - - - - 0 - True - True - - - - - True - True - - - - - 0 - True - True - - - - - - True - - - 4 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - 40 - True - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - False - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 0 - False - False - - - - - - 5 - True - GTK_BUTTONBOX_END - 5 - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-go-forward - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Process Queue - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - - 0 - True - True - - - - - False - False - - - - - - True - 3 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 6 - True - False - 6 - - - - True - False - 0 - - - - True - <span size="xx-large" color="black">Package Queue</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - gtk-missing-image - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - GTK_PACK_END - - - - - 0 - False - False - - - - - - 2 - True - False - 0 - - - - True - <b>Quick add to queue</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - 20 - False - 0 - - - 0 - False - False - - - - - - True - True - True - True - 0 - - True - - False - - - - 0 - True - True - - - - - 0 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_START - 5 - - - - True - True - True - gtk-save - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-open - True - GTK_RELIEF_NORMAL - True - - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_END - 5 - - - - True - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-go-forward - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Process Queue - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - True - True - - - - - 0 - False - True - GTK_PACK_END - - - - - False - False - - - - - - True - 4 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - True - True - - - - - 0 - True - True - - - - - - True - True - - - 3 - False - False - - - - - - @@ -7216,4 +4329,602 @@ + + 550 + 380 + True + Add Repository + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + True + 550 + 380 + False + False + spritz-icon + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_CENTER + True + True + + + + + True + False + 0 + + + + True + False + 0 + + + + True + gtk-edit + 64 + 0.5 + 0.5 + 6 + 0 + + + 0 + False + True + + + + + + True + Adding a <b>new repository</b> lets you access <b>extra software</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 5 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 6 + False + True + + + + + + True + False + 0 + + + + 4 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 8 + 0 + 12 + 12 + + + + True + 5 + 2 + False + 3 + 10 + + + + True + Identifier + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Description + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Download mirrors + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + Database URL + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 3 + 4 + + + + + + + True + Database compression + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + 120 + True + False + 0 + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + True + False + False + False + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_END + 0 + + + + True + True + True + gtk-edit + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-remove + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-add + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + 1 + 2 + 2 + 3 + fill + fill + + + + + + True + bz2 +gz + False + True + + + 1 + 2 + 4 + 5 + fill + fill + + + + + + + + + + True + Repository information + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 9 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + 5 + True + GTK_BUTTONBOX_END + 10 + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-edit + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Insert String + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + True + True + gtk-add + True + GTK_RELIEF_NORMAL + True + + + + + + 6 + False + True + + + + + + diff --git a/spritz/src/spritz.py b/spritz/src/spritz.py index 60450637e..470092dc7 100644 --- a/spritz/src/spritz.py +++ b/spritz/src/spritz.py @@ -59,8 +59,9 @@ class SpritzController(Controller): self.etpbase = EntropyPackages(EquoConnection) # Create and ui object contains the widgets. ui = UI( const.GLADE_FILE , 'main', 'yumex' ) + addrepo_ui = UI( const.GLADE_FILE , 'addRepoWin', 'yumex' ) # init the Controller Class to connect signals. - Controller.__init__( self, ui ) + Controller.__init__( self, ui, addrepo_ui ) self.clipboard = gtk.Clipboard() self.pty = pty.openpty() @@ -92,11 +93,84 @@ class SpritzController(Controller): pass sys.exit( 1 ) # Terminate Program + def on_repoMirrorAdd_clicked( self, widget ): + text = inputBox(self.addrepo_ui.addRepoWin, _("Insert URL"), _("Enter a download mirror, HTTP or FTP")+" ") + # call liststore and tell to add + if text: + # validate url + if not (text.startswith("http://") or text.startswith("ftp://")): + okDialog( self.addrepo_ui.addRepoWin, _("You must enter either a HTTP or a FTP url.") ) + else: + self.repoMirrorsView.add(text) + + def on_repoMirrorRemove_clicked( self, widget ): + selection = self.repoMirrorsView.view.get_selection() + urldata = selection.get_selected() + if urldata: + self.repoMirrorsView.remove(urldata) + + def on_repoMirrorEdit_clicked( self, widget ): + selection = self.repoMirrorsView.view.get_selection() + urldata = selection.get_selected() + # get text + if urldata[1] != None: + text = self.repoMirrorsView.get_text(urldata) + self.repoMirrorsView.remove(urldata) + text = inputBox(self.addrepo_ui.addRepoWin, _("Insert URL"), _("Enter a download mirror, HTTP or FTP")+" ", input_text = text) + # call liststore and tell to add + self.repoMirrorsView.add(text) + def on_addRepo_clicked( self, widget ): - print "add repo" + self.addrepo_ui.repodbcformatEntry.set_active(0) + self.addrepo_ui.repoidEntry.set_text("") + self.addrepo_ui.repoDescEntry.set_text("") + self.addrepo_ui.repodbEntry.set_text("") + self.addrepo_ui.addRepoWin.show() + self.repoMirrorsView.populate() + + def on_repoSubmit_clicked( self, widget ): + repodata = {} + repodata['repoid'] = self.addrepo_ui.repoidEntry.get_text() + repodata['description'] = self.addrepo_ui.repoDescEntry.get_text() + repodata['packages'] = self.repoMirrorsView.get_all() + repodata['dbcformat'] = self.addrepo_ui.repodbcformatEntry.get_active_text() + repodata['database'] = self.addrepo_ui.repodbEntry.get_text() + # validate + errors = [] + if not repodata['repoid']: + errors.append(_('No Repository Identifier')) + if repodata['repoid'] and etpRepositories.has_key(repodata['repoid']): + errors.append(_('Duplicated Repository Identifier')) + if not repodata['description']: + repodata['description'] = "No description" + if not repodata['packages']: + errors.append(_("No download mirrors")) + if not repodata['database'] or not (repodata['database'].endswith("http://") or (not repodata['database'].endswith("ftp://"))): + errors.append(_("Database URL must be HTTP or FTP")) + if not errors: + self.Equo.addRepository(repodata) + initConfig_entropyConstants(etpSys['rootdir']) + self.setupRepoView() + self.addrepo_ui.addRepoWin.hide() + else: + okDialog( self.addrepo_ui.addRepoWin, _("Wrong entries, errors: %s") % (', '.join(errors),) ) + + def on_addRepoWin_delete_event(self, widget, path): + return True + + def on_repoCancel_clicked( self, widget ): + self.addrepo_ui.addRepoWin.hide() def on_removeRepo_clicked( self, widget ): - print "remove repo" + # get selected repo + selection = self.repoView.view.get_selection() + repodata = selection.get_selected() + # get text + if repodata[1] != None: + repoid = self.repoView.get_repoid(repodata) + self.Equo.removeRepository(repoid) + initConfig_entropyConstants(etpSys['rootdir']) + self.setupRepoView() def on_terminal_clear_activate(self, widget): self.output.text_written = [] diff --git a/spritz/src/views.py b/spritz/src/views.py index 4c20c5660..efa23ecb9 100644 --- a/spritz/src/views.py +++ b/spritz/src/views.py @@ -252,7 +252,7 @@ class YumexQueueView: self.view.append_column( column1 ) cell2 = gtk.CellRendererText() - column2= gtk.TreeViewColumn( _( "Summary" ), cell2, text=1 ) + column2= gtk.TreeViewColumn( _( "Description" ), cell2, text=1 ) column2.set_resizable( True ) self.view.append_column( column2 ) model.set_sort_column_id( 0, gtk.SORT_ASCENDING ) @@ -484,7 +484,7 @@ class EntropyRepoView: # Setup Selection Column cell1 = gtk.CellRendererToggle() # Selection cell1.set_property( 'activatable', True ) - column1 = gtk.TreeViewColumn( "Active", cell1 ) + column1 = gtk.TreeViewColumn( "Selected", cell1 ) column1.add_attribute( cell1, "active", 0 ) column1.set_resizable( True ) column1.set_sort_column_id( -1 ) @@ -546,21 +546,23 @@ class EntropyRepoView: def deselect_all( self ): iterator = self.store.get_iter_first() - while iterator != None: + while iterator != None: self.store.set_value( iterator, 0, False ) iterator = self.store.iter_next( iterator ) def select_all( self ): iterator = self.store.get_iter_first() - while iterator != None: + while iterator != None: self.store.set_value( iterator, 0, True ) iterator = self.store.iter_next( iterator ) + def get_repoid(self, iterdata): + model, iter = iterdata + return model.get_value( iter, 2 ) def select_by_keys( self, keys): - self.store iterator = self.store.get_iter_first() - while iterator != None: + while iterator != None: repoid = self.store.get_value( iterator, 1 ) if repoid in keys: self.store.set_value( iterator, 0, True ) @@ -568,6 +570,65 @@ class EntropyRepoView: self.store.set_value( iterator, 0, False) iterator = self.store.iter_next( iterator ) +class EntropyRepositoryMirrorsView: + """ + This class controls the repo TreeView + """ + def __init__( self, widget): + self.view = widget + self.headers = [""] + self.store = self.setup_view() + + def setup_view( self ): + """ Create models and columns for the Repo TextView """ + store = gtk.ListStore(str) + self.view.set_model( store ) + + # Setup Repository URL column + self.create_text_column( "", 0 ) + + # Setup reponame & repofile column's + self.view.set_search_column( 1 ) + self.view.set_reorderable( False ) + return store + + def create_text_column( self, hdr, colno): + cell = gtk.CellRendererText() # Size Column + column = gtk.TreeViewColumn( hdr, cell, text=colno ) + column.set_resizable( True ) + self.view.append_column( column ) + + def populate(self): + """ Populate a repo liststore with data """ + self.store.clear() + + def get_selected( self ): + selected = [] + for elem in self.store: + name = elem[0] + if name: + selected.append( name ) + return selected + + def get_all( self ): + all = [x[0] for x in self.store] + return all + + def add(self, url): + self.store.append([str(url)]) + + def remove_selected(self): + urls = self.get_selected() + self.remove(urls) + + def get_text(self, urldata): + model, iter = urldata + return model.get_value( iter, 0 ) + + def remove(self, urldata): + model, iter = urldata + self.store.remove(iter) + class YumexPluginView: def __init__( self, widget ): self.view = widget