diff --git a/TODO b/TODO index 30fe362f2..9cc3da838 100644 --- a/TODO +++ b/TODO @@ -13,13 +13,13 @@ TODO list: - find a way to better handle real smartapps deps (need split PDEPEND?) Spritz: - - debug (*) (speed on selecting stuff for the first time) - if a package has a non OSS License, show it (*) IMPLEMENT - remove package info widgets and write from scratch (*) - add masking menu - use availability bool to show masked packages and connect the masking menu - Popularity feature - GLSA interface + - Skip Mirror buttons Project Status: diff --git a/client/text_query.py b/client/text_query.py index 2154ee6b4..00f18426e 100644 --- a/client/text_query.py +++ b/client/text_query.py @@ -911,6 +911,7 @@ def printPackageInfo(idpackage, dbconn, clientSearch = False, strictOutput = Fal pkgtag = dbconn.retrieveVersionTag(idpackage) pkgrev = dbconn.retrieveRevision(idpackage) pkgdesc = dbconn.retrieveDescription(idpackage) + pkguseflags = dbconn.retrieveUseflags(idpackage) pkgbranch = dbconn.retrieveBranch(idpackage) if (not pkgtag): pkgtag = "NoTag" @@ -964,7 +965,13 @@ def printPackageInfo(idpackage, dbconn, clientSearch = False, strictOutput = Fal for conflict in pkgconflicts: print_info(darkred(" ## \t\t\t")+brown(conflict)) print_info(darkgreen(" Homepage:\t\t")+red(pkghome)) - print_info(darkgreen(" Description:\t\t")+pkgdesc) + + if (not strictOutput): + # print description + _my_formatted_print(pkgdesc,darkgreen(" Description:\t\t"),"\t\t\t\t") + # print use flags + _my_formatted_print(pkguseflags,darkgreen(" USE flags:\t\t"),"\t\t\t\t", color = red) + if (not strictOutput): if (extended): print_info(darkgreen(" CHOST:\t\t")+blue(pkgflags[0])) @@ -984,3 +991,24 @@ def printPackageInfo(idpackage, dbconn, clientSearch = False, strictOutput = Fal print_info(darkgreen(" Keywords:\t\t")+red(' '.join(pkgkeywords))) print_info(darkgreen(" Created:\t\t")+pkgcreatedate) print_info(darkgreen(" License:\t\t")+red(pkglic)) + +def _my_formatted_print(data,header,reset_columns, min_chars = 25, color = None): + if type(data) is set: + mydata = list(data) + elif type(data) is not list: + mydata = data.split() + else: + mydata = data + fcount = 0 + desc_text = header + for x in mydata: + fcount += len(x) + if color: + desc_text += color(x)+" " + else: + desc_text += x+" " + if fcount > min_chars: + fcount = 0 + print_info(desc_text) + desc_text = reset_columns + if fcount > 0: print_info(desc_text) \ No newline at end of file diff --git a/spritz/gfx/sabayon-console-background.png b/spritz/gfx/sabayon-console-background.png new file mode 100644 index 000000000..a37cb9873 Binary files /dev/null and b/spritz/gfx/sabayon-console-background.png differ diff --git a/spritz/src/dialogs.py b/spritz/src/dialogs.py index 965726184..46068eadf 100644 --- a/spritz/src/dialogs.py +++ b/spritz/src/dialogs.py @@ -28,7 +28,7 @@ except: from ConfigParser import ConfigParser,SafeConfigParser -from misc import const,cleanMarkupSting,YumexConf,unicode2htmlentities +from misc import const,cleanMarkupSting,SpritzConf,unicode2htmlentities from i18n import _ class ConfimationDialog: @@ -358,7 +358,7 @@ def okDialog(parent, msg): dlg = gtk.MessageDialog(parent=parent, type=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_OK) - dlg.set_markup(cleanMarkupSting(msg)) + dlg.set_markup(msg) dlg.set_title( _("Attention") ) rc = dlg.run() dlg.destroy() diff --git a/spritz/src/etpgui/widgets.py b/spritz/src/etpgui/widgets.py index ba3e9381a..439d31c12 100644 --- a/spritz/src/etpgui/widgets.py +++ b/spritz/src/etpgui/widgets.py @@ -17,22 +17,34 @@ # Authors: # Tim Lauridsen -import gtk.glade +import gtk.glade,gtk.gdk import pango import etpgui import gobject import types -import sys +import sys, os from misc import const import vte class SpritzConsole(vte.Terminal): - def __init__(self, default_style = None): + def __init__(self, settings): vte.Terminal.__init__(self) + self.settings = settings + self.myfontcolor = gtk.gdk.color_parse(self.settings.color_console_font) + self._dosettings() + + def _dosettings(self): + imgpath = os.path.join(const.PIXMAPS_PATH,'sabayon-console-background.png') + if os.path.isfile(imgpath): + self.set_background_image_file(imgpath) + self.set_background_saturation(0.4) + self.set_opacity(65535) + self.set_color_foreground(self.myfontcolor) def reset (self): vte.Terminal.reset(self, True, True) + self._dosettings() class TextViewConsole: diff --git a/spritz/src/gui.py b/spritz/src/gui.py index 0b4c84d2e..3dec74855 100644 --- a/spritz/src/gui.py +++ b/spritz/src/gui.py @@ -18,7 +18,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. from etpgui import * -from misc import SpritzQueue,YumexConf,const,cleanMarkupSting +from misc import SpritzQueue, SpritzConf, const, cleanMarkupSting from views import * from etpgui.widgets import TextViewConsole, SpritzConsole from i18n import _ @@ -185,7 +185,7 @@ class YumexProgress: class SpritzGUI: ''' This class contains GUI related methods ''' def __init__(self, EquoConnection, etpbase): - self.settings = YumexConf() + self.settings = SpritzConf() # Package & Queue Views self.Entropy = EquoConnection self.etpbase = etpbase @@ -227,7 +227,7 @@ class SpritzGUI: self.setPage(self.activePage) # put self.console in place - self.console = SpritzConsole() + self.console = SpritzConsole(self.settings) self.console.set_scrollback_lines(1024) self.console.set_scroll_on_output(True) self.console.connect("button-press-event", self.on_console_click) diff --git a/spritz/src/misc.py b/spritz/src/misc.py index 0609fe2c0..0e4f2d2dc 100644 --- a/spritz/src/misc.py +++ b/spritz/src/misc.py @@ -52,7 +52,6 @@ class const: "RPM Groups", "Age"] - YUM_PID_FILE = '/var/run/equo.pid' DAY_IN_SECONDS = 86400 # Page -> Notebook page numbers PAGE_REPOS = 0 @@ -81,33 +80,6 @@ class const: 0.2, # Updates 0.1, # Group 0.3) # get package Lists - PACKAGE_CATEGORY_NO = 5 - -# Package Category Control Dict. - PACKAGE_CATEGORY_DICT = { -# -# [1] [2] [3] [4] [5] [6] -#------------------------------------------------------------------------- - 1 : ( _( 'RPM Groups' ), 'getByAttr', 'group', True, True), - 2 : ( _( 'Repositories' ), 'getByProperty', 'repoid', True, False ), - 3 : ( _( 'Architecture' ), 'getByProperty', 'arch', True, False ), - 4 : ( _( 'Sizes' ), 'getBySizes', '', False, False ), - 5 : ( _( 'Age' ), 'getByAge', '', False, False )} - -# [1] : Order in Category Combo -# [2] : Text in Combo -# [3] : Method to get the package by category -# [4] : Parameter to [3]. -# [5] : Sort flag -# [6] : Split Categoties and make a tree, insted of a list - - GROUP_PACKAGE_TYPE = { - 'm' : _('Mandatory'), - 'd' : _('Default'), - 'o' : _('Optional'), - 'c' : _('Conditional') - } - CREDITS = ( (('Spritz Package Manager - %s' % __spritz_version__), @@ -467,7 +439,7 @@ class SpritzQueue: return action return None -class YumexConf: +class SpritzConf: """ Yum Extender Config Setting""" autorefresh = True recentdays = 14 @@ -477,7 +449,8 @@ class YumexConf: proxy = "" font_console = 'Monospace 8' font_pkgdesc = 'Monospace 8' - color_console = '#68228B' + color_console_background = '#FFFFFF' + color_console_font = '#000000' color_pkgdesc = '#68228B' color_install = 'darkgreen' color_update = 'red' @@ -528,58 +501,6 @@ class YumexConf: return default -class SpritzOptions: - - def __init__(self): - self.logger = logging.getLogger('yumex.YumexOptions') - self._optparser = OptionParser() - self.setupParser() - - def parseCmdOptions(self): - self.getCmdlineOptions() - - def getYumexConfig(self,configfile='/etc/spritz.conf', sec='spritz' ): - conf = YumexConf() - parser = ConfigParser() - parser.read( configfile ) - conf.populate( parser, sec ) - return conf - - def reload(self): - self.settings = self.getYumexConfig() - - def getArgs(self): - return self.cmd_args - - def setupParser(self): - parser = self._optparser - parser.add_option( "-d", "--debug", - action="store_true", dest="debug", default=False, - help="Debug mode" ) - self.parserInit = True - - def getCmdlineOptions( self ): - """ Handle commmand line options """ - parser = self._optparser - ( options, args ) = parser.parse_args() - self.cmd_options = options - self.cmd_args = args - - def dump(self): - self.logger.info( _( "Current Settings :" ) ) - settings = str( self.settings ).split( '\n' ) - for s in settings: - if not s.startswith( '[' ): - self.logger.info(" %s" % s ) - - def check_option( self, option ): - """ Check options in settings or command line""" - rc = False - if option == "debug": - if self.settings.debug or self.cmd_options.debug: - rc = True - return rc - def cleanMarkupSting(msg): msg = str(msg) # make sure it is a string msg = gobject.markup_escape_text(msg) diff --git a/spritz/src/spritz.glade b/spritz/src/spritz.glade index 62bd424bf..1809c703b 100644 --- a/spritz/src/spritz.glade +++ b/spritz/src/spritz.glade @@ -3,12 +3,12 @@ - 570 + 420 True Spritz Package Manager GTK_WIN_POS_CENTER 800 - 550 + 450 spritz-icon @@ -1014,7 +1014,7 @@ True - 0.05000000074505806 + 0 0 <span size="large"><b>Action</b></span> @@ -1031,7 +1031,7 @@ True - 0.039999999105930328 + 0 <b>SUBACTION</b> True @@ -1094,7 +1094,7 @@ True - 0.039999999105930328 + 0 Extra @@ -2478,103 +2478,18 @@ 10 3 - + True - 0 - Identifier - - - GTK_FILL - - - - - - True - 0 - Description - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Download mirrors - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - Database URL - - - 3 - 4 - GTK_FILL - - - - - - True - True + bz2 +gz 1 2 - - - - - - True - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - - - 1 - 2 - 3 - 4 - - - - - - True - 0 - Database compression - - 4 5 GTK_FILL - + GTK_FILL @@ -2715,18 +2630,103 @@ - + True - bz2 -gz + 0 + Database compression + + + 4 + 5 + GTK_FILL + + + + + + True + True 1 2 - 4 - 5 + 3 + 4 + + + + + + True + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + + + 1 + 2 + + + + + + True + 0 + Database URL + + + 3 + 4 GTK_FILL - GTK_FILL + + + + + + True + 0 + Download mirrors + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Description + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Identifier + + + GTK_FILL + @@ -3101,199 +3101,49 @@ gz - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Category</b> - True - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Name</b> - True - True - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Available</b> - True - True - - - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Installed</b> - True - True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Version: 123 + True + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Tag: None + True + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Revision: 0 + True + + + 2 + + + 1 + 2 3 4 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Slot</b> - True - True - - - 4 - 5 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Size</b> - True - True - - - 5 - 6 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Path</b> - True - True - - - 6 - 7 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.89999997615814209 - <b>Checksum</b> - True - True - - - 7 - 8 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - <small>media-lxnay</small> - True - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - foo - True - - - 1 - 2 - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 0 - True - - - 1 - 2 - 4 - 5 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - packages/blah/blah/foo.tbz2 - True - - - 1 - 2 - 6 - 7 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 200MB - True - - - 1 - 2 - 5 - 6 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 7fdcb5686a246b73b4c347f45e4d44a1 - True - - - 1 - 2 - 7 - 8 + 2 @@ -3343,51 +3193,201 @@ gz - + 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 - Version: 123 - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Tag: None - True - - - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Revision: 0 - True - - - 2 - - + 0 + 7fdcb5686a246b73b4c347f45e4d44a1 + True 1 2 + 7 + 8 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 200MB + True + + + 1 + 2 + 5 + 6 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + packages/blah/blah/foo.tbz2 + True + + + 1 + 2 + 6 + 7 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 0 + True + + + 1 + 2 + 4 + 5 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + foo + True + + + 1 + 2 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + <small>media-lxnay</small> + True + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Checksum</b> + True + True + + + 7 + 8 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Path</b> + True + True + + + 6 + 7 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Size</b> + True + True + + + 5 + 6 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Slot</b> + True + True + + + 4 + 5 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Installed</b> + True + True + + 3 4 - 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Available</b> + True + True + + + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Name</b> + True + True + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.89999997615814209 + <b>Category</b> + True + True + + 1 diff --git a/spritz/src/spritz.py b/spritz/src/spritz.py index 2f9247eb7..76307e164 100644 --- a/spritz/src/spritz.py +++ b/spritz/src/spritz.py @@ -46,7 +46,7 @@ from etpgui import * import filters from gui import SpritzGUI from dialogs import * -from misc import const, SpritzOptions, fakeoutfile, fakeinfile +from misc import const, fakeoutfile, fakeinfile from i18n import _ import time @@ -415,21 +415,6 @@ class SpritzController(Controller): else: self.pkgView.store.clear() - - def on_Category_changed(self,widget): - ''' Category Type Change Handler''' - ndx = self.ui.cbCategory.get_active() - if ndx == 0: # None - self.categoryOn = False - self.ui.swCategory.hide() - self.addPackages() - else: - self.categoryOn = True - self.ui.swCategory.show() - tub = const.PACKAGE_CATEGORY_DICT[ndx] - (label,fn,attr,sortcat,splitcat) = tub - self.addCategories(fn,attr,sortcat,splitcat) - def on_pkgFilter_toggled(self,rb,action): ''' Package Type Selection Handler''' if rb.get_active(): # Only act on select, not deselect. @@ -749,12 +734,20 @@ class SpritzController(Controller): class SpritzApplication(SpritzController,SpritzGUI): def __init__(self): + + # check if another instance is running + cr = EquoConnection.entropyTools.applicationLockCheck("Spritz Loader", gentle = True) + if cr: + # warn the user + okDialog( None, _("Sorry to tell you\t\t\nAnother instance of Entropy is running. Close it or remove: %s") % (etpConst['pidfile'],) ) + sys.exit() + SpritzController.__init__( self ) - self.spritzOptions = SpritzOptions() - self.spritzOptions.parseCmdOptions() self.Equo = EquoConnection + SpritzGUI.__init__(self, self.Equo, self.etpbase) self.logger = logging.getLogger("yumex.main") + # init flags self.skipMirror = False self.skipMirrorNow = False @@ -762,11 +755,7 @@ class SpritzApplication(SpritzController,SpritzGUI): self.categoryOn = False self.quitNow = False self.isWorking = False - if self.settings.debug: - self.spritzOptions.dump() - print self.spritzOptions.getArgs() self.logger.info(_('Entropy Config Setup')) - self.spritzOptions.parseCmdOptions() self.catsView.etpbase = self.etpbase self.lastPkgPB = "updates" self.etpbase.setFilter(filters.yumexFilter.processFilters) @@ -785,7 +774,7 @@ class SpritzApplication(SpritzController,SpritzGUI): self.setupSpritz() self.console.set_pty(self.pty[0]) - # setup pty + self.resetProgressText() def setupEditor(self): @@ -921,6 +910,10 @@ class SpritzApplication(SpritzController,SpritzGUI): self.setupRepoView() self.endWorking() + def resetProgressText(self): + self.progress.set_mainLabel(_('Nothing to do. I am idle.')) + self.progress.set_subLabel(_('Really, don\'t waste your time here. This is just a placeholder')) + self.progress.set_extraLabel(_('I am still alive and kickin\'')) def setupRepoView(self): self.repoView.populate() @@ -988,7 +981,7 @@ class SpritzApplication(SpritzController,SpritzGUI): self.unsetBusy() # reset labels - self.progress.set_mainLabel('') + self.resetProgressText() def addCategoryPackages(self,cat = None): msg = _('Package View Population')