diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 2bb9678..53e6dcb 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -1,5 +1,12 @@ #!/usr/bin/python2 + +import gc +import gettext +import os +import sys +import traceback + import gi gi.require_version("Gtk", "3.0") gi.require_version('MatePanelApplet', '4.0') @@ -7,17 +14,12 @@ from gi.repository import Gtk, GdkPixbuf, Gdk, GObject from gi.repository import MatePanelApplet from gi.repository import Gio -import sys -import os -import commands -import gettext -import traceback -import time -import gc import xdg.Config + import keybinding import pointerMonitor import setproctitle +from plugins.execute import Execute GObject.threads_init() @@ -37,7 +39,6 @@ if not windowManager: windowManager = "MATE" xdg.Config.setWindowManager( windowManager.upper() ) -from execute import * class MainWindow( object ): """This is the main class for the application""" @@ -92,9 +93,10 @@ class MainWindow( object ): else: self.tooltipsEnable( False ) - self.PopulatePlugins(); - self.firstTime = True; + self.PopulatePlugins() + self.firstTime = True + @staticmethod def on_window1_destroy (self, widget, data=None): Gtk.main_quit() sys.exit(0) @@ -116,18 +118,18 @@ class MainWindow( object ): else: self.tooltipsEnable( False ) - def toggleStartWithFavorites( self, settings, key, args = None ): + def toggleStartWithFavorites( self, settings, key ): self.startWithFavorites = settings.get_boolean(key) - def toggleUseCustomColor( self, settings, key, args = None ): + def toggleUseCustomColor( self, settings, key ): self.usecustomcolor = settings.get_boolean(key) self.loadTheme() - def toggleCustomBackgroundColor( self, settings, key, args = None): + def toggleCustomBackgroundColor( self, settings, key ): self.customcolor = settings.get_string(key) self.SetPaneColors( self.panesToColor ) - def toggleCustomHeadingColor( self, settings, key, args = None ): + def toggleCustomHeadingColor( self, settings, key ): self.customheadingcolor = settings.get_string(key) self.SetHeadingStyle( self.headingsToColor ) @@ -147,7 +149,6 @@ class MainWindow( object ): def PopulatePlugins( self ): self.panesToColor = [ ] self.headingsToColor = [ ] - start = time.time() PluginPane = Gtk.EventBox() PluginPane.show() PaneLadder = Gtk.Box( orientation=Gtk.Orientation.VERTICAL ) @@ -186,7 +187,7 @@ class MainWindow( object ): # Image1.show() #print u"Loading plugin '" + plugin + "' : sucessful" - except Exception, e: + except Exception: MyPlugin = Gtk.EventBox() #Fake class for MyPlugin MyPlugin.heading = _("Couldn't load plugin:") + " " + plugin MyPlugin.content_holder = Gtk.EventBox() @@ -265,8 +266,8 @@ class MainWindow( object ): error = _("Couldn't initialize plugin") + " " + plugin + " : " + "\n".join(traceback.format_exception( info[0], info[1], info[2] )).replace("\\n", "\n") msgDlg = Gtk.MessageDialog( None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, error ) - msgDlg.run(); - msgDlg.destroy(); + msgDlg.run() + msgDlg.destroy() self.plugins[plugin] = MyPlugin @@ -540,14 +541,14 @@ class MenuWin( object ): self.button_icon = Gtk.Image() self.do_image(self.buttonIcon, False) self.systemlabel = Gtk.Label(label= "%s " % self.buttonText ) - if os.path.exists("/etc/linuxmint/info"): - import commands - tooltip = commands.getoutput("cat /etc/linuxmint/info | grep DESCRIPTION") - tooltip = tooltip.replace("DESCRIPTION", "") - tooltip = tooltip.replace("=", "") - tooltip = tooltip.replace("\"", "") - self.systemlabel.set_tooltip_text(tooltip) - self.button_icon.set_tooltip_text(tooltip) + if os.path.isfile("/etc/linuxmint/info"): + info = open("/etc/linuxmint/info").readlines() #TODO py3 encoding="utf-8" + for line in info: + if line.startswith("DESCRIPTION="): + tooltip = line.split("=",1)[1].replace('"','') + self.systemlabel.set_tooltip_text(tooltip) + self.button_icon.set_tooltip_text(tooltip) + break if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN: self.button_box = Gtk.Box( orientation=Gtk.Orientation.HORIZONTAL ) self.button_box.pack_start( self.button_icon, False, False, 0 ) @@ -605,7 +606,6 @@ class MenuWin( object ): style_settings.set_property("gtk-theme-name", desktop_theme) def changeOrientation( self, *args, **kargs ): - if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN: tmpbox = Gtk.Box( orientation=Gtk.Orientation.HORIZONTAL ) self.systemlabel.set_angle( 0 ) @@ -644,7 +644,7 @@ class MenuWin( object ): self.do_image(self.buttonIcon, False) self.sizeButton() - def hotkeyChanged (self, schema, key): + def hotkeyChanged (self, schema, key ): self.hotkeyText = self.settings.get_string( "hot-key" ) self.keybinder.rebind(self.hotkeyText) @@ -705,7 +705,7 @@ class MenuWin( object ): # Execute( "mateconf-editor /apps/mintMenu" ) Execute( os.path.join( PATH, "mintMenuConfig.py" ) ) - def showMenuEditor( self, action, userdata = None ): + def showMenuEditor( self, action, userdata = None): Execute( "mozo" ) def showMenu( self, widget=None, event=None ): @@ -781,7 +781,7 @@ class MenuWin( object ): if newX < monitorGeometry.x: newX = monitorGeometry.x if applet_orient == MatePanelApplet.AppletOrient.RIGHT: - newX -= entryWidth; + newX -= entryWidth # Bind to the bottom if newY + ourHeight > (monitorGeometry.y + monitorGeometry.height): diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 9508af5..f59d0ff 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -1,28 +1,26 @@ #!/usr/bin/python2 +import commands +import filecmp +import gettext +import os +import pipes +import string +import subprocess +import threading +import time +from user import home + import gi gi.require_version("Gtk", "3.0") - from gi.repository import Gtk, Pango, Gdk, Gio, GLib -import os -import time -import string -import gettext -import threading -import commands -import subprocess -import filecmp -from easybuttons import * -from execute import Execute -from easygsettings import EasyGSettings -from easyfiles import * -import recentHelper as RecentHelper -import pipes - import matemenu - -from user import home +import plugins.recentHelper as RecentHelper +from plugins.easybuttons import (CategoryButton, FavApplicationLauncher, + MenuApplicationLauncher) +from plugins.easygsettings import EasyGSettings +from plugins.execute import Execute # i18n gettext.install("mintmenu", "/usr/share/linuxmint/locale") @@ -281,7 +279,7 @@ class pluginclass( object ): self.builder.get_object("searchButton").connect( "button-press-event", self.searchPopup ) - self.icon_theme = Gtk.IconTheme.get_default(); + self.icon_theme = Gtk.IconTheme.get_default() self.icon_theme.connect("changed", self.on_icon_theme_changed) def refresh_apt_cache(self): @@ -437,6 +435,8 @@ class pluginclass( object ): self.Todos() self.buildFavorites() + # TODO all this runs whether the plugin is enabled or not + print "applications.RegenPlugin calling buildRecentApps" RecentHelper.buildRecentApps() self.RebuildPlugin() @@ -688,7 +688,7 @@ class pluginclass( object ): name = pkg.name for word in keywords: if word != "": - name = name.replace(word, "%s" % word); + name = name.replace(word, "%s" % word) suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") suggestionButton.connect("clicked", self.apturl_install, pkg.name) suggestionButton.set_text(_("Install package '%s'") % name) @@ -741,7 +741,7 @@ class pluginclass( object ): name = pkg.name for word in keywords: if word != "": - name = name.replace(word, "%s" % word); + name = name.replace(word, "%s" % word) suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") suggestionButton.connect("clicked", self.apturl_install, pkg.name) suggestionButton.set_text(_("Install package '%s'") % name) @@ -816,7 +816,7 @@ class pluginclass( object ): i.released() i.set_relief( Gtk.ReliefStyle.NONE ) - allButton = self.categoriesBox.get_children()[0]; + allButton = self.categoriesBox.get_children()[0] allButton.set_relief( Gtk.ReliefStyle.HALF ) self.activeFilter = (0, text, widget) else: @@ -1082,11 +1082,12 @@ class pluginclass( object ): self.focusSearchEntry(clear = False) return True - def pos_func(self, menu=None): - rect = self.searchButton.get_allocation() - x = rect.x + rect.width - y = rect.y + rect.height - return (x, y, False) + # TODO: Is this in use? + # def pos_func(self, menu=None): + # rect = self.searchButton.get_allocation() + # x = rect.x + rect.width + # y = rect.y + rect.height + # return (x, y, False) def search_ddg(self, widget): text = self.searchEntry.get_text() @@ -1261,7 +1262,6 @@ class pluginclass( object ): self.favoritesAdd( self.favoritesBuildLauncher( uri ) ) def Search( self, widget ): - text = self.searchEntry.get_text().strip() if text != "": for app_button in self.applicationsBox.get_children(): @@ -1280,7 +1280,9 @@ class pluginclass( object ): def do_plugin( self ): self.Todos() self.buildFavorites() - RecentHelper.buildRecentApps() + # TODO all this runs whether the plugin is enabled or not + # print "applications.do_plugin calling buildRecentApps" + # RecentHelper.buildRecentApps() # Scroll button into view def scrollItemIntoView( self, widget, event = None ): @@ -1408,7 +1410,7 @@ class pluginclass( object ): self.favoritesSave() except Exception, e: - print e + print e def favoritesPositionOnGrid( self, favorite ): row = 0 @@ -1502,8 +1504,8 @@ class pluginclass( object ): appListFile.close( ) except Exception, e: msgDlg = Gtk.MessageDialog( None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, _("Couldn't save favorites. Check if you have write access to ~/.linuxmint/mintMenu")+"\n(" + e.__str__() + ")" ) - msgDlg.run(); - msgDlg.destroy(); + msgDlg.run() + msgDlg.destroy() def isLocationInFavorites( self, location ): for fav in self.favorites: @@ -1533,6 +1535,7 @@ class pluginclass( object ): self.menuChangedTimer = GLib.timeout_add( 1000, self.updateBoxes, True ) + @print_timing def updateBoxes( self, menu_has_changed ): print ("updateBoxes") # FIXME: This is really bad! diff --git a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py index a998c17..c8b2945 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py +++ b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py @@ -1,18 +1,22 @@ #!/usr/bin/python2 +import os.path +import re +import shutil + +import xdg.DesktopEntry +import xdg.Menu + import gi gi.require_version('MateDesktop', '2.0') from gi.repository import Gtk, Gdk, GLib from gi.repository import Pango from gi.repository import GObject from gi.repository import MateDesktop -import os.path -import shutil -import re -from execute import * -import xdg.DesktopEntry -import xdg.Menu -from filemonitor import monitor as filemonitor + +from plugins.execute import Execute +from plugins.filemonitor import monitor as filemonitor + class IconManager(GObject.GObject): @@ -240,12 +244,13 @@ class ApplicationLauncher( easyButton ): if isinstance( desktopFile, xdg.Menu.MenuEntry ): desktopItem = desktopFile.DesktopEntry desktopFile = desktopItem.filename - self.appDirs = desktop.desktopFile.AppDirs + self.appDirs = desktopFile.AppDirs elif isinstance( desktopFile, xdg.Menu.DesktopEntry ): desktopItem = desktopFile desktopFile = desktopItem.filename self.appDirs = [ os.path.dirname( desktopItem.filename ) ] else: + # XXX: All menu entries on LM19.1 end here desktopItem = xdg.DesktopEntry.DesktopEntry( desktopFile ) self.appDirs = [ os.path.dirname( desktopFile ) ] @@ -278,8 +283,6 @@ class ApplicationLauncher( easyButton ): self.connectSelf( "focus-out-event", self.onFocusOut ) self.connectSelf( "clicked", self.execute ) - - def loadDesktopEntry( self, desktopItem ): try: self.appName = self.strip_accents(desktopItem.getName()) @@ -317,7 +320,6 @@ class ApplicationLauncher( easyButton ): self.appDocPath = "" self.startupMonitorId = 0 - def onFocusIn( self, widget, event ): self.set_relief( Gtk.ReliefStyle.HALF ) @@ -358,8 +360,6 @@ class ApplicationLauncher( easyButton ): return tooltip - - def dragDataGet( self, widget, context, selection, targetType, eventTime ): if targetType == 100: # text/plain selection.set_text( "'" + self.desktopFile + "'", -1 ) @@ -394,39 +394,39 @@ class ApplicationLauncher( easyButton ): def startupFileChanged( self, *args ): self.inStartup = os.path.exists( self.startupFilePath ) - def addToStartup( self ): - startupDir = os.path.join( os.path.expanduser("~"), ".config", "autostart" ); - if not os.path.exists( startupDir ): - os.makedirs( startupDir ) + # def addToStartup( self ): + # startupDir = os.path.join( os.path.expanduser("~"), ".config", "autostart" ) + # if not os.path.exists( startupDir ): + # os.makedirs( startupDir ) - shutil.copyfile( self.desktopFile, self.startupFilePath ) + # shutil.copyfile( self.desktopFile, self.startupFilePath ) - # Remove %u, etc. from Exec entry, because MATE will not replace them when it starts the app - item = MateDesktop.DesktopItem.new_from_uri(self.startupFilePath, MateDesktop.DesktopItemLoadFlags.ONLY_IF_EXISTS) - if item: - r = re.compile("%[A-Za-z]"); - tmp = r.sub("", item.get_string( MateDesktop.DESKTOP_ITEM_EXEC ) ).strip() - item.set_string( MateDesktop.DESKTOP_ITEM_EXEC, tmp ) - item.save( self.startupFilePath, 0 ) + # # Remove %u, etc. from Exec entry, because MATE will not replace them when it starts the app + # item = MateDesktop.DesktopItem.new_from_uri(self.startupFilePath, MateDesktop.DesktopItemLoadFlags.ONLY_IF_EXISTS) + # if item: + # r = re.compile("%[A-Za-z]"); + # tmp = r.sub("", item.get_string( MateDesktop.DESKTOP_ITEM_EXEC ) ).strip() + # item.set_string( MateDesktop.DESKTOP_ITEM_EXEC, tmp ) + # item.save( self.startupFilePath, 0 ) - def removeFromStartup( self ): - if os.path.exists( self.startupFilePath ): - os.remove( self.startupFilePath ) + # def removeFromStartup( self ): + # if os.path.exists( self.startupFilePath ): + # os.remove( self.startupFilePath ) - def addToFavourites( self ): - favouritesDir = os.path.join( os.path.expanduser("~"), ".linuxmint", "mintMenu", "applications" ); - if not os.path.exists( favouritesDir ): - os.makedirs( favouritesDir ) + # def addToFavourites( self ): + # favouritesDir = os.path.join( os.path.expanduser("~"), ".linuxmint", "mintMenu", "applications" ) + # if not os.path.exists( favouritesDir ): + # os.makedirs( favouritesDir ) - shutil.copyfile( self.desktopFile, self.favouritesFilePath ) + # shutil.copyfile( self.desktopFile, self.favouritesFilePath ) - def removeFromFavourites( self ): - if os.path.exists( self.favouritesFilePath ): - os.remove( self.favouritesFilePath ) + # def removeFromFavourites( self ): + # if os.path.exists( self.favouritesFilePath ): + # os.remove( self.favouritesFilePath ) - def isInStartup( self ): - #return self.inStartup - return os.path.exists( self.startupFilePath ) + # def isInStartup( self ): + # #return self.inStartup + # return os.path.exists( self.startupFilePath ) def onDestroy( self, widget ): easyButton.onDestroy( self, widget ) diff --git a/usr/lib/linuxmint/mintMenu/plugins/easyfiles.py b/usr/lib/linuxmint/mintMenu/plugins/easyfiles.py index 016e2a5..f266738 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/easyfiles.py +++ b/usr/lib/linuxmint/mintMenu/plugins/easyfiles.py @@ -1,7 +1,5 @@ #!/usr/bin/python2 -import os -import os.path import urllib def GetFilePath(uri): diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index 344de1f..1b27367 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -1,17 +1,19 @@ #!/usr/bin/python2 -from gi.repository import Gtk, Gio, GLib +from glob import glob +import gettext import os import string -import gettext -import commands -import time - -from easybuttons import * -from easygsettings import EasyGSettings -from execute import Execute -from user import home from urllib import unquote +from user import home + +import gi +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gio, GLib + +from plugins.easybuttons import easyButton +from plugins.easygsettings import EasyGSettings +from plugins.execute import Execute # i18n gettext.install("mintmenu", "/usr/share/linuxmint/locale") @@ -183,6 +185,7 @@ class pluginclass( object ): self.trashButton.connect( "clicked", self.ButtonClicked, "xdg-open trash:" ) self.trashButton.show() self.trashButton.connect( "button-release-event", self.trashPopup ) + self.trash_path = os.path.join(home, "/.local/share/Trash/info") self.refreshTrash() self.placesBtnHolder.pack_start( self.trashButton, False, False, 0) self.mintMenuWin.setTooltip( self.trashButton, _("Browse deleted files") ) @@ -258,9 +261,8 @@ class pluginclass( object ): self.do_gtk_bookmarks() def refreshTrash (self): - iconName = "user-trash" - if (os.path.exists(home + "/.local/share/Trash/info")): - infoFiles = commands.getoutput("ls " + home + "/.local/share/Trash/info/ | wc -l") - if (int(infoFiles) > 0): - iconName = "user-trash-full" + if os.path.exists(self.trash_path) and glob(os.path.join(self.trash_path, "*")): + iconName = "user-trash-full" + else: + iconName = "user-trash" self.trashButton.setIcon(iconName) diff --git a/usr/lib/linuxmint/mintMenu/plugins/recent.py b/usr/lib/linuxmint/mintMenu/plugins/recent.py index 38c1130..12d2d27 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/recent.py +++ b/usr/lib/linuxmint/mintMenu/plugins/recent.py @@ -1,19 +1,20 @@ #!/usr/bin/python2 +import os + import gi gi.require_version("Gtk", "3.0") - from gi.repository import Gtk, Pango -import os -from easygsettings import EasyGSettings -from execute import Execute -from easyfiles import * -from easybuttons import * -import recentHelper as RecentHelper + +from plugins.execute import Execute +import plugins.recentHelper as RecentHelper +from plugins.easygsettings import EasyGSettings + class pluginclass: - """This is the main class for the plugin""" - """It MUST be named pluginclass""" + """ This is the main class for the plugin. + It MUST be named pluginclass + """ def __init__( self, mintMenuWin, toggleButton, de ): @@ -37,9 +38,9 @@ class pluginclass: self.recentBox = self.builder.get_object("RecentBox") self.recentAppBox = self.builder.get_object("RecentApps") RecentHelper.recentAppBox = self.recentAppBox - + #self.recentApps = [] - + self.recentVBox = self.builder.get_object( "vbox1" ) #Specify plugin width @@ -57,7 +58,7 @@ class pluginclass: self.appSettings = EasyGSettings( "com.linuxmint.mintmenu.plugins.applications" ) self.appSettings.notifyAdd( "icon-size", self.RegenPlugin ) - + self.FileList=[] self.RecManagerInstance = Gtk.RecentManager.get_default() self.recentManagerId = self.RecManagerInstance.connect("changed", self.DoRecent) @@ -89,7 +90,7 @@ class pluginclass: self.recentw = self.settings.get( 'int', 'width' ) self.numentries = self.settings.get( 'int', 'num-recent-docs' ) RecentHelper.numentries = self.numentries - + self.recentfontsize = self.settings.get( 'int', 'recent-font-size' ) # Hide vertical dotted separator @@ -108,16 +109,16 @@ class pluginclass: else: self.settings.set( "bool", "minimized", False ) - def RebuildPlugin(self): self.content_holder.set_size_request(self.recentw, self.recenth ) + # TODO + print "recent.RebuildPlugin calling recent.DoRecent" self.DoRecent() - def DoRecent( self, *args, **kargs ): for i in self.recentBox.get_children(): i.destroy() - + self.recentVBox.set_size_request( self.recentw, self.recenth ) if len( self.recentBox.get_children() ) < self.numentries: n=len( self.recentBox.get_children() )-1 @@ -133,13 +134,17 @@ class pluginclass: if Name != None: self.AddRecentBtn( Name, self.IconList[loc] ) loc = loc + 1 - + + # TODO + print "recent.DoRecent calling RecentHelper.doRecentApps" RecentHelper.doRecentApps() - + return True def clrmenu(self, *args, **kargs): self.RecManagerInstance.purge_items() + # TODO + print "recent.clrmenu calling recent.DoRecent" self.DoRecent() return @@ -185,8 +190,6 @@ class pluginclass: if result == 77: dia.destroy() - - def GetRecent(self, *args, **kargs): FileString=[] IconString=[] @@ -204,7 +207,6 @@ class pluginclass: break return FileString, IconString - def ButtonClicked( self, widget, event, Exec ): self.press_x = event.x self.press_y = event.y @@ -223,6 +225,7 @@ class pluginclass: self.Win.plugins["applications"].wTree.get_widget( "entry1" ).grab_focus() Execute( w, self.Exec ) - def do_plugin(self): - self.DoRecent() - \ No newline at end of file + # TODO - skipping this because we're already doing this on __init__ + # def do_plugin(self): + # print "recent.do_plugin calling recent.DoRecent" + # self.DoRecent() diff --git a/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py b/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py index 64cbc15..377bcfc 100644 --- a/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py +++ b/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py @@ -1,13 +1,13 @@ #!/usr/bin/python2 +import os +from user import home + import gi gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -import os -import string -from user import home -from easyfiles import * -from easybuttons import * +from plugins.easybuttons import ApplicationLauncher recentApps = [] mintMenuWin = None @@ -41,21 +41,22 @@ def recentAppsSave(): recentAppListFile.close( ) except Exception, e: print e - msgDlg = Gtk.MessageDialog( None, gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, _("Couldn't save recent apps. Check if you have write access to ~/.linuxmint/mintMenu")+"\n(" + e.__str__() + ")" ) - msgDlg.run(); - msgDlg.destroy(); + msgDlg = Gtk.MessageDialog( None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, _("Couldn't save recent apps. Check if you have write access to ~/.linuxmint/mintMenu")+"\n(" + e.__str__() + ")" ) + msgDlg.run() + msgDlg.destroy() def recentAppBuildLauncher( location ): try: - ButtonIcon = None # For Folders and Network Shares - location = string.join( location.split( "%20" ) ) + location = "".join( location.split( "%20" ) ) - if location.startswith( "file" ): - ButtonIcon = "mate-fs-directory" + # ButtonIcon = None - if location.startswith( "smb" ) or location.startswith( "ssh" ) or location.startswith( "network" ): - ButtonIcon = "mate-fs-network" + # if location.startswith( "file" ): + # ButtonIcon = "mate-fs-directory" + + # if location.startswith( "smb" ) or location.startswith( "ssh" ) or location.startswith( "network" ): + # ButtonIcon = "mate-fs-network" #For Special locations if location == "x-nautilus-desktop:///computer": @@ -83,13 +84,16 @@ def recentAppBuildLauncher( location ): def buildRecentApps(): + print "-- recentHelper.buildRecentApps" del recentApps[:] try: - if (not os.path.exists(home + "/.linuxmint/mintMenu/recentApplications.list")): - os.system("touch " + home + "/.linuxmint/mintMenu/recentApplications.list") - recentAppListFile = open( os.path.join( os.path.expanduser( "~"), ".linuxmint", "mintMenu", "recentApplications.list" ) , "r" ) - - recentApplicationsList = recentAppListFile.readlines() + path = os.path.join(home, ".linuxmint/mintMenu/recentApplications.list") + if not os.path.exists(path): + print "does not exist" + #os.system("touch " + path) + recentApplicationsList = [] + else: + recentApplicationsList = open(path).readlines() for app in recentApplicationsList : app = app.strip() @@ -109,6 +113,7 @@ def buildRecentApps(): return recentApps def doRecentApps(): + print "-- recentHelper.doRecentApps" if recentAppBox is not None: # recentAppBox is initiated by the recent plugin # only build UI widgets if it's enabled @@ -128,6 +133,7 @@ def doRecentApps(): return True def applicationButtonClicked( widget ): + # TODO all this runs whether the plugin is enabled or not mintMenuWin.hide() recentAppsAdd(widget) recentAppsSave() diff --git a/usr/lib/linuxmint/mintMenu/plugins/system_management.py b/usr/lib/linuxmint/mintMenu/plugins/system_management.py index 2d5e1c1..78f432c 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/system_management.py +++ b/usr/lib/linuxmint/mintMenu/plugins/system_management.py @@ -1,16 +1,15 @@ #!/usr/bin/python2 +import gettext +import os + import gi gi.require_version("Gtk", "3.0") - from gi.repository import Gtk -import os -import string -import gettext -from easybuttons import * -from execute import Execute -from easygsettings import EasyGSettings +from plugins.easybuttons import easyButton +from plugins.easygsettings import EasyGSettings +from plugins.execute import Execute # i18n gettext.install("mintmenu", "/usr/share/linuxmint/locale") diff --git a/usr/lib/linuxmint/mintMenu/pointerMonitor.py b/usr/lib/linuxmint/mintMenu/pointerMonitor.py index 8b31db2..2ee8ce0 100644 --- a/usr/lib/linuxmint/mintMenu/pointerMonitor.py +++ b/usr/lib/linuxmint/mintMenu/pointerMonitor.py @@ -1,12 +1,14 @@ #!/usr/bin/python2 +import threading + import gi gi.require_version("Gtk", "3.0") - -from Xlib.display import Display -from Xlib import X, error from gi.repository import Gtk, Gdk, GObject, GLib -import threading + +from Xlib import X +from Xlib.display import Display + class PointerMonitor(GObject.GObject, threading.Thread): __gsignals__ = {