From 80a1955274e8b7e9bcf52fe1eaff46396ea4e521 Mon Sep 17 00:00:00 2001 From: lxnay Date: Mon, 2 Jun 2008 09:10:25 +0000 Subject: [PATCH] Entropy/Spritz: - implement the Preferences menu - reorder left buttons git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2080 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- TODO | 5 +- spritz/gfx/preferences.png | Bin 0 -> 846 bytes spritz/src/dialogs.py | 2 +- spritz/src/gui.py | 17 +- spritz/src/spritz.glade | 849 ++++++++++++++++++++++++++++++++++++- spritz/src/spritz.py | 282 ++++++++++++ spritz/src/spritz_setup.py | 4 +- 7 files changed, 1149 insertions(+), 10 deletions(-) create mode 100644 spritz/gfx/preferences.png diff --git a/TODO b/TODO index dc0aba6ea..7bb849550 100644 --- a/TODO +++ b/TODO @@ -16,13 +16,10 @@ TODO list Spritz: - configuration menu (equo.conf + others interface) - - package masking menu - install tbz2 - Popularity feature / Your Ego service - Category <-> Image dictionary (for the properties menu) - - Skip Mirror buttons - - button to stop the queue - - show the number of packages found in a list + - Spritz related preferences Notes: - when supporting more than one ":" in atoms, remember to fix treeupdates functions accordingly \ No newline at end of file diff --git a/spritz/gfx/preferences.png b/spritz/gfx/preferences.png new file mode 100644 index 0000000000000000000000000000000000000000..3ec71a35777e5bb0b5954877e0e69eef103f053c GIT binary patch literal 846 zcmV-U1F`&xP)yu3cONp;MtWU_qfu2TPnC z%MF1Fy41;41xvw1v{MD?s1U1yTQ>(0bZ7|&ieEUmeBXP& z@8^E+@d)ss2mNCa>t$(aiT&;H@$qpY+Ku7iVU)||dk@xi9UB`P000NT+S=N^hr31W zKQv7n1Tfdv*Z1Z=!Y(c@q@$ywEz>lg&d$#M1Y8|BJw5&2($W$w7K_hiSY;Qajj z8Gs*Fcoo3>{Cru{wCz%<^dS@qwKf{SFpL~y?7iI+-IFM#Ukio8i=Lhy>IQkOlVuqP2M4Mk2w!Rf1OkC?XJ=>F+}uQOZ!h}$`wf=)l0h0M^&nF)=aW$gJvsB}yr}y1LNa-CY&v7GsQ$6G9M+#Sn|dz!>A>e)0vd ziV;GP&1RwNy2JN^k|YW3?d=XIJKU`R0HCd{jl;OZy^7mI8Dspp5kMpofngZ@%CxsL z9*+aK+$P2tD5ap3!Y~Y&rs0Mpac04}?b zOeQ(h)YKG*nVg*T4X+7c754K9A;@fRSIuo|YQoO$F85VcMWIl*8$c?RcKCuIfDi&% zQ5~KoyRRq;!r?GP(L1Uxz|hbT-o8t4Fa7xw@4$5cEWf$A`E~$=5QJR?2_aZnS;6a9 zFDqc_G{(lpu)MtN@K;w?F)}jZyPenC0$EiZp5?m_r}edN|4#RSyVZ68Kj1q4BLMtV zdI898<6~0et+xYs9ZoObrB(nYfZu)qLF?j(L?XUb5{bl(e1KnOG61O-fWa8sT3lQl z^sRJD>AJoHKnGB?JipWN7{C(%VE};!WLtl=^8kKbLDU4W#zX)@jXBp9y?V?B)cVi# Y2T(ICG+eD+WB>pF07*qoM6N<$f~#7D^Z)<= literal 0 HcmV?d00001 diff --git a/spritz/src/dialogs.py b/spritz/src/dialogs.py index 19159b1cb..6c8f2a5bb 100644 --- a/spritz/src/dialogs.py +++ b/spritz/src/dialogs.py @@ -808,7 +808,7 @@ class infoDialog: return self.dialog.run() def destroy( self ): - return self.dialog.destroy() + return self.dialog.destroy() class EntryDialog: diff --git a/spritz/src/gui.py b/spritz/src/gui.py index 139dda2d8..3910b83a8 100644 --- a/spritz/src/gui.py +++ b/spritz/src/gui.py @@ -242,6 +242,7 @@ class SpritzGUI: self.setupAdvisoriesFilter() self.setupImages() + self.setupLabels() def on_console_click(self, widget, event): @@ -301,10 +302,11 @@ class SpritzGUI: # Setup Vertical Toolbar self.createButton( _( "Packages" ), "button-packages.png", 'packages',True ) self.createButton( _( "Package Categories" ), "button-group.png", 'group') - self.createButton( _( "Package Queue" ), "button-queue.png", 'queue' ) + self.createButton( _( "Security Advisories" ), "button-glsa.png", 'glsa' ) self.createButton( _( "Repository Selection" ), "button-repo.png", 'repos' ) self.createButton( _( "Configuration Files" ), "button-conf.png", 'filesconf' ) - self.createButton( _( "Security Advisories" ), "button-glsa.png", 'glsa' ) + self.createButton( _( "Preferences" ), "preferences.png", 'preferences' ) + self.createButton( _( "Package Queue" ), "button-queue.png", 'queue' ) self.createButton( _( "Output" ), "button-output.png", 'output' ) def createButton( self, text, icon, page,first = None ): @@ -314,7 +316,7 @@ class SpritzGUI: else: button = gtk.RadioButton( self.firstButton ) button.connect( "clicked", self.on_PageButton_changed, page ) - button.connect( "pressed", self.on_PageButton_pressed, page ) + #button.connect( "pressed", self.on_PageButton_pressed, page ) button.set_relief( gtk.RELIEF_NONE ) button.set_mode( False ) @@ -338,6 +340,7 @@ class SpritzGUI: self.pageButtons[page] = button def setupImages(self): + """ setup misc application images """ # progressImage iconpath = os.path.join(const.PIXMAPS_PATH,"sabayon.png") @@ -348,6 +351,14 @@ class SpritzGUI: except gobject.GError: pass + def setupLabels(self): + """ setup misc application labels """ + + mytxt = "%s" % (_("Preferences"),) + self.ui.preferencesTitleLabel.set_markup(mytxt) + mytxt = "%s" % (_("Some configuration options are critical for the health of your System. Be careful."),) + self.ui.preferencesLabel.set_markup(mytxt) + def setPage( self, page ): self.activePage = page diff --git a/spritz/src/spritz.glade b/spritz/src/spritz.glade index 3299805a5..4a931138e 100644 --- a/spritz/src/spritz.glade +++ b/spritz/src/spritz.glade @@ -2212,7 +2212,853 @@ - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-preferences + 6 + + + False + False + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 1 + label + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 0 + label + + + 1 + + + + + 1 + + + + + False + 3 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_OUT + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + 2 + 10 + 9 + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 3 + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Prevents files belonging to a package being overwritten by another + Disabled +Removal only +Install+Removal + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Collision protection + + + 1 + 2 + + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + This is what they call "nice level" + 3 + 3 + 1 -19 19 1 10 10 + 1 + True + + + + 1 + 2 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Process priority (nice) + + + + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Entropy can keep a backup of your updated configuration files + Backup configuration files + 0 + True + + + + 2 + 2 + 3 + + + + + + 1 + 2 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Ignored protected files + + + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_SPREAD + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-new + + + + + False + False + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-edit + + + + + False + False + 1 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-delete + + + + + False + False + 2 + + + + + False + False + 1 + + + + + 1 + + + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Protected files and directories mask + + + False + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_SPREAD + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-new + + + + + False + False + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-edit + + + + + False + False + 1 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-delete + + + + + False + False + 2 + + + + + False + False + 1 + + + + + 1 + + + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Protected files and directories + + + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_SPREAD + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-new + + + + + False + False + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-edit + + + + + False + False + 1 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-delete + + + + + False + False + 2 + + + + + False + False + 1 + + + + + 1 + + + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + label_item + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + System + + + tab + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_OUT + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 3 + 3 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + kb/sec + + + 2 + 3 + 2 + 3 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 = no limit; 100 = 100kb/sec + False + 0 0 99999 1 100 100 + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Example: http://proxy:1234 + + + + 1 + 3 + 1 + 2 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Example: http://proxy:1234 + + + + 1 + 3 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Download speed limit + + + 2 + 3 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + HTTP Proxy + + + 1 + 2 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + FTP Proxy + + + GTK_FILL + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Socket settings + True + + + label_item + + + + + + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Networking + + + tab + 1 + False + + + + + + + + + tab + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 10 + GTK_BUTTONBOX_START + + + True + False + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-revert-to-saved + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Restore + + + 1 + + + + + + + + + True + False + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-save + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Save + + + 1 + + + + + + + 1 + + + + + False + False + 4 + 2 + + + + + 7 + @@ -2723,6 +3569,7 @@ True + 8 True GTK_WIN_POS_CENTER_ON_PARENT GDK_WINDOW_TYPE_HINT_DIALOG diff --git a/spritz/src/spritz.py b/spritz/src/spritz.py index 50337b1eb..57695055c 100644 --- a/spritz/src/spritz.py +++ b/spritz/src/spritz.py @@ -503,11 +503,102 @@ class SpritzController(Controller): def on_terminal_copy_activate(self, widget): self.clipboard.clear() self.clipboard.set_text(''.join(self.output.text_written)) + def on_Preferences_toggled(self, widget, toggle = True): + self.ui.preferencesSaveButton.set_sensitive(toggle) + self.ui.preferencesRestoreButton.set_sensitive(toggle) + + def on_preferencesSaveButton_clicked(self, widget): + sure = questionDialog(self.ui.main, _("Are you sure ?")) + if not sure: + return + for config_file in self.Preferences: + for name, setting, mytype, fillfunc, savefunc, wgwrite, wgread in self.Preferences[config_file]: + if mytype == list: + savefunc(config_file, name, setting, mytype, wgwrite, wgread) + else: + data = wgread() + result = savefunc(config_file, name, setting, mytype, data) + if not result: + errorMessage( + self.ui.main, + cleanMarkupString("%s: %s") % (_("Error saving parameter"),name,), + _("An issue occured while saving a preference"), + "%s %s: %s" % (_("Parameter"),name,_("not saved"),), + ) + initConfig_entropyConstants(etpConst['systemroot']) + self.setupPreferences() + + def on_preferencesRestoreButton_clicked(self, widget): + self.setupPreferences() + + def on_configProtectNew_clicked(self, widget): + data = inputBox( self.ui.main, _("New"), _("Please insert a new path")) + if not data: + return + self.configProtectModel.append([data]) + + def on_configProtectMaskNew_clicked(self, widget): + data = inputBox( self.ui.main, _("New"), _("Please insert a new path")) + if not data: + return + self.configProtectMaskModel.append([data]) + + def on_configProtectSkipNew_clicked(self, widget): + data = inputBox( self.ui.main, _("New"), _("Please insert a new path")) + if not data: + return + self.configProtectSkipModel.append([data]) + + def on_configProtectDelete_clicked(self, widget): + model, myiter = self.configProtectView.get_selection().get_selected() + if myiter: + model.remove(myiter) + + def on_configProtectMaskDelete_clicked(self, widget): + model, myiter = self.configProtectMaskView.get_selection().get_selected() + if myiter: + model.remove(myiter) + + def on_configProtectSkipDelete_clicked(self, widget): + model, myiter = self.configProtectSkipView.get_selection().get_selected() + if myiter: + model.remove(myiter) + + def on_configProtectEdit_clicked(self, widget): + model, myiter = self.configProtectView.get_selection().get_selected() + if myiter: + item = model.get_value( myiter, 0 ) + data = inputBox( self.ui.main, _("New"), _("Please edit the selected path"), input_text = item) + if not data: + return + model.remove(myiter) + self.configProtectModel.append([data]) + + def on_configProtectMaskEdit_clicked(self, widget): + model, myiter = self.configProtectMaskView.get_selection().get_selected() + if myiter: + item = model.get_value( myiter, 0 ) + data = inputBox( self.ui.main, _("New"), _("Please edit the selected path"), input_text = item) + if not data: + return + model.remove(myiter) + self.configProtectMaskModel.append([data]) + + def on_configProtectSkipEdit_clicked(self, widget): + model, myiter = self.configProtectSkipView.get_selection().get_selected() + if myiter: + item = model.get_value( myiter, 0 ) + data = inputBox( self.ui.main, _("New"), _("Please edit the selected path"), input_text = item) + if not data: + return + model.remove(myiter) + self.configProtectSkipModel.append([data]) def on_PageButton_pressed( self, widget, page ): pass def on_PageButton_changed( self, widget, page ): + ''' Left Side Toolbar Handler''' # do not put here actions for 'packages' and 'output' but use on_PageButton_pressed if page == "filesconf": @@ -917,6 +1008,7 @@ class SpritzApplication(SpritzController,SpritzGUI): self.logger = logging.getLogger("yumex.main") # init flags + self.Preferences = None self.skipMirrorNow = False self.abortQueueNow = False self.doProgress = False @@ -947,6 +1039,196 @@ class SpritzApplication(SpritzController,SpritzGUI): self.pkgProperties_selected = None self.setupAdvPropertiesView() + self.setupPreferences() + + def setupPreferences(self): + + # config protect + self.configProtectView = self.ui.configProtectView + for mycol in self.configProtectView.get_columns(): self.configProtectView.remove_column(mycol) + self.configProtectModel = gtk.ListStore( gobject.TYPE_STRING ) + cell = gtk.CellRendererText() + column = gtk.TreeViewColumn( _( "Item" ), cell, markup = 0 ) + self.configProtectView.append_column( column ) + self.configProtectView.set_model( self.configProtectModel ) + + # config protect mask + self.configProtectMaskView = self.ui.configProtectMaskView + for mycol in self.configProtectMaskView.get_columns(): self.configProtectMaskView.remove_column(mycol) + self.configProtectMaskModel = gtk.ListStore( gobject.TYPE_STRING ) + cell = gtk.CellRendererText() + column = gtk.TreeViewColumn( _( "Item" ), cell, markup = 0 ) + self.configProtectMaskView.append_column( column ) + self.configProtectMaskView.set_model( self.configProtectMaskModel ) + + # config protect skip + self.configProtectSkipView = self.ui.configProtectSkipView + for mycol in self.configProtectSkipView.get_columns(): self.configProtectSkipView.remove_column(mycol) + self.configProtectSkipModel = gtk.ListStore( gobject.TYPE_STRING ) + cell = gtk.CellRendererText() + column = gtk.TreeViewColumn( _( "Item" ), cell, markup = 0 ) + self.configProtectSkipView.append_column( column ) + self.configProtectSkipView.set_model( self.configProtectSkipModel ) + + # prepare generic config to allow filling of data + def fillSettingView(model, view, data): + model.clear() + view.set_model(model) + view.set_property('headers-visible',False) + for item in data: + model.append([item]) + view.expand_all() + + def fillSetting(name, mytype, wgwrite, data): + if type(data) != mytype: + if data == None: # empty parameter + return + errorMessage( + self.ui.main, + cleanMarkupString("%s: %s") % (_("Error setting parameter"),name,), + _("An issue occured while loading a preference"), + "%s %s %s: %s, %s: %s" % (_("Parameter"),name,_("must be of type"),mytype,_("got"),type(data),), + ) + return + wgwrite(data) + + def saveSettingView(config_file, name, setting, mytype, model, view): + + data = [] + iterator = model.get_iter_first() + while iterator != None: + item = model.get_value( iterator, 0 ) + if item: + data.append(item) + iterator = model.iter_next( iterator ) + + return saveSetting(config_file, name, setting, mytype, data) + + + def saveSetting(config_file, name, myvariable, mytype, data): + # saving setting + writedata = '' + if (not isinstance(data,mytype)) and (data != None): + errorMessage( + self.ui.main, + cleanMarkupString("%s: %s") % (_("Error setting parameter"),name,), + _("An issue occured while saving a preference"), + "%s %s %s: %s, %s: %s" % (_("Parameter"),name,_("must be of type"),mytype,_("got"),type(data),), + ) + return False + + if isinstance(data,int): + writedata = str(data) + elif isinstance(data,list): + writedata = ' '.join(data) + elif isinstance(data,bool): + writedata = "disable" + if data: writedata = "enable" + return saveParameter(config_file, name, writedata) + + def saveParameter(config_file, name, data): + return entropyTools.writeParameterToFile(config_file,name,data) + + self.Preferences = { + etpConst['entropyconf']: [ + ( + 'ftp-proxy', + etpConst['proxy']['ftp'], + basestring, + fillSetting, + saveSetting, + self.ui.ftpProxyEntry.set_text, + self.ui.ftpProxyEntry.get_text, + ), + ( + 'http-proxy', + etpConst['proxy']['http'], + basestring, + fillSetting, + saveSetting, + self.ui.httpProxyEntry.set_text, + self.ui.httpProxyEntry.get_text, + ), + ( + 'nice-level', + etpConst['current_nice'], + int, + fillSetting, + saveSetting, + self.ui.niceSpinSelect.set_value, + self.ui.niceSpinSelect.get_value_as_int, + ) + ], + etpConst['equoconf']: [ + ( + 'collisionprotect', + etpConst['collisionprotect'], + int, + fillSetting, + saveSetting, + self.ui.collisionProtectionCombo.set_active, + self.ui.collisionProtectionCombo.get_active, + ), + ( + 'configprotect', + etpConst['configprotect'], + list, + fillSettingView, + saveSettingView, + self.configProtectModel, + self.configProtectView, + ), + ( + 'configprotectmask', + etpConst['configprotectmask'], + list, + fillSettingView, + saveSettingView, + self.configProtectMaskModel, + self.configProtectMaskView, + ), + ( + 'configprotectskip', + etpConst['configprotectskip'], + list, + fillSettingView, + saveSettingView, + self.configProtectSkipModel, + self.configProtectSkipView, + ), + ( + 'filesbackup', + etpConst['filesbackup'], + bool, + fillSetting, + saveSetting, + self.ui.filesBackupCheckbutton.set_active, + self.ui.filesBackupCheckbutton.get_active, + ) + ], + etpConst['repositoriesconf']: [ + ( + 'downloadspeedlimit', + etpConst['downloadspeedlimit'], + int, + fillSetting, + saveSetting, + self.ui.speedLimitSpin.set_value, + self.ui.speedLimitSpin.get_value_as_int, + ) + ], + } + + # load data + for config_file in self.Preferences: + for name, setting, mytype, fillfunc, savefunc, wgwrite, wgread in self.Preferences[config_file]: + if mytype == list: + fillfunc(wgwrite,wgread,setting) + else: + fillfunc(name, mytype, wgwrite, setting) + + self.on_Preferences_toggled(None,False) + def setupMaskedPackagesWarningBox(self): mytxt = "%s\n%s" % ( _("Attention"), diff --git a/spritz/src/spritz_setup.py b/spritz/src/spritz_setup.py index 55fa82e18..f9b499922 100644 --- a/spritz/src/spritz_setup.py +++ b/spritz/src/spritz_setup.py @@ -55,6 +55,7 @@ class const: PAGE_QUEUE = 4 PAGE_FILESCONF = 5 PAGE_GLSA = 6 + PAGE_PREFERENCES = 7 PAGES = { 'packages' : PAGE_PKG, 'repos' : PAGE_REPOS, @@ -62,7 +63,8 @@ class const: 'queue' : PAGE_QUEUE, 'group' : PAGE_GROUP, 'filesconf' : PAGE_FILESCONF, - 'glsa' : PAGE_GLSA + 'glsa' : PAGE_GLSA, + 'preferences': PAGE_PREFERENCES } PACKAGE_PROGRESS_STEPS = ( 0.1, # Depsolve