- more cleanup, and speed-up

- more fixes, including many icon and encoding related issues
- replace some icons and remove compile.py
- prepare for python3 port as much as possible
This commit is contained in:
gm10 2019-01-22 21:54:39 +01:00
parent 8b42c0f32f
commit 67eee16da8
No known key found for this signature in database
GPG Key ID: A981D4EA8CF993A9
21 changed files with 732 additions and 852 deletions

13
debian/control vendored
View File

@ -11,15 +11,18 @@ Depends:
${python:Depends}, ${python:Depends},
${misc:Depends}, ${misc:Depends},
python (>= 2.4), python (<< 3), python (>= 2.4), python (<< 3),
mint-common,
python-mate-menu, python-xdg, xdg-utils,
python-apt, python-apt,
python-configobj, python-configobj,
python-setproctitle, python-setproctitle,
mate-menus,
gvfs-bin,
python-xlib, python-xlib,
gir1.2-mate-panel, gir1.2-gtk-3.0, gir1.2-mate-desktop, python-xdg,
xdg-utils,
libglib2.0-bin,
mate-menus,
python-mate-menu,
gir1.2-matepanelapplet-4.0,
gir1.2-gtk-3.0,
gir1.2-mate-desktop,
mozo mozo
Description: Advanced MATE menu Description: Advanced MATE menu
One of the most advanced menus under Linux. MintMenu supports filtering, One of the most advanced menus under Linux. MintMenu supports filtering,

1
debian/postinst vendored
View File

@ -19,6 +19,7 @@ set -e
case "$1" in case "$1" in
configure) configure)
glib-compile-schemas /usr/share/glib-2.0/schemas glib-compile-schemas /usr/share/glib-2.0/schemas
python -m compileall -qf /usr/lib/linuxmint/mintMenu/
;; ;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)

View File

@ -1,5 +0,0 @@
#!/usr/bin/python2
import compileall
compileall.compile_dir(".", force=1)

View File

@ -29,7 +29,7 @@ gi.require_version("Gtk", "3.0")
from Xlib.display import Display from Xlib.display import Display
from Xlib import X, error from Xlib import X, error
from gi.repository import Gtk, Gdk, GdkX11, GObject, GLib from gi.repository import Gtk, Gdk, GObject, GLib
import threading import threading
SPECIAL_MODS = (["Super_L", "<Super>"], SPECIAL_MODS = (["Super_L", "<Super>"],

View File

@ -20,7 +20,6 @@ import pointerMonitor
import setproctitle import setproctitle
from plugins.execute import Execute from plugins.execute import Execute
GObject.threads_init() GObject.threads_init()
# Rename the process # Rename the process
@ -71,7 +70,7 @@ class MainWindow(object):
self.window.stick() self.window.stick()
plugindir = os.path.join(os.path.expanduser("~"), ".linuxmint/mintMenu/plugins") plugindir = os.path.join(os.environ["HOME"], ".linuxmint/mintMenu/plugins")
sys.path.append(plugindir) sys.path.append(plugindir)
self.panelSettings = Gio.Settings.new("org.mate.panel") self.panelSettings = Gio.Settings.new("org.mate.panel")
@ -162,7 +161,7 @@ class MainWindow(object):
for plugin in self.pluginlist: for plugin in self.pluginlist:
if plugin in self.plugins: if plugin in self.plugins:
print u"Duplicate plugin in list: ", plugin print("Duplicate plugin in list: %s" % plugin)
continue continue
if plugin != "newpane": if plugin != "newpane":
@ -205,8 +204,7 @@ class MainWindow(object):
MyPlugin.add(MyPlugin.content_holder) MyPlugin.add(MyPlugin.content_holder)
MyPlugin.width = 270 MyPlugin.width = 270
MyPlugin.icon = 'mate-logo-icon.png' MyPlugin.icon = 'mate-logo-icon.png'
print u"Unable to load " + plugin + " plugin :-(" print("Unable to load %s plugin" % plugin)
self.panesToColor.append(MyPlugin.content_holder) self.panesToColor.append(MyPlugin.content_holder)
MyPlugin.content_holder.show() MyPlugin.content_holder.show()
@ -352,7 +350,6 @@ class MainWindow(object):
widget.set_tooltip_text(tip) widget.set_tooltip_text(tip)
def RegenPlugins(self, *args, **kargs): def RegenPlugins(self, *args, **kargs):
#print
#print u"Reloading Plugins..." #print u"Reloading Plugins..."
for item in self.paneholder: for item in self.paneholder:
item.destroy() item.destroy()
@ -473,11 +470,11 @@ class MenuWin(object):
self.keybinder.connect("activate", self.onBindingPress) self.keybinder.connect("activate", self.onBindingPress)
self.keybinder.start() self.keybinder.start()
self.settings.connect("changed::hot-key", self.hotkeyChanged) self.settings.connect("changed::hot-key", self.hotkeyChanged)
print "Binding to Hot Key: " + self.hotkeyText print("Binding to Hot Key: %s" % self.hotkeyText)
except Exception, cause: except Exception as e:
self.keybinder = None self.keybinder = None
print "** WARNING ** - Keybinder Error" print("** WARNING ** - Keybinder Error")
print "Error Report :\n", str(cause) print("Error Report :\n", e)
self.applet.set_can_focus(False) self.applet.set_can_focus(False)
@ -485,9 +482,9 @@ class MenuWin(object):
self.pointerMonitor = pointerMonitor.PointerMonitor() self.pointerMonitor = pointerMonitor.PointerMonitor()
self.pointerMonitor.connect("activate", self.onPointerOutside) self.pointerMonitor.connect("activate", self.onPointerOutside)
self.mainwin.window.connect("realize", self.onRealize) self.mainwin.window.connect("realize", self.onRealize)
except Exception, cause: except Exception as e:
print "** WARNING ** - Pointer Monitor Error" print("** WARNING ** - Pointer Monitor Error")
print "Error Report :\n", str(cause) print("Error Report :\n", e)
def onWindowMap(self, *args): def onWindowMap(self, *args):
self.applet.get_style_context().set_state(Gtk.StateFlags.SELECTED) self.applet.get_style_context().set_state(Gtk.StateFlags.SELECTED)
@ -522,9 +519,9 @@ class MenuWin(object):
def leave_notify(self, applet, event): def leave_notify(self, applet, event):
# Hack for mate-panel-test-applets focus issue (this can be commented) # Hack for mate-panel-test-applets focus issue (this can be commented)
if event.state & Gdk.ModifierType.BUTTON1_MASK and applet.get_style_context().get_state() & Gtk.StateFlags.SELECTED: # if event.state & Gdk.ModifierType.BUTTON1_MASK and applet.get_style_context().get_state() & Gtk.StateFlags.SELECTED:
if event.x >= 0 and event.y >= 0 and event.x < applet.get_window().get_width() and event.y < applet.get_window().get_height(): # if event.x >= 0 and event.y >= 0 and event.x < applet.get_window().get_width() and event.y < applet.get_window().get_height():
self.mainwin.stopHiding() # self.mainwin.stopHiding()
self.do_image(self.buttonIcon, False) self.do_image(self.buttonIcon, False)
@ -542,10 +539,11 @@ class MenuWin(object):
self.do_image(self.buttonIcon, False) self.do_image(self.buttonIcon, False)
self.systemlabel = Gtk.Label(label= "%s " % self.buttonText) self.systemlabel = Gtk.Label(label= "%s " % self.buttonText)
if os.path.isfile("/etc/linuxmint/info"): if os.path.isfile("/etc/linuxmint/info"):
info = open("/etc/linuxmint/info").readlines() #TODO py3 encoding="utf-8" with open("/etc/linuxmint/info") as info:
for line in info: for line in info:
line = line.decode("utf-8")
if line.startswith("DESCRIPTION="): if line.startswith("DESCRIPTION="):
tooltip = line.split("=",1)[1].replace('"','') tooltip = line.split("=",1)[1].strip('"\n')
self.systemlabel.set_tooltip_text(tooltip) self.systemlabel.set_tooltip_text(tooltip)
self.button_icon.set_tooltip_text(tooltip) self.button_icon.set_tooltip_text(tooltip)
break break
@ -568,17 +566,13 @@ class MenuWin(object):
self.button_box.pack_start(self.button_icon , False, False, 0) self.button_box.pack_start(self.button_icon , False, False, 0)
self.button_icon.set_padding(0, 5) self.button_icon.set_padding(0, 5)
self.button_box.set_homogeneous(False) self.button_box.set_homogeneous(False)
self.button_box.show_all() self.button_box.show_all()
self.sizeButton() self.sizeButton()
self.button_box.get_style_context().add_class('mintmenu') self.button_box.get_style_context().add_class('mintmenu')
self.applet.add(self.button_box) self.applet.add(self.button_box)
self.applet.set_background_widget(self.applet) self.applet.set_background_widget(self.applet)
def loadSettings(self, *args, **kargs): def loadSettings(self, *args, **kargs):
self.hideIcon = self.settings.get_boolean("hide-applet-icon") self.hideIcon = self.settings.get_boolean("hide-applet-icon")
self.buttonText = self.settings.get_string("applet-text") self.buttonText = self.settings.get_string("applet-text")
@ -637,7 +631,6 @@ class MenuWin(object):
self.updateButton() self.updateButton()
self.applet.add(self.button_box) self.applet.add(self.button_box)
def updateButton(self): def updateButton(self):
self.systemlabel.set_text(self.buttonText) self.systemlabel.set_text(self.buttonText)
self.button_icon.clear() self.button_icon.clear()
@ -676,22 +669,17 @@ class MenuWin(object):
self.updateButton() self.updateButton()
def showAboutDialog(self, action, userdata = None): def showAboutDialog(self, action, userdata = None):
about = Gtk.AboutDialog() about = Gtk.AboutDialog()
about.set_name("mintMenu") about.set_name("mintMenu")
import commands import subprocess
version = commands.getoutput("/usr/lib/linuxmint/common/version.py mintmenu") (stdout, stderr) = subprocess.Popen(["/usr/lib/linuxmint/common/version.py", "mintmenu"],
about.set_version(version) stdout=subprocess.PIPE).communicate()
about.set_version(stdout.strip())
try: try:
h = open('/usr/share/common-licenses/GPL','r') gpl = open('/usr/share/common-licenses/GPL','r').read()
s = h.readlines()
gpl = ""
for line in s:
gpl += line
h.close()
about.set_license(gpl) about.set_license(gpl)
except Exception, detail: except Exception as e:
print detail print(e)
about.set_comments(_("Advanced MATE Menu")) about.set_comments(_("Advanced MATE Menu"))
# about.set_authors(["Clement Lefebvre <clem@linuxmint.com>", "Lars-Peter Clausen <lars@laprican.de>"]) # about.set_authors(["Clement Lefebvre <clem@linuxmint.com>", "Lars-Peter Clausen <lars@laprican.de>"])
about.set_translator_credits(("translator-credits")) about.set_translator_credits(("translator-credits"))
@ -700,7 +688,6 @@ class MenuWin(object):
about.connect("response", lambda dialog, r: dialog.destroy()) about.connect("response", lambda dialog, r: dialog.destroy())
about.show() about.show()
def showPreferences(self, action, userdata = None): def showPreferences(self, action, userdata = None):
# Execute("mateconf-editor /apps/mintMenu") # Execute("mateconf-editor /apps/mintMenu")
Execute(os.path.join(PATH, "mintMenuConfig.py")) Execute(os.path.join(PATH, "mintMenuConfig.py"))
@ -831,8 +818,8 @@ class MenuWin(object):
self.de = "mate" self.de = "mate"
elif os.path.exists("/usr/bin/thunar"): elif os.path.exists("/usr/bin/thunar"):
self.de = "xfce" self.de = "xfce"
except Exception, detail: except Exception as e:
print detail print(e)
def applet_factory(applet, iid, data): def applet_factory(applet, iid, data):
MenuWin(applet, iid) MenuWin(applet, iid)

View File

@ -1,41 +1,34 @@
#!/usr/bin/python2 #!/usr/bin/python2
import gettext
import os
import sys import sys
from glob import glob
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GdkPixbuf from gi.repository import Gtk, Gdk, GdkPixbuf
import keybinding import keybinding
from plugins.easygsettings import EasyGSettings
PATH = os.path.abspath(os.path.dirname(sys.argv[0]))
try: sys.path.append(os.path.join(PATH , "plugins"))
import gettext
import os
import commands
except Exception, e:
print e
sys.exit( 1 )
PATH = os.path.abspath( os.path.dirname( sys.argv[0] ) )
sys.path.append( os.path.join( PATH , "plugins") )
# i18n # i18n
gettext.install("mintmenu", "/usr/share/linuxmint/locale") gettext.install("mintmenu", "/usr/share/linuxmint/locale")
from easygsettings import EasyGSettings class mintMenuConfig(object):
class mintMenuConfig( object ): def __init__(self):
def __init__( self ): self.path = os.path.abspath(os.path.dirname(sys.argv[0]))
self.path = os.path.abspath( os.path.dirname( sys.argv[0] ) )
# Load glade file and extract widgets # Load glade file and extract widgets
self.builder = Gtk.Builder() self.builder = Gtk.Builder()
self.builder.add_from_file (os.path.join(self.path, "mintMenuConfig.glade" )) self.builder.add_from_file(os.path.join(self.path, "mintMenuConfig.glade"))
self.mainWindow=self.builder.get_object("mainWindow") self.mainWindow=self.builder.get_object("mainWindow")
#i18n #i18n
@ -106,40 +99,40 @@ class mintMenuConfig( object ):
self.builder.get_object("logoutcheckbutton").set_label(_("Log Out")) self.builder.get_object("logoutcheckbutton").set_label(_("Log Out"))
self.builder.get_object("quitcheckbutton").set_label(_("Quit")) self.builder.get_object("quitcheckbutton").set_label(_("Quit"))
self.editPlaceDialogTitle = (_("Edit Place")) self.editPlaceDialogTitle = _("Edit Place")
self.newPlaceDialogTitle = (_("New Place")) self.newPlaceDialogTitle = _("New Place")
self.folderChooserDialogTitle = (_("Select a folder")) self.folderChooserDialogTitle = _("Select a folder")
self.startWithFavorites = self.builder.get_object( "startWithFavorites" ) self.startWithFavorites = self.builder.get_object("startWithFavorites")
self.showAppComments = self.builder.get_object( "showAppComments" ) self.showAppComments = self.builder.get_object("showAppComments")
self.useAPT = self.builder.get_object( "use_apt" ) self.useAPT = self.builder.get_object("use_apt")
self.showCategoryIcons = self.builder.get_object( "showCategoryIcons" ) self.showCategoryIcons = self.builder.get_object("showCategoryIcons")
self.showRecentPlugin = self.builder.get_object( "showRecentPlugin" ) self.showRecentPlugin = self.builder.get_object("showRecentPlugin")
self.showApplicationsPlugin = self.builder.get_object( "showApplicationsPlugin" ) self.showApplicationsPlugin = self.builder.get_object("showApplicationsPlugin")
self.showSystemPlugin = self.builder.get_object( "showSystemPlugin" ) self.showSystemPlugin = self.builder.get_object("showSystemPlugin")
self.showPlacesPlugin = self.builder.get_object( "showPlacesPlugin" ) self.showPlacesPlugin = self.builder.get_object("showPlacesPlugin")
self.swapGeneric = self.builder.get_object("swapGeneric") self.swapGeneric = self.builder.get_object("swapGeneric")
self.hover = self.builder.get_object( "hover" ) self.hover = self.builder.get_object("hover")
self.hoverDelay = self.builder.get_object( "hoverDelay" ) self.hoverDelay = self.builder.get_object("hoverDelay")
self.rememberFilter = self.builder.get_object( "remember_filter" ) self.rememberFilter = self.builder.get_object("remember_filter")
self.iconSize = self.builder.get_object( "iconSize" ) self.iconSize = self.builder.get_object("iconSize")
self.favIconSize = self.builder.get_object( "favIconSize" ) self.favIconSize = self.builder.get_object("favIconSize")
self.placesIconSize = self.builder.get_object( "placesIconSize" ) self.placesIconSize = self.builder.get_object("placesIconSize")
self.systemIconSize = self.builder.get_object( "systemIconSize" ) self.systemIconSize = self.builder.get_object("systemIconSize")
self.favCols = self.builder.get_object( "numFavCols" ) self.favCols = self.builder.get_object("numFavCols")
self.useCustomColors = self.builder.get_object( "useCustomColors" ) self.useCustomColors = self.builder.get_object("useCustomColors")
self.backgroundColor = self.builder.get_object( "backgroundColor" ) self.backgroundColor = self.builder.get_object("backgroundColor")
self.headingColor = self.builder.get_object( "headingColor" ) self.headingColor = self.builder.get_object("headingColor")
self.backgroundColorLabel = self.builder.get_object( "backgroundColorLabel" ) self.backgroundColorLabel = self.builder.get_object("backgroundColorLabel")
self.headingColorLabel = self.builder.get_object( "headingColorLabel" ) self.headingColorLabel = self.builder.get_object("headingColorLabel")
self.showButtonIcon = self.builder.get_object( "showButtonIcon" ) self.showButtonIcon = self.builder.get_object("showButtonIcon")
self.enableInternetSearch = self.builder.get_object( "enableInternetSearch" ) self.enableInternetSearch = self.builder.get_object("enableInternetSearch")
self.buttonText = self.builder.get_object( "buttonText" ) self.buttonText = self.builder.get_object("buttonText")
self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:") ) self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:"))
grid = self.builder.get_object( "main_grid" ) grid = self.builder.get_object("main_grid")
grid.attach(self.hotkeyWidget, 0, 2, 2, 1) grid.attach(self.hotkeyWidget, 0, 2, 2, 1)
self.buttonIcon = self.builder.get_object( "buttonIcon" ) self.buttonIcon = self.builder.get_object("buttonIcon")
self.buttonIconChooser = self.builder.get_object( "button_icon_chooser" ) self.buttonIconChooser = self.builder.get_object("button_icon_chooser")
self.image_filter = Gtk.FileFilter() self.image_filter = Gtk.FileFilter()
self.image_filter.set_name(_("Images")) self.image_filter.set_name(_("Images"))
self.image_filter.add_pattern("*.png") self.image_filter.add_pattern("*.png")
@ -152,115 +145,115 @@ class mintMenuConfig( object ):
self.buttonIconChooser.add_filter(self.image_filter) self.buttonIconChooser.add_filter(self.image_filter)
self.buttonIconChooser.set_filter(self.image_filter) self.buttonIconChooser.set_filter(self.image_filter)
self.buttonIconImage = self.builder.get_object("image_button_icon") self.buttonIconImage = self.builder.get_object("image_button_icon")
self.searchCommand = self.builder.get_object( "search_command" ) self.searchCommand = self.builder.get_object("search_command")
self.computertoggle = self.builder.get_object( "computercheckbutton" ) self.computertoggle = self.builder.get_object("computercheckbutton")
self.homefoldertoggle = self.builder.get_object( "homecheckbutton" ) self.homefoldertoggle = self.builder.get_object("homecheckbutton")
self.networktoggle = self.builder.get_object( "networkcheckbutton" ) self.networktoggle = self.builder.get_object("networkcheckbutton")
self.desktoptoggle = self.builder.get_object( "desktopcheckbutton" ) self.desktoptoggle = self.builder.get_object("desktopcheckbutton")
self.trashtoggle = self.builder.get_object( "trashcheckbutton" ) self.trashtoggle = self.builder.get_object("trashcheckbutton")
self.customplacestree = self.builder.get_object( "customplacestree" ) self.customplacestree = self.builder.get_object("customplacestree")
self.allowPlacesScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton" ) self.allowPlacesScrollbarToggle = self.builder.get_object("allowscrollbarcheckbutton")
self.showgtkbookmarksToggle = self.builder.get_object( "showgtkbookmarkscheckbutton" ) self.showgtkbookmarksToggle = self.builder.get_object("showgtkbookmarkscheckbutton")
self.placesHeightButton = self.builder.get_object( "placesHeightSpinButton" ) self.placesHeightButton = self.builder.get_object("placesHeightSpinButton")
if (self.allowPlacesScrollbarToggle.get_active() == False): if not self.allowPlacesScrollbarToggle.get_active():
self.placesHeightButton.set_sensitive(False) self.placesHeightButton.set_sensitive(False)
self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled ) self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled)
self.softwareManagerToggle = self.builder.get_object( "softwaremanagercheckbutton" ) self.softwareManagerToggle = self.builder.get_object("softwaremanagercheckbutton")
self.packageManagerToggle = self.builder.get_object( "packagemanagercheckbutton" ) self.packageManagerToggle = self.builder.get_object("packagemanagercheckbutton")
self.controlCenterToggle = self.builder.get_object( "controlcentercheckbutton" ) self.controlCenterToggle = self.builder.get_object("controlcentercheckbutton")
self.terminalToggle = self.builder.get_object( "terminalcheckbutton" ) self.terminalToggle = self.builder.get_object("terminalcheckbutton")
self.lockToggle = self.builder.get_object( "lockcheckbutton" ) self.lockToggle = self.builder.get_object("lockcheckbutton")
self.logoutToggle = self.builder.get_object( "logoutcheckbutton" ) self.logoutToggle = self.builder.get_object("logoutcheckbutton")
self.quitToggle = self.builder.get_object( "quitcheckbutton" ) self.quitToggle = self.builder.get_object("quitcheckbutton")
self.allowSystemScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton1" ) self.allowSystemScrollbarToggle = self.builder.get_object("allowscrollbarcheckbutton1")
self.systemHeightButton = self.builder.get_object( "systemHeightSpinButton" ) self.systemHeightButton = self.builder.get_object("systemHeightSpinButton")
if (self.allowSystemScrollbarToggle.get_active() == False): self.systemHeightButton.set_sensitive(False) if not self.allowSystemScrollbarToggle.get_active():
self.allowSystemScrollbarToggle.connect("toggled", self.toggleSystemHeightEnabled ) self.systemHeightButton.set_sensitive(False)
self.allowSystemScrollbarToggle.connect("toggled", self.toggleSystemHeightEnabled)
if os.path.exists("/usr/bin/mintinstall"): if os.path.exists("/usr/bin/mintinstall"):
self.builder.get_object( "softwaremanagercheckbutton" ).show() self.builder.get_object("softwaremanagercheckbutton").show()
else: else:
self.builder.get_object( "softwaremanagercheckbutton" ).hide() self.builder.get_object("softwaremanagercheckbutton").hide()
self.builder.get_object( "closeButton" ).connect("clicked", Gtk.main_quit ) self.builder.get_object("closeButton").connect("clicked", Gtk.main_quit)
self.settings = EasyGSettings("com.linuxmint.mintmenu")
self.settingsApplications = EasyGSettings("com.linuxmint.mintmenu.plugins.applications")
self.settingsPlaces = EasyGSettings("com.linuxmint.mintmenu.plugins.places")
self.settingsSystem = EasyGSettings("com.linuxmint.mintmenu.plugins.system_management")
self.settings = EasyGSettings( "com.linuxmint.mintmenu" ) self.useCustomColors.connect("toggled", self.toggleUseCustomColors)
self.settingsApplications = EasyGSettings( "com.linuxmint.mintmenu.plugins.applications" )
self.settingsPlaces = EasyGSettings( "com.linuxmint.mintmenu.plugins.places" )
self.settingsSystem = EasyGSettings( "com.linuxmint.mintmenu.plugins.system_management" )
self.useCustomColors.connect( "toggled", self.toggleUseCustomColors ) self.bindGSettingsValueToWidget(self.settings, "bool", "start-with-favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active)
self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "show-application-comments", self.showAppComments, "toggled", self.showAppComments.set_active, self.showAppComments.get_active)
self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "use-apt", self.useAPT, "toggled", self.useAPT.set_active, self.useAPT.get_active)
self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "show-category-icons", self.showCategoryIcons, "toggled", self.showCategoryIcons.set_active, self.showCategoryIcons.get_active)
self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "categories-mouse-over", self.hover, "toggled", self.hover.set_active, self.hover.get_active)
self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "swap-generic-name", self.swapGeneric, "toggled", self.swapGeneric.set_active, self.swapGeneric.get_active)
self.bindGSettingsValueToWidget( self.settings, "bool", "start-with-favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active ) self.bindGSettingsValueToWidget(self.settingsApplications, "int", "category-hover-delay", self.hoverDelay, "value-changed", self.hoverDelay.set_value, self.hoverDelay.get_value)
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "show-application-comments", self.showAppComments, "toggled", self.showAppComments.set_active, self.showAppComments.get_active ) self.bindGSettingsValueToWidget(self.settingsApplications, "int", "icon-size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.get_value)
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "use-apt", self.useAPT, "toggled", self.useAPT.set_active, self.useAPT.get_active ) self.bindGSettingsValueToWidget(self.settingsApplications, "int", "favicon-size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value)
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "show-category-icons", self.showCategoryIcons, "toggled", self.showCategoryIcons.set_active, self.showCategoryIcons.get_active ) self.bindGSettingsValueToWidget(self.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value)
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "categories-mouse-over", self.hover, "toggled", self.hover.set_active, self.hover.get_active ) self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active)
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "swap-generic-name", self.swapGeneric, "toggled", self.swapGeneric.set_active, self.swapGeneric.get_active ) self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "enable-internet-search", self.enableInternetSearch, "toggled", self.enableInternetSearch.set_active, self.enableInternetSearch.get_active)
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "category-hover-delay", self.hoverDelay, "value-changed", self.hoverDelay.set_value, self.hoverDelay.get_value ) self.bindGSettingsValueToWidget(self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value)
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "icon-size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.get_value ) self.bindGSettingsValueToWidget(self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value)
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "favicon-size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active)
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "enable-internet-search", self.enableInternetSearch, "toggled", self.enableInternetSearch.set_active, self.enableInternetSearch.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value ) self.bindGSettingsValueToWidget(self.settings, "bool", "use-custom-color", self.useCustomColors, "toggled", self.useCustomColors.set_active, self.useCustomColors.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value ) self.bindGSettingsValueToWidget(self.settings, "color", "custom-color", self.backgroundColor, "color-set", self.backgroundColor.set_rgba, self.getBackgroundColor)
self.bindGSettingsValueToWidget(self.settings, "color", "custom-heading-color", self.headingColor, "color-set", self.headingColor.set_rgba, self.getHeadingColor)
self.bindGSettingsValueToWidget( self.settings, "bool", "use-custom-color", self.useCustomColors, "toggled", self.useCustomColors.set_active, self.useCustomColors.get_active ) self.bindGSettingsValueToWidget(self.settings, "bool", "hide-applet-icon", self.showButtonIcon, "toggled", self.setShowButtonIcon, self.getShowButtonIcon)
self.bindGSettingsValueToWidget( self.settings, "color", "custom-color", self.backgroundColor, "color-set", self.backgroundColor.set_rgba, self.getBackgroundColor ) self.bindGSettingsValueToWidget(self.settings, "string", "applet-text", self.buttonText, "changed", self.buttonText.set_text, self.buttonText.get_text)
self.bindGSettingsValueToWidget( self.settings, "color", "custom-heading-color", self.headingColor, "color-set", self.headingColor.set_rgba, self.getHeadingColor ) self.bindGSettingsValueToWidget(self.settings, "string", "hot-key", self.hotkeyWidget, "accel-edited", self.hotkeyWidget.set_val, self.hotkeyWidget.get_val)
self.bindGSettingsValueToWidget( self.settings, "bool", "hide-applet-icon", self.showButtonIcon, "toggled", self.setShowButtonIcon, self.getShowButtonIcon ) self.bindGSettingsValueToWidget(self.settings, "string", "applet-icon", self.buttonIconChooser, "file-set", self.setButtonIcon, self.buttonIconChooser.get_filename)
self.bindGSettingsValueToWidget( self.settings, "string", "applet-text", self.buttonText, "changed", self.buttonText.set_text, self.buttonText.get_text ) self.bindGSettingsValueToWidget(self.settingsApplications, "string", "search-command", self.searchCommand, "changed", self.searchCommand.set_text, self.searchCommand.get_text)
self.bindGSettingsValueToWidget( self.settings, "string", "hot-key", self.hotkeyWidget, "accel-edited", self.hotkeyWidget.set_val, self.hotkeyWidget.get_val )
self.bindGSettingsValueToWidget( self.settings, "string", "applet-icon", self.buttonIconChooser, "file-set", self.setButtonIcon, self.buttonIconChooser.get_filename )
self.bindGSettingsValueToWidget( self.settingsApplications, "string", "search-command", self.searchCommand, "changed", self.searchCommand.set_text, self.searchCommand.get_text )
self.getPluginsToggle() self.getPluginsToggle()
self.showRecentPlugin.connect("toggled", self.setPluginsLayout ) self.showRecentPlugin.connect("toggled", self.setPluginsLayout)
self.showApplicationsPlugin.connect("toggled", self.setPluginsLayout ) self.showApplicationsPlugin.connect("toggled", self.setPluginsLayout)
self.showSystemPlugin.connect("toggled", self.setPluginsLayout ) self.showSystemPlugin.connect("toggled", self.setPluginsLayout)
self.showPlacesPlugin.connect("toggled", self.setPluginsLayout ) self.showPlacesPlugin.connect("toggled", self.setPluginsLayout)
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-computer", self.computertoggle, "toggled", self.computertoggle.set_active, self.computertoggle.get_active ) self.bindGSettingsValueToWidget(self.settingsPlaces, "bool", "show-computer", self.computertoggle, "toggled", self.computertoggle.set_active, self.computertoggle.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-home-folder", self.homefoldertoggle, "toggled", self.homefoldertoggle.set_active, self.homefoldertoggle.get_active ) self.bindGSettingsValueToWidget(self.settingsPlaces, "bool", "show-home-folder", self.homefoldertoggle, "toggled", self.homefoldertoggle.set_active, self.homefoldertoggle.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-network", self.networktoggle, "toggled", self.networktoggle.set_active, self.networktoggle.get_active ) self.bindGSettingsValueToWidget(self.settingsPlaces, "bool", "show-network", self.networktoggle, "toggled", self.networktoggle.set_active, self.networktoggle.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-desktop", self.desktoptoggle, "toggled", self.desktoptoggle.set_active, self.desktoptoggle.get_active ) self.bindGSettingsValueToWidget(self.settingsPlaces, "bool", "show-desktop", self.desktoptoggle, "toggled", self.desktoptoggle.set_active, self.desktoptoggle.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-trash", self.trashtoggle, "toggled", self.trashtoggle.set_active, self.trashtoggle.get_active ) self.bindGSettingsValueToWidget(self.settingsPlaces, "bool", "show-trash", self.trashtoggle, "toggled", self.trashtoggle.set_active, self.trashtoggle.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "height", self.placesHeightButton, "value-changed", self.placesHeightButton.set_value, self.placesHeightButton.get_value_as_int ) self.bindGSettingsValueToWidget(self.settingsPlaces, "int", "height", self.placesHeightButton, "value-changed", self.placesHeightButton.set_value, self.placesHeightButton.get_value_as_int)
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "allow-scrollbar", self.allowPlacesScrollbarToggle, "toggled", self.allowPlacesScrollbarToggle.set_active, self.allowPlacesScrollbarToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsPlaces, "bool", "allow-scrollbar", self.allowPlacesScrollbarToggle, "toggled", self.allowPlacesScrollbarToggle.set_active, self.allowPlacesScrollbarToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-gtk-bookmarks", self.showgtkbookmarksToggle, "toggled", self.showgtkbookmarksToggle.set_active, self.showgtkbookmarksToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsPlaces, "bool", "show-gtk-bookmarks", self.showgtkbookmarksToggle, "toggled", self.showgtkbookmarksToggle.set_active, self.showgtkbookmarksToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-software-manager", self.softwareManagerToggle, "toggled", self.softwareManagerToggle.set_active, self.softwareManagerToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "show-software-manager", self.softwareManagerToggle, "toggled", self.softwareManagerToggle.set_active, self.softwareManagerToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-package-manager", self.packageManagerToggle, "toggled", self.packageManagerToggle.set_active, self.packageManagerToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "show-package-manager", self.packageManagerToggle, "toggled", self.packageManagerToggle.set_active, self.packageManagerToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-control-center", self.controlCenterToggle, "toggled", self.controlCenterToggle.set_active, self.controlCenterToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "show-control-center", self.controlCenterToggle, "toggled", self.controlCenterToggle.set_active, self.controlCenterToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-terminal", self.terminalToggle, "toggled", self.terminalToggle.set_active, self.terminalToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "show-terminal", self.terminalToggle, "toggled", self.terminalToggle.set_active, self.terminalToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-lock-screen", self.lockToggle, "toggled", self.lockToggle.set_active, self.lockToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "show-lock-screen", self.lockToggle, "toggled", self.lockToggle.set_active, self.lockToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-logout", self.logoutToggle, "toggled", self.logoutToggle.set_active, self.logoutToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "show-logout", self.logoutToggle, "toggled", self.logoutToggle.set_active, self.logoutToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-quit", self.quitToggle, "toggled", self.quitToggle.set_active, self.quitToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "show-quit", self.quitToggle, "toggled", self.quitToggle.set_active, self.quitToggle.get_active)
self.bindGSettingsValueToWidget( self.settingsSystem, "int", "height", self.systemHeightButton, "value-changed", self.systemHeightButton.set_value, self.systemHeightButton.get_value_as_int ) self.bindGSettingsValueToWidget(self.settingsSystem, "int", "height", self.systemHeightButton, "value-changed", self.systemHeightButton.set_value, self.systemHeightButton.get_value_as_int)
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "allow-scrollbar", self.allowSystemScrollbarToggle, "toggled", self.allowSystemScrollbarToggle.set_active, self.allowSystemScrollbarToggle.get_active ) self.bindGSettingsValueToWidget(self.settingsSystem, "bool", "allow-scrollbar", self.allowSystemScrollbarToggle, "toggled", self.allowSystemScrollbarToggle.set_active, self.allowSystemScrollbarToggle.get_active)
self.customplacepaths = self.settingsPlaces.get( "list-string", "custom-paths" ) self.customplacepaths = self.settingsPlaces.get("list-string", "custom-paths")
self.customplacenames = self.settingsPlaces.get( "list-string", "custom-names" ) self.customplacenames = self.settingsPlaces.get("list-string", "custom-names")
self.customplacestreemodel = Gtk.ListStore( str, str) self.customplacestreemodel = Gtk.ListStore(str, str)
self.cell = Gtk.CellRendererText() self.cell = Gtk.CellRendererText()
for count in range( len(self.customplacepaths) ): for count in range(len(self.customplacepaths)):
self.customplacestreemodel.append( [ self.customplacenames[count], self.customplacepaths[count] ] ) self.customplacestreemodel.append([self.customplacenames[count], self.customplacepaths[count]])
self.customplacestreemodel.connect("row-inserted", self.updatePlacesGSettings) self.customplacestreemodel.connect("row-inserted", self.updatePlacesGSettings)
self.customplacestreemodel.connect("row-deleted", self.updatePlacesGSettings) self.customplacestreemodel.connect("row-deleted", self.updatePlacesGSettings)
self.customplacestreemodel.connect("rows-reordered", self.updatePlacesGSettings) self.customplacestreemodel.connect("rows-reordered", self.updatePlacesGSettings)
self.customplacestreemodel.connect("row-changed", self.updatePlacesGSettings) self.customplacestreemodel.connect("row-changed", self.updatePlacesGSettings)
self.customplacestree.set_model( self.customplacestreemodel ) self.customplacestree.set_model(self.customplacestreemodel)
self.namescolumn = Gtk.TreeViewColumn( _("Name"), self.cell, text = 0 ) self.namescolumn = Gtk.TreeViewColumn(_("Name"), self.cell, text = 0)
self.placescolumn = Gtk.TreeViewColumn( _("Path"), self.cell, text = 1 ) self.placescolumn = Gtk.TreeViewColumn(_("Path"), self.cell, text = 1)
self.customplacestree.append_column( self.namescolumn ) self.customplacestree.append_column(self.namescolumn)
self.customplacestree.append_column( self.placescolumn ) self.customplacestree.append_column(self.placescolumn)
self.builder.get_object("newButton").connect("clicked", self.newPlace) self.builder.get_object("newButton").connect("clicked", self.newPlace)
self.builder.get_object("editButton").connect("clicked", self.editPlace) self.builder.get_object("editButton").connect("clicked", self.editPlace)
self.builder.get_object("upButton").connect("clicked", self.moveUp) self.builder.get_object("upButton").connect("clicked", self.moveUp)
@ -268,9 +261,8 @@ class mintMenuConfig( object ):
self.builder.get_object("removeButton").connect("clicked", self.removePlace) self.builder.get_object("removeButton").connect("clicked", self.removePlace)
#Detect themes and show theme here #Detect themes and show theme here
theme_name = self.settings.get ("string", "theme-name") theme_name = self.settings.get("string", "theme-name")
themes = commands.getoutput("find /usr/share/themes -name gtkrc") themes = glob("/usr/share/themes/*/*/gtkrc")
themes = themes.split("\n")
model = Gtk.ListStore(str, str) model = Gtk.ListStore(str, str)
self.builder.get_object("themesCombo").set_model(model) self.builder.get_object("themesCombo").set_model(model)
selected_theme = model.append([_("Desktop theme"), "default"]) selected_theme = model.append([_("Desktop theme"), "default"])
@ -295,10 +287,10 @@ class mintMenuConfig( object ):
model = widget.get_model() model = widget.get_model()
iter = widget.get_active_iter() iter = widget.get_active_iter()
theme_name = model.get_value(iter, 1) theme_name = model.get_value(iter, 1)
self.settings.set( "string", "theme-name", theme_name) self.settings.set("string", "theme-name", theme_name)
def getPluginsToggle(self): def getPluginsToggle(self):
array = self.settings.get ("list-string", "plugins-list") array = self.settings.get("list-string", "plugins-list")
if "recent" in array: if "recent" in array:
self.showRecentPlugin.set_active(True) self.showRecentPlugin.set_active(True)
else: else:
@ -316,7 +308,7 @@ class mintMenuConfig( object ):
else: else:
self.showPlacesPlugin.set_active(False) self.showPlacesPlugin.set_active(False)
def setPluginsLayout (self, widget): def setPluginsLayout(self, widget):
visiblePlugins = [] visiblePlugins = []
if self.showPlacesPlugin.get_active(): if self.showPlacesPlugin.get_active():
visiblePlugins.append("places") visiblePlugins.append("places")
@ -330,79 +322,80 @@ class mintMenuConfig( object ):
if self.showApplicationsPlugin.get_active() or self.showPlacesPlugin.get_active() or self.showSystemPlugin.get_active(): if self.showApplicationsPlugin.get_active() or self.showPlacesPlugin.get_active() or self.showSystemPlugin.get_active():
visiblePlugins.append("newpane") visiblePlugins.append("newpane")
visiblePlugins.append("recent") visiblePlugins.append("recent")
self.settings.set ("list-string", "plugins-list", visiblePlugins) self.settings.set("list-string", "plugins-list", visiblePlugins)
def setShowButtonIcon( self, value ): def setShowButtonIcon(self, value):
self.showButtonIcon.set_active(not value ) self.showButtonIcon.set_active(not value)
def setButtonIcon( self, value ): def setButtonIcon(self, value):
self.buttonIconChooser.set_filename(value) self.buttonIconChooser.set_filename(value)
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(value, -1, 22) pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(value, -1, 22)
self.buttonIconImage.set_from_pixbuf(pixbuf) self.buttonIconImage.set_from_pixbuf(pixbuf)
def getShowButtonIcon( self ): def getShowButtonIcon(self):
return not self.showButtonIcon.get_active() return not self.showButtonIcon.get_active()
def bindGSettingsValueToWidget( self, settings, setting_type, key, widget, changeEvent, setter, getter ): def bindGSettingsValueToWidget(self, settings, setting_type, key, widget, changeEvent, setter, getter):
settings.notifyAdd( key, self.callSetter, args = [ setting_type, setter ] ) settings.notifyAdd(key, self.callSetter, args = [setting_type, setter])
if setting_type == "color": if setting_type == "color":
color = Gdk.RGBA() color = Gdk.RGBA()
color.parse( settings.get( setting_type, key ) ) color.parse(settings.get(setting_type, key))
setter( color ) setter(color)
else: else:
setter( settings.get( setting_type, key ) ) setter(settings.get(setting_type, key))
widget.connect( changeEvent, lambda *args: self.callGetter( settings, setting_type, key, getter ) ) widget.connect(changeEvent, lambda *args: self.callGetter(settings, setting_type, key, getter))
def callSetter( self, settings, key, args ): def callSetter(self, settings, key, args):
if args[0] == "bool": if args[0] == "bool":
args[1]( settings.get_boolean(key) ) args[1](settings.get_boolean(key))
elif args[0] == "string": elif args[0] == "string":
args[1]( settings.get_string(key) ) args[1](settings.get_string(key))
elif args[0] == "int": elif args[0] == "int":
args[1]( settings.get_int(key) ) args[1](settings.get_int(key))
elif args[0] == "color": elif args[0] == "color":
color = Gdk.RGBA() color = Gdk.RGBA()
color.parse( settings.get_string(key) ) color.parse(settings.get_string(key))
args[1]( color ) args[1](color)
def callGetter( self, settings, setting_type, key, getter ): def callGetter(self, settings, setting_type, key, getter):
if (setting_type == "int"): if setting_type == "int":
settings.set( setting_type, key, int(getter())) settings.set(setting_type, key, int(getter()))
else: else:
settings.set( setting_type, key, getter()) settings.set(setting_type, key, getter())
def toggleUseCustomColors( self, widget ): def toggleUseCustomColors(self, widget):
self.backgroundColor.set_sensitive( widget.get_active() ) self.backgroundColor.set_sensitive(widget.get_active())
self.headingColor.set_sensitive( widget.get_active() ) self.headingColor.set_sensitive(widget.get_active())
self.backgroundColorLabel.set_sensitive( widget.get_active() ) self.backgroundColorLabel.set_sensitive(widget.get_active())
self.headingColorLabel.set_sensitive( widget.get_active() ) self.headingColorLabel.set_sensitive(widget.get_active())
def getBackgroundColor( self ): def getBackgroundColor(self):
color = self.backgroundColor.get_rgba() color = self.backgroundColor.get_rgba()
return self.gdkRGBAToString( color ) return self.gdkRGBAToString(color)
def getHeadingColor( self ): def getHeadingColor(self):
color = self.headingColor.get_rgba() color = self.headingColor.get_rgba()
return self.gdkRGBAToString( color ) return self.gdkRGBAToString(color)
def gdkRGBAToString( self, gdkRGBA ): def gdkRGBAToString(self, gdkRGBA):
return "#%.2X%.2X%.2X" % ( gdkRGBA.red * 256, gdkRGBA.green * 256, gdkRGBA.blue * 256 ) return "#%.2X%.2X%.2X" % (gdkRGBA.red * 256, gdkRGBA.green * 256, gdkRGBA.blue * 256)
def moveUp( self, upButton ): def moveUp(self, upButton):
treeselection = self.customplacestree.get_selection() treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1] currentiter = treeselection.get_selected()[1]
if ( treeselection != None ): if treeselection:
lagiter = self.customplacestreemodel.get_iter_first() lagiter = self.customplacestreemodel.get_iter_first()
nextiter = self.customplacestreemodel.get_iter_first() nextiter = self.customplacestreemodel.get_iter_first()
while ( (self.customplacestreemodel.get_path(nextiter) != self.customplacestreemodel.get_path(currentiter)) & (nextiter != None)): while nextiter and self.customplacestreemodel.get_path(nextiter) != \
self.customplacestreemodel.get_path(currentiter):
lagiter = nextiter lagiter = nextiter
nextiter = self.customplacestreemodel.iter_next(nextiter) nextiter = self.customplacestreemodel.iter_next(nextiter)
if (nextiter != None): if nextiter:
self.customplacestreemodel.swap(currentiter, lagiter) self.customplacestreemodel.swap(currentiter, lagiter)
return return
@ -410,51 +403,51 @@ class mintMenuConfig( object ):
def newPlace(self, newButton): def newPlace(self, newButton):
self.builder.get_object("label2").set_text(_("Name:")) self.builder.get_object("label2").set_text(_("Name:"))
self.builder.get_object("label1").set_text(_("Path:")) self.builder.get_object("label1").set_text(_("Path:"))
newPlaceDialog = self.builder.get_object( "editPlaceDialog" ) newPlaceDialog = self.builder.get_object("editPlaceDialog")
folderChooserDialog = self.builder.get_object( "fileChooserDialog" ) folderChooserDialog = self.builder.get_object("fileChooserDialog")
newPlaceDialog.set_transient_for(self.mainWindow) newPlaceDialog.set_transient_for(self.mainWindow)
newPlaceDialog.set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg") newPlaceDialog.set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg")
newPlaceDialog.set_title(self.newPlaceDialogTitle) newPlaceDialog.set_title(self.newPlaceDialogTitle)
folderChooserDialog.set_title(self.folderChooserDialogTitle) folderChooserDialog.set_title(self.folderChooserDialogTitle)
newPlaceDialog.set_default_response(Gtk.ResponseType.OK) newPlaceDialog.set_default_response(Gtk.ResponseType.OK)
newPlaceName = self.builder.get_object( "nameEntryBox" ) newPlaceName = self.builder.get_object("nameEntryBox")
newPlacePath = self.builder.get_object( "pathEntryBox" ) newPlacePath = self.builder.get_object("pathEntryBox")
folderButton = self.builder.get_object( "folderButton" ) folderButton = self.builder.get_object("folderButton")
def chooseFolder(folderButton): def chooseFolder(folderButton):
currentPath = newPlacePath.get_text() currentPath = newPlacePath.get_text()
if (currentPath!=""): if currentPath:
folderChooserDialog.select_filename(currentPath) folderChooserDialog.select_filename(currentPath)
response = folderChooserDialog.run() response = folderChooserDialog.run()
folderChooserDialog.hide() folderChooserDialog.hide()
if (response == Gtk.ResponseType.OK): if response == Gtk.ResponseType.OK:
newPlacePath.set_text( folderChooserDialog.get_filenames()[0] ) newPlacePath.set_text(folderChooserDialog.get_filenames()[0])
folderButton.connect("clicked", chooseFolder) folderButton.connect("clicked", chooseFolder)
response = newPlaceDialog.run() response = newPlaceDialog.run()
newPlaceDialog.hide() newPlaceDialog.hide()
if (response == Gtk.ResponseType.OK ): if response == Gtk.ResponseType.OK:
name = newPlaceName.get_text() name = newPlaceName.get_text()
path = newPlacePath.get_text() path = newPlacePath.get_text()
if (name != "" and path !=""): if name and path:
self.customplacestreemodel.append( (name, path) ) self.customplacestreemodel.append((name, path))
def editPlace(self, editButton): def editPlace(self, editButton):
self.builder.get_object("label2").set_text(_("Name:")) self.builder.get_object("label2").set_text(_("Name:"))
self.builder.get_object("label1").set_text(_("Path:")) self.builder.get_object("label1").set_text(_("Path:"))
editPlaceDialog = self.builder.get_object( "editPlaceDialog" ) editPlaceDialog = self.builder.get_object("editPlaceDialog")
folderChooserDialog = self.builder.get_object( "fileChooserDialog" ) folderChooserDialog = self.builder.get_object("fileChooserDialog")
editPlaceDialog.set_transient_for(self.mainWindow) editPlaceDialog.set_transient_for(self.mainWindow)
editPlaceDialog.set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg") editPlaceDialog.set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg")
editPlaceDialog.set_title(self.editPlaceDialogTitle) editPlaceDialog.set_title(self.editPlaceDialogTitle)
folderChooserDialog.set_title(self.folderChooserDialogTitle) folderChooserDialog.set_title(self.folderChooserDialogTitle)
editPlaceDialog.set_default_response(Gtk.ResponseType.OK) editPlaceDialog.set_default_response(Gtk.ResponseType.OK)
editPlaceName = self.builder.get_object( "nameEntryBox" ) editPlaceName = self.builder.get_object("nameEntryBox")
editPlacePath = self.builder.get_object( "pathEntryBox" ) editPlacePath = self.builder.get_object("pathEntryBox")
folderButton = self.builder.get_object( "folderButton" ) folderButton = self.builder.get_object("folderButton")
treeselection = self.customplacestree.get_selection() treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1] currentiter = treeselection.get_selected()[1]
if (currentiter != None): if currentiter:
initName = self.customplacestreemodel.get_value(currentiter, 0) initName = self.customplacestreemodel.get_value(currentiter, 0)
initPath = self.customplacestreemodel.get_value(currentiter, 1) initPath = self.customplacestreemodel.get_value(currentiter, 1)
@ -463,70 +456,69 @@ class mintMenuConfig( object ):
editPlacePath.set_text(initPath) editPlacePath.set_text(initPath)
def chooseFolder(folderButton): def chooseFolder(folderButton):
currentPath = editPlacePath.get_text() currentPath = editPlacePath.get_text()
if (currentPath!=""): if currentPath:
folderChooserDialog.select_filename(currentPath) folderChooserDialog.select_filename(currentPath)
response = folderChooserDialog.run() response = folderChooserDialog.run()
folderChooserDialog.hide() folderChooserDialog.hide()
if (response == Gtk.ResponseType.OK): if response == Gtk.ResponseType.OK:
editPlacePath.set_text( folderChooserDialog.get_filenames()[0] ) editPlacePath.set_text(folderChooserDialog.get_filenames()[0])
folderButton.connect("clicked", chooseFolder) folderButton.connect("clicked", chooseFolder)
response = editPlaceDialog.run() response = editPlaceDialog.run()
editPlaceDialog.hide() editPlaceDialog.hide()
if (response == Gtk.ResponseType.OK): if response == Gtk.ResponseType.OK:
name = editPlaceName.get_text() name = editPlaceName.get_text()
path = editPlacePath.get_text() path = editPlacePath.get_text()
if (name != "" and path != ""): if name and path:
self.customplacestreemodel.set_value(currentiter, 0, name) self.customplacestreemodel.set_value(currentiter, 0, name)
self.customplacestreemodel.set_value(currentiter, 1, path) self.customplacestreemodel.set_value(currentiter, 1, path)
def moveDown(self, downButton): def moveDown(self, downButton):
treeselection = self.customplacestree.get_selection() treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1] currentiter = treeselection.get_selected()[1]
nextiter = self.customplacestreemodel.iter_next(currentiter) nextiter = self.customplacestreemodel.iter_next(currentiter)
if (nextiter != None): if nextiter:
self.customplacestreemodel.swap(currentiter, nextiter) self.customplacestreemodel.swap(currentiter, nextiter)
return return
def removePlace(self, removeButton): def removePlace(self, removeButton):
treeselection = self.customplacestree.get_selection() treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1] currentiter = treeselection.get_selected()[1]
if (currentiter != None): if currentiter:
self.customplacestreemodel.remove(currentiter) self.customplacestreemodel.remove(currentiter)
return return
def togglePlacesHeightEnabled(self, toggle): def togglePlacesHeightEnabled(self, toggle):
if (toggle.get_active() == True): if toggle.get_active():
self.placesHeightButton.set_sensitive(True) self.placesHeightButton.set_sensitive(True)
else: else:
self.placesHeightButton.set_sensitive(False) self.placesHeightButton.set_sensitive(False)
def toggleSystemHeightEnabled(self, toggle): def toggleSystemHeightEnabled(self, toggle):
if (toggle.get_active() == True): if toggle.get_active():
self.systemHeightButton.set_sensitive(True) self.systemHeightButton.set_sensitive(True)
else: else:
self.systemHeightButton.set_sensitive(False) self.systemHeightButton.set_sensitive(False)
def updatePlacesGSettings(self, treemodel, path, iter = None, new_order = None): def updatePlacesGSettings(self, treemodel, path, iter = None, new_order = None):
# Do only if not partway though an append operation; Append = insert+change+change and each creates a signal # Do only if not partway though an append operation;
if ((iter == None) or (self.customplacestreemodel.get_value(iter, 1) != None)): # Append = insert+change+change and each creates a signal
if not iter or self.customplacestreemodel.get_value(iter, 1):
treeiter = self.customplacestreemodel.get_iter_first() treeiter = self.customplacestreemodel.get_iter_first()
customplacenames = [ ] customplacenames = []
customplacepaths = [ ] customplacepaths = []
while( treeiter != None ): while treeiter:
customplacenames = customplacenames + [ self.customplacestreemodel.get_value(treeiter, 0 ) ] customplacenames = customplacenames + [self.customplacestreemodel.get_value(treeiter, 0)]
customplacepaths = customplacepaths + [ self.customplacestreemodel.get_value(treeiter, 1 ) ] customplacepaths = customplacepaths + [self.customplacestreemodel.get_value(treeiter, 1)]
treeiter = self.customplacestreemodel.iter_next(treeiter) treeiter = self.customplacestreemodel.iter_next(treeiter)
self.settingsPlaces.set( "list-string", "custom-paths", customplacepaths) self.settingsPlaces.set("list-string", "custom-paths", customplacepaths)
self.settingsPlaces.set( "list-string", "custom-names", customplacenames) self.settingsPlaces.set("list-string", "custom-names", customplacenames)
window = mintMenuConfig() window = mintMenuConfig()
Gtk.main() Gtk.main()

View File

@ -1,30 +1,29 @@
#!/usr/bin/python2 #!/usr/bin/python2
import commands import cgi
import filecmp import filecmp
import gettext import gettext
import os import os
import pipes
import string import string
import subprocess import subprocess
import threading import threading
import time import urllib
from user import home
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Pango, Gdk, Gio, GLib from gi.repository import Gtk, Gdk, GdkPixbuf, Gio, GLib
import matemenu import matemenu
import plugins.recentHelper as RecentHelper import plugins.recentHelper as RecentHelper
from plugins.easybuttons import (CategoryButton, FavApplicationLauncher, from plugins.easybuttons import (ApplicationLauncher, CategoryButton,
FavApplicationLauncher,
MenuApplicationLauncher) MenuApplicationLauncher)
from plugins.easygsettings import EasyGSettings from plugins.easygsettings import EasyGSettings
from plugins.execute import Execute from plugins.execute import Execute
# i18n # i18n
gettext.install("mintmenu", "/usr/share/linuxmint/locale") gettext.install("mintmenu", "/usr/share/linuxmint/locale")
home = os.environ.get("HOME")
class PackageDescriptor(): class PackageDescriptor():
def __init__(self, name, summary, description): def __init__(self, name, summary, description):
@ -32,23 +31,24 @@ class PackageDescriptor():
self.summary = summary self.summary = summary
self.description = description self.description = description
def print_timing(func): # import time
def wrapper(*arg): # def print_timing(func):
t1 = time.time() # def wrapper(*arg):
res = func(*arg) # t1 = time.time()
t2 = time.time() # res = func(*arg)
print '%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.0) # t2 = time.time()
return res # print('%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.0))
return wrapper # return res
# return wrapper
# Helper function for retrieving the user's location for storing new or modified menu items # Helper function for retrieving the user's location for storing new or modified menu items
def get_user_item_path(): def get_user_item_path():
item_dir = None item_dir = None
if os.environ.has_key('XDG_DATA_HOME'): if 'XDG_DATA_HOME' in os.environ:
item_dir = os.path.join(os.environ['XDG_DATA_HOME'], 'applications') item_dir = os.path.join(os.environ['XDG_DATA_HOME'], 'applications')
else: else:
item_dir = os.path.join(os.environ['HOME'], '.local', 'share', 'applications') item_dir = os.path.join(home, '.local/share/applications')
if not os.path.isdir(item_dir): if not os.path.isdir(item_dir):
os.makedirs(item_dir) os.makedirs(item_dir)
@ -57,33 +57,32 @@ def get_user_item_path():
def get_system_item_paths(): def get_system_item_paths():
item_dirs = [] item_dirs = []
if os.environ.has_key('XDG_DATA_DIRS'): if 'XDG_DATA_DIRS' in os.environ:
item_dirs = os.environ['XDG_DATA_DIRS'].split(":") item_dirs = os.environ['XDG_DATA_DIRS'].split(":")
item_dirs.append(os.path.join('/usr', 'share')) item_dirs.append(os.path.join('/usr', 'share'))
return item_dirs return item_dirs
def rel_path(target, base=os.curdir): def rel_path(target, base=os.curdir):
if not os.path.exists(target): if not os.path.exists(target):
raise OSError, 'Target does not exist: '+target raise OSError("Target does not exist: %s" % target)
if not os.path.isdir(base): if not os.path.isdir(base):
raise OSError, 'Base is not a directory or does not exist: '+base raise OSError("Base is not a directory or does not exist: %s" % base)
base_list = (os.path.abspath(base)).split(os.sep) base_list = (os.path.abspath(base)).split(os.sep)
target_list = (os.path.abspath(target)).split(os.sep) target_list = (os.path.abspath(target)).split(os.sep)
for i in range(min(len(base_list), len(target_list))): for i in range(min(len(base_list), len(target_list))):
if base_list[i] <> target_list[i]: break if base_list[i] != target_list[i]:
break
else: else:
i += 1 i += 1
rel_list = [os.pardir] * (len(base_list)-i) + target_list[i:] rel_list = [os.pardir] * (len(base_list) - i) + target_list[i:]
return os.path.join(*rel_list) return os.path.join(*rel_list)
class Menu: class Menu:
def __init__(self, MenuToLookup): def __init__(self, MenuToLookup):
self.tree = matemenu.lookup_tree(MenuToLookup) self.tree = matemenu.lookup_tree(MenuToLookup)
self.directory = self.tree.get_root_directory() self.directory = self.tree.get_root_directory()
@ -99,7 +98,9 @@ class Menu:
def getItems(self, menu): def getItems(self, menu):
for item in menu.get_contents(): for item in menu.get_contents():
if item.get_type() == matemenu.TYPE_ENTRY and item.get_desktop_file_id()[-19:] != '-usercustom.desktop' and self.__isVisible(item): if item.get_type() == matemenu.TYPE_ENTRY and \
item.get_desktop_file_id()[-19:] != '-usercustom.desktop' and \
self.__isVisible(item):
yield item yield item
def __isVisible(self, item): def __isVisible(self, item):
@ -108,36 +109,31 @@ class Menu:
if item.get_type() == matemenu.TYPE_DIRECTORY and len(item.get_contents()): if item.get_type() == matemenu.TYPE_DIRECTORY and len(item.get_contents()):
return True return True
class SuggestionButton(Gtk.Button): class SuggestionButton(Gtk.Button):
def __init__(self, iconName, iconSize, label): def __init__(self, iconName, iconSize, label):
Gtk.Button.__init__(self) Gtk.Button.__init__(self)
self.iconName = iconName
self.set_relief(Gtk.ReliefStyle.NONE) self.set_relief(Gtk.ReliefStyle.NONE)
self.set_size_request(-1, -1) self.set_size_request(-1, -1)
Align1 = Gtk.Alignment() Align1 = Gtk.Alignment()
Align1.set(0, 0.5, 1.0, 0) Align1.set(0, 0.5, 1.0, 0)
HBox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) HBox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
labelBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2) labelBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
self.image = Gtk.Image() if iconName.startswith("/"):
self.image.set_from_icon_name(self.iconName, Gtk.IconSize.INVALID) self.image = Gtk.Image.new_from_pixbuf(GdkPixbuf.Pixbuf.new_from_file_at_size(iconName, iconSize, iconSize))
else:
self.image = Gtk.Image.new_from_icon_name(iconName, Gtk.IconSize.DIALOG)
self.image.set_pixel_size(iconSize) self.image.set_pixel_size(iconSize)
self.image.show()
HBox1.pack_start(self.image, False, False, 5) HBox1.pack_start(self.image, False, False, 5)
self.label = Gtk.Label() self.label = Gtk.Label()
self.label.set_ellipsize(Pango.EllipsizeMode.END) self.label.set_markup(label)
self.label.set_ellipsize(3)
self.label.set_alignment(0.0, 1.0) self.label.set_alignment(0.0, 1.0)
self.label.show()
labelBox.pack_start(self.label, True, True, 2) labelBox.pack_start(self.label, True, True, 2)
labelBox.show()
HBox1.pack_start(labelBox, True, True, 2) HBox1.pack_start(labelBox, True, True, 2)
HBox1.show()
Align1.add(HBox1) Align1.add(HBox1)
Align1.show()
self.add(Align1) self.add(Align1)
self.show() self.show_all()
def set_image(self, path): def set_image(self, path):
self.image.set_from_file(path) self.image.set_from_file(path)
@ -155,13 +151,11 @@ class pluginclass(object):
toFav = (Gtk.TargetEntry.new("FAVORITES", Gtk.TargetFlags.SAME_APP, 81), Gtk.TargetEntry.new("text/plain", 0, 100), Gtk.TargetEntry.new("text/uri-list", 0, 101)) toFav = (Gtk.TargetEntry.new("FAVORITES", Gtk.TargetFlags.SAME_APP, 81), Gtk.TargetEntry.new("text/plain", 0, 100), Gtk.TargetEntry.new("text/uri-list", 0, 101))
fromFav = (Gtk.TargetEntry.new("FAVORITES", Gtk.TargetFlags.SAME_APP, 81), Gtk.TargetEntry.new("FAVORITES", Gtk.TargetFlags.SAME_APP, 81)) fromFav = (Gtk.TargetEntry.new("FAVORITES", Gtk.TargetFlags.SAME_APP, 81), Gtk.TargetEntry.new("FAVORITES", Gtk.TargetFlags.SAME_APP, 81))
@print_timing #@print_timing
def __init__(self, mintMenuWin, toggleButton, de): def __init__(self, mintMenuWin, toggleButton, de):
self.mintMenuWin = mintMenuWin self.mintMenuWin = mintMenuWin
RecentHelper.mintMenuWin = mintMenuWin RecentHelper.mintMenuWin = mintMenuWin
self.mainMenus = [] self.mainMenus = []
self.toggleButton = toggleButton self.toggleButton = toggleButton
self.de = de self.de = de
@ -199,7 +193,7 @@ class pluginclass(object):
# These properties are NECESSARY to maintain consistency # These properties are NECESSARY to maintain consistency
# Set 'window' property for the plugin (Must be the root widget) # Set 'window' property for the plugin (Must be the root widget)
self.window =self.builder.get_object("mainWindow") self.window = self.builder.get_object("mainWindow")
# Set 'heading' property for plugin # Set 'heading' property for plugin
self.heading = ""#_("Applications") self.heading = ""#_("Applications")
@ -217,7 +211,6 @@ class pluginclass(object):
self.keyPress_handler = self.mintMenuWin.window.connect("key-press-event", self.keyPress) self.keyPress_handler = self.mintMenuWin.window.connect("key-press-event", self.keyPress)
self.favoritesBox.connect("drag-data-received", self.ReceiveCallback) self.favoritesBox.connect("drag-data-received", self.ReceiveCallback)
self.favoritesBox.drag_dest_set (Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, self.toButton, Gdk.DragAction.COPY) self.favoritesBox.drag_dest_set (Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, self.toButton, Gdk.DragAction.COPY)
self.showFavoritesButton.connect("drag-data-received", self.ReceiveCallback) self.showFavoritesButton.connect("drag-data-received", self.ReceiveCallback)
self.showFavoritesButton.drag_dest_set (Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, self.toButton, Gdk.DragAction.COPY) self.showFavoritesButton.drag_dest_set (Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, self.toButton, Gdk.DragAction.COPY)
@ -245,8 +238,8 @@ class pluginclass(object):
self.settings.bindGSettingsEntryToVar("bool", "enable-internet-search", self, "enableInternetSearch") self.settings.bindGSettingsEntryToVar("bool", "enable-internet-search", self, "enableInternetSearch")
self.settings.bindGSettingsEntryToVar("string", "search-command", self, "searchtool") self.settings.bindGSettingsEntryToVar("string", "search-command", self, "searchtool")
self.settings.bindGSettingsEntryToVar("int", "default-tab", self, "defaultTab") self.settings.bindGSettingsEntryToVar("int", "default-tab", self, "defaultTab")
except Exception, detail: except Exception as e:
print detail print(e)
self.currentFavCol = 0 self.currentFavCol = 0
self.favorites = [] self.favorites = []
@ -280,13 +273,15 @@ class pluginclass(object):
self.builder.get_object("searchButton").connect("button-press-event", self.searchPopup) 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) # self.icon_theme.connect("changed", self.on_icon_theme_changed)
def refresh_apt_cache(self): def refresh_apt_cache(self):
if self.useAPT: if self.useAPT:
os.system("mkdir -p %s/.linuxmint/mintMenu/" % home) path = "%s/.linuxmint/mintMenu" % home
os.system("/usr/lib/linuxmint/mintMenu/plugins/get_apt_cache.py > %s/.linuxmint/mintMenu/apt.cache &" % home) if not os.path.exists(path):
os.makedirs(path)
subprocess.Popen(["/usr/lib/linuxmint/mintMenu/plugins/get_apt_cache.py", "%s/apt.cache" % path])
def get_panel(self): def get_panel(self):
panelsettings = Gio.Settings.new("org.mate.panel") panelsettings = Gio.Settings.new("org.mate.panel")
@ -301,17 +296,19 @@ class pluginclass(object):
self.panel_position = object_schema.get_int("position") + 1 self.panel_position = object_schema.get_int("position") + 1
def apturl_install(self, widget, pkg_name): def apturl_install(self, widget, pkg_name):
if os.path.exists("/usr/bin/apturl"): subprocess.Popen(["xdg-open", "apt://%s" % pkg_name])
os.system("/usr/bin/apturl apt://%s &" % pkg_name) # if os.path.exists("/usr/bin/apturl"):
else: # os.system("/usr/bin/apturl apt://%s &" % pkg_name)
os.system("xdg-open apt://" + pkg_name + " &") # else:
# os.system("xdg-open apt://" + pkg_name + " &")
self.mintMenuWin.hide() self.mintMenuWin.hide()
def __del__(self): def __del__(self):
print u"Applications plugin deleted" #print("Applications plugin deleted")
return
def wake(self): def wake(self):
pass return
def destroy(self): def destroy(self):
self.content_holder.destroy() self.content_holder.destroy()
@ -431,13 +428,22 @@ class pluginclass(object):
self.GetGSettingsEntries() self.GetGSettingsEntries()
# if the config hasn't changed return # if the config hasn't changed return
if oldcategories_mouse_over == self.categories_mouse_over and oldiconsize == self.iconSize and oldfaviconsize == self.faviconsize and oldswapgeneric == self.swapgeneric and oldshowcategoryicons == self.showcategoryicons and oldcategoryhoverdelay == self.categoryhoverdelay and oldsticky == self.sticky and oldminimized == self.minimized and oldicon == self.icon and oldhideseparator == self.hideseparator and oldshowapplicationcomments == self.showapplicationcomments: if (oldcategories_mouse_over == self.categories_mouse_over and
oldiconsize == self.iconSize and
oldfaviconsize == self.faviconsize and
oldswapgeneric == self.swapgeneric and
oldshowcategoryicons == self.showcategoryicons and
oldcategoryhoverdelay == self.categoryhoverdelay and
oldsticky == self.sticky and
oldminimized == self.minimized and
oldicon == self.icon and
oldhideseparator == self.hideseparator and
oldshowapplicationcomments == self.showapplicationcomments
):
return return
self.Todos() self.Todos()
self.buildFavorites() self.buildFavorites()
# TODO all this runs whether the plugin is enabled or not
print "applications.RegenPlugin calling buildRecentApps"
RecentHelper.buildRecentApps() RecentHelper.buildRecentApps()
self.RebuildPlugin() self.RebuildPlugin()
@ -461,7 +467,6 @@ class pluginclass(object):
self.lastActiveTab = self.settings.get("int", "last-active-tab") self.lastActiveTab = self.settings.get("int", "last-active-tab")
self.defaultTab = self.settings.get("int", "default-tab") self.defaultTab = self.settings.get("int", "default-tab")
# Allow plugin to be minimized to the left plugin pane # Allow plugin to be minimized to the left plugin pane
self.sticky = self.settings.get("bool", "sticky") self.sticky = self.settings.get("bool", "sticky")
self.minimized = self.settings.get("bool", "minimized") self.minimized = self.settings.get("bool", "minimized")
@ -495,11 +500,10 @@ class pluginclass(object):
return True return True
except: except:
pass pass
return False return False
def onShowMenu(self): def onShowMenu(self):
if len(self.favorites): if self.favorites:
if self.defaultTab == -1: if self.defaultTab == -1:
self.changeTab(self.lastActiveTab) self.changeTab(self.lastActiveTab)
else: else:
@ -523,7 +527,6 @@ class pluginclass(object):
self.focusSearchEntry(clear) self.focusSearchEntry(clear)
self.lastActiveTab = tabNum self.lastActiveTab = tabNum
def Todos(self): def Todos(self):
self.searchEntry.connect("popup-menu", self.blockOnPopup) self.searchEntry.connect("popup-menu", self.blockOnPopup)
self.searchEntry.connect("button-press-event", self.blockOnRightPress) self.searchEntry.connect("button-press-event", self.blockOnRightPress)
@ -557,9 +560,7 @@ class pluginclass(object):
self.stopBuildingButtonList = True self.stopBuildingButtonList = True
GLib.timeout_add(100, self.buildButtonList) GLib.timeout_add(100, self.buildButtonList)
return return
self.stopBuildingButtonList = False self.stopBuildingButtonList = False
self.updateBoxes(False) self.updateBoxes(False)
def categoryBtnFocus(self, widget, event, category): def categoryBtnFocus(self, widget, event, category):
@ -577,60 +578,33 @@ class pluginclass(object):
GLib.source_remove(self.filterTimer) GLib.source_remove(self.filterTimer)
self.filterTimer = None self.filterTimer = None
def add_suggestion(self, icon=None, label=None, tooltip=None, callback=None, *args):
if icon:
item = SuggestionButton(icon, self.iconSize, label)
item.connect("clicked", callback, *args)
if tooltip:
item.set_tooltip_text(tooltip)
else:
item = Gtk.SeparatorMenuItem()
item.show_all()
self.applicationsBox.add(item)
self.suggestions.append(item)
def add_search_suggestions(self, text): def add_search_suggestions(self, text):
text = "<b>%s</b>" % cgi.escape(text)
text = "<b>%s</b>" % text
if self.enableInternetSearch: if self.enableInternetSearch:
suggestionButton = SuggestionButton("list-add", self.iconSize, "") self.add_suggestion("/usr/lib/linuxmint/mintMenu/search_engines/ddg.svg", _("Search DuckDuckGo for %s") % text, None, self.search_ddg)
suggestionButton.connect("clicked", self.search_ddg) self.add_suggestion("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.svg", _("Search Wikipedia for %s") % text, None, self.search_wikipedia)
suggestionButton.set_text(_("Search DuckDuckGo for %s") % text) self.add_suggestion()
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/ddg.png")
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
suggestionButton = SuggestionButton("list-add", self.iconSize, "") self.add_suggestion("accessories-dictionary", _("Lookup %s in Dictionary") % text, None, self.search_dictionary)
suggestionButton.connect("clicked", self.search_wikipedia) self.add_suggestion("edit-find", _("Search Computer for %s") % text, None, self.Search)
suggestionButton.set_text(_("Search Wikipedia for %s") % text)
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.png")
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
separator = Gtk.EventBox() self.applicationsBox.get_children()[-1].grab_focus()
separator.add(Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL))
separator.set_visible_window(False)
separator.set_size_request(-1, 20)
separator.type = "separator"
separator.show_all()
self.applicationsBox.add(separator)
self.suggestions.append(separator)
suggestionButton = SuggestionButton("list-add", self.iconSize, "")
suggestionButton.connect("clicked", self.search_dictionary)
suggestionButton.set_text(_("Lookup %s in Dictionary") % text)
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/dictionary.png")
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
suggestionButton = SuggestionButton("edit-find", self.iconSize, "")
suggestionButton.connect("clicked", self.Search)
suggestionButton.set_text(_("Search Computer for %s") % text)
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
#self.last_separator = Gtk.EventBox()
#self.last_separator.add(Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL))
#self.last_separator.set_size_request(-1, 20)
#self.last_separator.type = "separator"
#self.mintMenuWin.SetPaneColors([ self.last_separator])
#self.last_separator.show_all()
#self.applicationsBox.add(self.last_separator)
#self.suggestions.append(self.last_separator)
def add_apt_filter_results(self, keyword): def add_apt_filter_results(self, keyword):
try: try:
# Wait to see if the keyword has changed.. before doing anything # Wait to see if the keyword has changed.. before doing anything
current_keyword = keyword
current_keyword = self.searchEntry.get_text() current_keyword = self.searchEntry.get_text()
if keyword != current_keyword: if keyword != current_keyword:
return return
@ -638,18 +612,17 @@ class pluginclass(object):
found_in_name = [] found_in_name = []
found_elsewhere = [] found_elsewhere = []
keywords = keyword.split(" ") keywords = keyword.split(" ")
command = "cat %(home)s/.linuxmint/mintMenu/apt.cache" % {'home':home} path = os.path.join(home, ".linuxmint/mintMenu/apt.cache")
for word in keywords: if not os.path.isfile(path):
command = "%(command)s | grep %(word)s" % {'command':command, 'word':pipes.quote(word)} return
pkgs = commands.getoutput(command) with open(path) as aptcache:
pkgs = pkgs.split("\n") pkgs = [line for line in aptcache.readlines() if all(keyword in line for keyword in keywords)]
num_pkg_found = 0
for pkg in pkgs: for pkg in pkgs:
values = string.split(pkg, "###") values = pkg.split("###")
if len(values) == 4: if len(values) == 4:
status = values[0] status = values[0]
if status == "ERROR": if status == "ERROR":
print "Could not refresh APT cache" print("Could not refresh APT cache")
elif status == "CACHE": elif status == "CACHE":
name = values[1] name = values[1]
summary = values[2] summary = values[2]
@ -667,21 +640,12 @@ class pluginclass(object):
found_in_name.append(package) found_in_name.append(package)
else: else:
found_elsewhere.append(package) found_elsewhere.append(package)
num_pkg_found+=1
else: else:
print "Invalid status code: " + status print("Invalid status code:",status)
found_packages.extend(found_in_name) found_packages.extend(found_in_name)
found_packages.extend(found_elsewhere) found_packages.extend(found_elsewhere)
if keyword == self.searchEntry.get_text() and len(found_packages) > 0: if keyword == self.searchEntry.get_text() and len(found_packages) > 0:
last_separator = Gtk.EventBox() self.add_suggestion()
last_separator.add(Gtk.HSeparator())
last_separator.set_visible_window(False)
last_separator.set_size_request(-1, 20)
last_separator.type = "separator"
last_separator.show_all()
self.applicationsBox.add(last_separator)
self.suggestions.append(last_separator)
#Reduce the number of results to 10 max... it takes a HUGE amount of time to add the GTK box in the menu otherwise.. #Reduce the number of results to 10 max... it takes a HUGE amount of time to add the GTK box in the menu otherwise..
if len(found_packages) > 10: if len(found_packages) > 10:
found_packages = found_packages[:10] found_packages = found_packages[:10]
@ -690,13 +654,10 @@ class pluginclass(object):
for word in keywords: for word in keywords:
if word != "": if word != "":
name = name.replace(word, "<b>%s</b>" % word) name = name.replace(word, "<b>%s</b>" % word)
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") self.add_suggestion(Gtk.STOCK_ADD,
suggestionButton.connect("clicked", self.apturl_install, pkg.name) _("Install package '%s'") % name,
suggestionButton.set_text(_("Install package '%s'") % name) "%s\n\n%s\n\n%s" % (pkg.name, pkg.summary, pkg.description),
suggestionButton.set_tooltip_text("%s\n\n%s\n\n%s" % (pkg.name, pkg.summary, pkg.description)) self.apturl_install, pkg.name)
suggestionButton.set_icon_size(self.iconSize)
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
#if cache != self.current_results: #if cache != self.current_results:
# self.current_results.append(pkg) # self.current_results.append(pkg)
@ -708,9 +669,8 @@ class pluginclass(object):
# finally: # finally:
# gtk.gdk.threads_leave() # gtk.gdk.threads_leave()
except Exception, detail: except Exception as e:
print detail print(e)
def add_apt_filter_results_sync(self, cache, keyword): def add_apt_filter_results_sync(self, cache, keyword):
try: try:
@ -729,34 +689,24 @@ class pluginclass(object):
found_packages.append(pkg) found_packages.append(pkg)
if len(found_packages) > 0: if len(found_packages) > 0:
last_separator = Gtk.EventBox() self.add_suggestion()
last_separator.add(Gtk.HSeparator())
last_separator.set_visible_window(False)
last_separator.set_size_request(-1, 20)
last_separator.type = "separator"
last_separator.show_all()
self.applicationsBox.add(last_separator)
self.suggestions.append(last_separator)
for pkg in found_packages: for pkg in found_packages:
name = pkg.name name = pkg.name
for word in keywords: for word in keywords:
if word != "": if word != "":
name = name.replace(word, "<b>%s</b>" % word) name = name.replace(word, "<b>%s</b>" % word)
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") self.add_suggestion(Gtk.STOCK_ADD,
suggestionButton.connect("clicked", self.apturl_install, pkg.name) _("Install package '%s'") % name,
suggestionButton.set_text(_("Install package '%s'") % name) "%s\n\n%s\n\n%s" % (pkg.name, pkg.summary, pkg.description),
suggestionButton.set_tooltip_text("%s\n\n%s\n\n%s" % (pkg.name, pkg.summary.capitalize(), pkg.description)) self.apturl_install, pkg.name)
suggestionButton.set_icon_size(self.iconSize)
self.applicationsBox.add(suggestionButton)
self.suggestions.append(suggestionButton)
#if len(found_packages) == 0: #if len(found_packages) == 0:
# self.applicationsBox.remove(self.last_separator) # self.applicationsBox.remove(self.last_separator)
# self.suggestions.remove(self.last_separator) # self.suggestions.remove(self.last_separator)
except Exception, detail: except Exception as e:
print detail print(e)
def Filter(self, widget, category = None): def Filter(self, widget, category = None):
self.filterTimer = None self.filterTimer = None
@ -854,7 +804,8 @@ class pluginclass(object):
return False return False
def favPopup(self, widget, event): def favPopup(self, widget, event):
if event.button == 3: if not event.button == 3:
return
if event.y > widget.get_allocation().height / 2: if event.y > widget.get_allocation().height / 2:
insertBefore = False insertBefore = False
else: else:
@ -865,7 +816,6 @@ class pluginclass(object):
mTree.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK | mTree.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK |
Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK) Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK)
#i18n #i18n
desktopMenuItem = Gtk.MenuItem(_("Add to desktop")) desktopMenuItem = Gtk.MenuItem(_("Add to desktop"))
panelMenuItem = Gtk.MenuItem(_("Add to panel")) panelMenuItem = Gtk.MenuItem(_("Add to panel"))
separator1 = Gtk.SeparatorMenuItem() separator1 = Gtk.SeparatorMenuItem()
@ -906,11 +856,6 @@ class pluginclass(object):
mTree.append(removeFromFavMenuItem) mTree.append(removeFromFavMenuItem)
mTree.append(separator4) mTree.append(separator4)
mTree.append(propsMenuItem) mTree.append(propsMenuItem)
mTree.show_all()
self.mintMenuWin.stopHiding()
mTree.attach_to_widget(widget, None)
mTree.popup(None, None, None, None, event.button, event.time)
else: else:
mTree = Gtk.Menu() mTree = Gtk.Menu()
mTree.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK | mTree.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK |
@ -923,17 +868,21 @@ class pluginclass(object):
mTree.append(removeMenuItem) mTree.append(removeMenuItem)
mTree.append(insertSpaceMenuItem) mTree.append(insertSpaceMenuItem)
mTree.append(insertSeparatorMenuItem) mTree.append(insertSeparatorMenuItem)
mTree.show_all()
removeMenuItem.connect("activate", self.onFavoritesRemove, widget) removeMenuItem.connect("activate", self.onFavoritesRemove, widget)
insertSpaceMenuItem.connect("activate", self.onFavoritesInsertSpace, widget, insertBefore) insertSpaceMenuItem.connect("activate", self.onFavoritesInsertSpace, widget, insertBefore)
insertSeparatorMenuItem.connect("activate", self.onFavoritesInsertSeparator, widget, insertBefore) insertSeparatorMenuItem.connect("activate", self.onFavoritesInsertSeparator, widget, insertBefore)
mTree.show_all()
self.mintMenuWin.stopHiding() self.mintMenuWin.stopHiding()
mTree.attach_to_widget(widget, None) mTree.attach_to_widget(widget, None)
if (Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION) >= (3, 22):
mTree.popup_at_pointer(event)
else:
mTree.popup(None, None, None, None, event.button, event.time) mTree.popup(None, None, None, None, event.button, event.time)
def menuPopup(self, widget, event): def menuPopup(self, widget, event):
if event.button == 3: if not event.button == 3:
return
mTree = Gtk.Menu() mTree = Gtk.Menu()
#i18n #i18n
desktopMenuItem = Gtk.MenuItem(_("Add to desktop")) desktopMenuItem = Gtk.MenuItem(_("Add to desktop"))
@ -955,24 +904,18 @@ class pluginclass(object):
mTree.append(favoriteMenuItem) mTree.append(favoriteMenuItem)
mTree.append(startupMenuItem) mTree.append(startupMenuItem)
mTree.append(separator2) mTree.append(separator2)
mTree.append(launchMenuItem) mTree.append(launchMenuItem)
mTree.append(uninstallMenuItem) mTree.append(uninstallMenuItem)
if home in widget.desktopFile: if home in widget.desktopFile:
mTree.append(deleteMenuItem) mTree.append(deleteMenuItem)
deleteMenuItem.connect("activate", self.delete_from_menu, widget) deleteMenuItem.connect("activate", self.delete_from_menu, widget)
mTree.append(separator3) mTree.append(separator3)
mTree.append(propsMenuItem) mTree.append(propsMenuItem)
mTree.show_all() mTree.show_all()
desktopMenuItem.connect("activate", self.add_to_desktop, widget) desktopMenuItem.connect("activate", self.add_to_desktop, widget)
panelMenuItem.connect("activate", self.add_to_panel, widget) panelMenuItem.connect("activate", self.add_to_panel, widget)
launchMenuItem.connect("activate", self.onLaunchApp, widget) launchMenuItem.connect("activate", self.onLaunchApp, widget)
propsMenuItem.connect("activate", self.onPropsApp, widget) propsMenuItem.connect("activate", self.onPropsApp, widget)
uninstallMenuItem.connect("activate", self.onUninstallApp, widget) uninstallMenuItem.connect("activate", self.onUninstallApp, widget)
@ -995,81 +938,37 @@ class pluginclass(object):
mTree.attach_to_widget(widget, None) mTree.attach_to_widget(widget, None)
mTree.popup(None, None, None, None, event.button, event.time) mTree.popup(None, None, None, None, event.button, event.time)
def searchPopup(self, widget, event):
def add_menu_item(icon=None, text=None, callback=None):
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
if icon == None:
menuItem = Gtk.SeparatorMenuItem()
else:
if icon.startswith("/"):
icon = Gtk.Image.new_from_pixbuf(GdkPixbuf.Pixbuf.new_from_file_at_size(icon, 16, 16))
else:
icon = Gtk.Image.new_from_icon_name(icon, Gtk.IconSize.SMALL_TOOLBAR)
box.add(icon)
box.pack_start(Gtk.Label.new(text), False, False, 5)
menuItem = Gtk.MenuItem()
menuItem.connect("activate", callback)
menuItem.add(box)
menu.append(menuItem)
def searchPopup(self, widget=None, event=None):
menu = Gtk.Menu() menu = Gtk.Menu()
if self.enableInternetSearch: if self.enableInternetSearch:
add_menu_item('/usr/lib/linuxmint/mintMenu/search_engines/ddg.svg', _("Search DuckDuckGo"), self.search_ddg)
add_menu_item('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.svg', _("Search Wikipedia"), self.search_wikipedia)
menuItem = Gtk.ImageMenuItem(_("Search DuckDuckGo")) add_menu_item('accessories-dictionary', _("Search Dictionary"), self.search_dictionary)
img = Gtk.Image() add_menu_item("edit-find", _("Search Computer"), self.Search)
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/ddg.png') add_menu_item()
menuItem.set_image(img) add_menu_item('/usr/lib/linuxmint/mintMenu/search_engines/software.png', _("Find Software"), self.search_mint_software)
menuItem.connect("activate", self.search_ddg) add_menu_item('/usr/lib/linuxmint/mintMenu/search_engines/tutorials.png', _("Find Tutorials"), self.search_mint_tutorials)
menu.append(menuItem) add_menu_item('/usr/lib/linuxmint/mintMenu/search_engines/hardware.png', _("Find Hardware"), self.search_mint_hardware)
add_menu_item('/usr/lib/linuxmint/mintMenu/search_engines/ideas.png', _("Find Ideas"), self.search_mint_ideas)
menuItem = Gtk.ImageMenuItem(_("Search Wikipedia")) add_menu_item('/usr/lib/linuxmint/mintMenu/search_engines/users.png', _("Find Users"), self.search_mint_users)
img = Gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_wikipedia)
menu.append(menuItem)
menuItem = Gtk.SeparatorMenuItem()
menu.append(menuItem)
menuItem = Gtk.ImageMenuItem(_("Lookup Dictionary"))
img = Gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/dictionary.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_dictionary)
menu.append(menuItem)
menuItem = Gtk.ImageMenuItem(_("Search Computer"))
img = Gtk.Image()
img.set_from_icon_name("edit-find", Gtk.IconSize.INVALID)
img.set_pixel_size(self.iconSize)
menuItem.set_image(img)
menuItem.connect("activate", self.Search)
menu.append(menuItem)
menuItem = Gtk.SeparatorMenuItem()
menu.append(menuItem)
menuItem = Gtk.ImageMenuItem(_("Find Software"))
img = Gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/software.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_software)
menu.append(menuItem)
menuItem = Gtk.ImageMenuItem(_("Find Tutorials"))
img = Gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/tutorials.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_tutorials)
menu.append(menuItem)
menuItem = Gtk.ImageMenuItem(_("Find Hardware"))
img = Gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/hardware.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_hardware)
menu.append(menuItem)
menuItem =Gtk.ImageMenuItem(_("Find Ideas"))
img = Gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/ideas.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_ideas)
menu.append(menuItem)
menuItem = Gtk.ImageMenuItem(_("Find Users"))
img = Gtk.Image()
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/users.png')
menuItem.set_image(img)
menuItem.connect("activate", self.search_mint_users)
menu.append(menuItem)
menu.show_all() menu.show_all()
@ -1077,68 +976,55 @@ class pluginclass(object):
menu.attach_to_widget(self.searchButton, None) menu.attach_to_widget(self.searchButton, None)
menu.popup(None, None, None, None, event.button, event.time) menu.popup(None, None, None, None, event.button, event.time)
#menu.reposition()
#menu.reposition()
#self.mintMenuWin.grab()
self.focusSearchEntry(clear = False) self.focusSearchEntry(clear = False)
return True
# 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): def search_ddg(self, widget):
text = self.searchEntry.get_text() text = urllib.quote_plus(self.searchEntry.get_text().strip())
text = text.replace(" ", "+") subprocess.Popen(["xdg-open", "https://duckduckgo.com/?q=%s" % text])
os.system("xdg-open \"https://duckduckgo.com/?q=%s&t=lm&ia=web\" &" % text) self.mintMenuWin.hide()
def search_google(self, widget):
text = urllib.quote_plus(self.searchEntry.get_text().strip())
subprocess.Popen(["xdg-open", "https://www.google.com/search?q=%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_wikipedia(self, widget): def search_wikipedia(self, widget):
text = self.searchEntry.get_text() text = urllib.quote_plus(self.searchEntry.get_text().strip())
text = text.replace(" ", "+") subprocess.Popen(["xdg-open", "https://en.wikipedia.org/wiki/Special:Search?search=%s" % text])
os.system("xdg-open \"https://%s.wikipedia.org/wiki/Special:Search?search=%s\" &" % (self.lang, text))
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_dictionary(self, widget): def search_dictionary(self, widget):
text = self.searchEntry.get_text() text = self.searchEntry.get_text().strip()
os.system("mate-dictionary \"" + text + "\" &") subprocess.Popen(["mate-dictionary", "%s" % text])
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_tutorials(self, widget): def search_mint_tutorials(self, widget):
text = self.searchEntry.get_text() text = urllib.quote(self.searchEntry.get_text().strip())
text = text.replace(" ", "%20") subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/tutorial/search/0/%s" % text])
os.system("xdg-open \"https://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &")
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_ideas(self, widget): def search_mint_ideas(self, widget):
text = self.searchEntry.get_text() text = urllib.quote(self.searchEntry.get_text().strip())
text = text.replace(" ", "%20") subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/idea/search/0/%s" % text])
os.system("xdg-open \"https://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &")
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_users(self, widget): def search_mint_users(self, widget):
text = self.searchEntry.get_text() text = urllib.quote(self.searchEntry.get_text().strip())
text = text.replace(" ", "%20") subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/user/search/0/%s" % text])
os.system("xdg-open \"https://community.linuxmint.com/index.php/user/search/0/" + text + "\" &")
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_hardware(self, widget): def search_mint_hardware(self, widget):
text = self.searchEntry.get_text() text = urllib.quote(self.searchEntry.get_text().strip())
text = text.replace(" ", "%20") subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/hardware/search/0/%s" % text])
os.system("xdg-open \"https://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &")
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_software(self, widget): def search_mint_software(self, widget):
text = self.searchEntry.get_text() text = urllib.quote(self.searchEntry.get_text())
text = text.replace(" ", "%20") subprocess.Popen(["xdg-open", "https://community.linuxmint.com/index.php/software/search/0/%s" % text])
os.system("xdg-open \"https://community.linuxmint.com/index.php/software/search/0/" + text + "\" &")
self.mintMenuWin.hide() self.mintMenuWin.hide()
def add_to_desktop(self, widget, desktopEntry): def add_to_desktop(self, widget, desktopEntry):
os.system("xdg-desktop-icon install --novendor %s" % desktopEntry.desktopFile) subprocess.Popen(["xdg-desktop-icon", "install", "--novendor", desktopEntry.desktopFile])
def add_to_panel(self, widget, desktopEntry): def add_to_panel(self, widget, desktopEntry):
self.get_panel() self.get_panel()
@ -1164,22 +1050,20 @@ class pluginclass(object):
def delete_from_menu(self, widget, desktopEntry): def delete_from_menu(self, widget, desktopEntry):
try: try:
os.system("rm \"%s\" &" % desktopEntry.desktopFile) os.unlink(desktopEntry.desktopFile)
except Exception, detail: except Exception as e:
print detail print(e)
def onLaunchApp(self, menu, widget): def onLaunchApp(self, menu, widget):
widget.execute() widget.execute()
self.mintMenuWin.hide() self.mintMenuWin.hide()
def onPropsApp(self, menu, widget): def onPropsApp(self, menu, widget):
newFileFlag = False newFileFlag = False
sysPaths = get_system_item_paths() sysPaths = get_system_item_paths()
for path in sysPaths: for path in sysPaths:
path = os.path.join(path, "applications") path = os.path.join(path, "applications")
relPath = os.path.relpath(widget.desktopFile, path) relPath = os.path.relpath(widget.desktopFile, path)
if widget.desktopFile == os.path.join(path, relPath): if widget.desktopFile == os.path.join(path, relPath):
@ -1205,23 +1089,18 @@ class pluginclass(object):
subprocess.Popen.communicate(editProcess) subprocess.Popen.communicate(editProcess)
if newFileFlag: if newFileFlag:
if filecmp.cmp(widget.desktopFile, filePath): if filecmp.cmp(widget.desktopFile, filePath):
os.remove(filePath) os.remove(filePath)
else: else:
favoriteChange = 0 favoriteChange = 0
for favorite in self.favorites: for favorite in self.favorites:
if favorite.type == "location": if favorite.type == "location":
if favorite.desktopFile == widget.desktopFile: if favorite.desktopFile == widget.desktopFile:
favorite.desktopFile = filePath favorite.desktopFile = filePath
favoriteChange = 1 favoriteChange = 1
if favoriteChange == 1: if favoriteChange == 1:
self.favoritesSave() self.favoritesSave()
self.buildFavorites() self.buildFavorites()
else: else:
self.buildFavorites() self.buildFavorites()
@ -1280,9 +1159,6 @@ class pluginclass(object):
def do_plugin(self): def do_plugin(self):
self.Todos() self.Todos()
self.buildFavorites() self.buildFavorites()
# TODO all this runs whether the plugin is enabled or not
# print "applications.do_plugin calling buildRecentApps"
# RecentHelper.buildRecentApps()
# Scroll button into view # Scroll button into view
def scrollItemIntoView(self, widget, event = None): def scrollItemIntoView(self, widget, event = None):
@ -1322,7 +1198,7 @@ class pluginclass(object):
try: try:
ButtonIcon = None ButtonIcon = None
# For Folders and Network Shares # For Folders and Network Shares
location = string.join(location.split("%20")) location = "".join(location.split("%20"))
if location.startswith("file"): if location.startswith("file"):
ButtonIcon = "mate-fs-directory" ButtonIcon = "mate-fs-directory"
@ -1330,6 +1206,7 @@ class pluginclass(object):
if location.startswith("smb") or location.startswith("ssh") or location.startswith("network"): if location.startswith("smb") or location.startswith("ssh") or location.startswith("network"):
ButtonIcon = "mate-fs-network" ButtonIcon = "mate-fs-network"
# TODO: Do we still need this?
#For Special locations #For Special locations
if location == "x-nautilus-desktop:///computer": if location == "x-nautilus-desktop:///computer":
location = "/usr/share/applications/nautilus-computer.desktop" location = "/usr/share/applications/nautilus-computer.desktop"
@ -1359,8 +1236,8 @@ class pluginclass(object):
self.mintMenuWin.setTooltip(favButton, favButton.getTooltip()) self.mintMenuWin.setTooltip(favButton, favButton.getTooltip())
favButton.type = "location" favButton.type = "location"
return favButton return favButton
except Exception, e: except Exception as e:
print u"File in favorites not found: '" + location + "'", e print("File in favorites not found: '%s': %s" % (location, e))
return None return None
@ -1371,7 +1248,7 @@ class pluginclass(object):
os.system("mkdir -p " + path) os.system("mkdir -p " + path)
os.system("cp /usr/lib/linuxmint/mintMenu/applications.list " + path) os.system("cp /usr/lib/linuxmint/mintMenu/applications.list " + path)
applicationsList = open(path).readlines() # TODO py3 encoding="UTF-8" applicationsList = open(path).readlines()
self.favorites = [] self.favorites = []
@ -1395,7 +1272,6 @@ class pluginclass(object):
else: else:
favButton = None favButton = None
if favButton: if favButton:
favButton.position = position favButton.position = position
self.favorites.append(favButton) self.favorites.append(favButton)
@ -1407,8 +1283,8 @@ class pluginclass(object):
position += 1 position += 1
self.favoritesSave() self.favoritesSave()
except Exception, e: except Exception as e:
print e print(e)
def favoritesPositionOnGrid(self, favorite): def favoritesPositionOnGrid(self, favorite):
row = 0 row = 0
@ -1423,7 +1299,6 @@ class pluginclass(object):
if fav.type == "separator" or fav.type == "space": if fav.type == "separator" or fav.type == "space":
row += 1 row += 1
col = 0 col = 0
if col >= self.favCols: if col >= self.favCols:
row += 1 row += 1
col = 0 col = 0
@ -1497,7 +1372,7 @@ class pluginclass(object):
appListFile.write("location:" + favorite.desktopFile + "\n") appListFile.write("location:" + favorite.desktopFile + "\n")
else: else:
appListFile.write(favorite.type + "\n") appListFile.write(favorite.type + "\n")
except Exception, e: except Exception as e:
msgDlg = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, 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__() + ")") _("Couldn't save favorites. Check if you have write access to ~/.linuxmint/mintMenu")+"\n(" + e.__str__() + ")")
msgDlg.run() msgDlg.run()
@ -1507,33 +1382,33 @@ class pluginclass(object):
for fav in self.favorites: for fav in self.favorites:
if fav.type == "location" and fav.desktopFile == location: if fav.type == "location" and fav.desktopFile == location:
return True return True
return False return False
def on_drag_data_get(self, widget, context, selection, info, time): def on_drag_data_get(self, widget, context, selection, info, time):
if info == self.TARGET_TYPE_FAV: if info == self.TARGET_TYPE_FAV:
self.drag_origin = widget.position self.drag_origin = widget.position
# FIXME: This fails in python3:
selection.set(selection.get_target(), 8, str(widget.position)) selection.set(selection.get_target(), 8, str(widget.position))
def on_drag_data_received(self, widget, context, x, y, selection, info, time): def on_drag_data_received(self, widget, context, x, y, selection, info, time):
if info == self.TARGET_TYPE_FAV: if info == self.TARGET_TYPE_FAV:
self.favoritesReorder(int(selection.get_data()), widget.position) self.favoritesReorder(int(selection.get_data()), widget.position)
def on_icon_theme_changed(self, theme): # def on_icon_theme_changed(self, theme):
print "on_icon_theme_changed" # print("on_icon_theme_changed")
self.menuChanged(0, 0) # self.menuChanged(0, 0)
def menuChanged(self, x, y): def menuChanged(self, x, y):
print("menuChanged") # print("menuChanged")
# wait 1s, to avoid building the menu multiple times concurrently # wait 1s, to avoid building the menu multiple times concurrently
if self.menuChangedTimer: if self.menuChangedTimer:
GLib.source_remove(self.menuChangedTimer) GLib.source_remove(self.menuChangedTimer)
self.menuChangedTimer = GLib.timeout_add(1000, self.updateBoxes, True) self.menuChangedTimer = GLib.timeout_add(1000, self.updateBoxes, True)
@print_timing #@print_timing
def updateBoxes(self, menu_has_changed): def updateBoxes(self, menu_has_changed):
print("updateBoxes") # print("updateBoxes")
# FIXME: This is really bad! # FIXME: This is really bad!
if self.rebuildLock: if self.rebuildLock:
return return
@ -1583,8 +1458,8 @@ class pluginclass(object):
self.categoryList.remove(item) self.categoryList.remove(item)
button.destroy() button.destroy()
del item del item
except Exception, e: except Exception as e:
print e print(e)
if addedCategories: if addedCategories:
sortedCategoryList = [] sortedCategoryList = []
@ -1592,10 +1467,10 @@ class pluginclass(object):
try: try:
self.categoriesBox.remove(item["button"]) self.categoriesBox.remove(item["button"])
sortedCategoryList.append((str(item["index"]) + item["name"], item["button"])) sortedCategoryList.append((str(item["index"]) + item["name"], item["button"]))
except Exception, e: except Exception as e:
print e print(e)
# Create new category buttons and add the to the list # Create new category buttons and add them to the list
for item in addedCategories: for item in addedCategories:
try: try:
item["button"] = CategoryButton(item["icon"], categoryIconSize, [item["name"]], item["filter"]) item["button"] = CategoryButton(item["icon"], categoryIconSize, [item["name"]], item["filter"])
@ -1614,16 +1489,16 @@ class pluginclass(object):
self.categoryList.append(item) self.categoryList.append(item)
sortedCategoryList.append((str(item["index"]) + item["name"], item["button"])) sortedCategoryList.append((str(item["index"]) + item["name"], item["button"]))
except Exception, e: except Exception as e:
print e print(e)
sortedCategoryList.sort() sortedCategoryList.sort()
for item in sortedCategoryList: for item in sortedCategoryList:
try: try:
self.categoriesBox.pack_start(item[1], False, False, 0) self.categoriesBox.pack_start(item[1], False, False, 0)
except Exception, e: except Exception as e:
print e print(e)
# Find added and removed applications add update the application list # Find added and removed applications add update the application list
newApplicationList = self.buildApplicationList() newApplicationList = self.buildApplicationList()
@ -1693,8 +1568,8 @@ class pluginclass(object):
button.hide() button.hide()
else: else:
launcherNames.append(launcherName) launcherNames.append(launcherName)
except Exception, e: except Exception as e:
print e print(e)
self.rebuildLock = False self.rebuildLock = False
@ -1721,7 +1596,6 @@ class pluginclass(object):
# Build a list containing the DesktopEntry object and the category of each application in the menu # Build a list containing the DesktopEntry object and the category of each application in the menu
def buildApplicationList(self): def buildApplicationList(self):
newApplicationsList = [] newApplicationsList = []
def find_applications_recursively(app_list, directory, catName): def find_applications_recursively(app_list, directory, catName):

View File

@ -7,10 +7,9 @@ import xdg.DesktopEntry
import xdg.Menu import xdg.Menu
import gi import gi
gi.require_version('MateDesktop', '2.0') gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib gi.require_version("MateDesktop", "2.0")
from gi.repository import Pango from gi.repository import Gtk, Gdk, GdkPixbuf, GLib, GObject, Pango, MateDesktop
from gi.repository import GObject
from plugins.execute import Execute from plugins.execute import Execute
from plugins.filemonitor import monitor as filemonitor from plugins.filemonitor import monitor as filemonitor
@ -37,7 +36,7 @@ class IconManager(GObject.GObject):
#self.themes = map( createTheme, [d for d in os.listdir("/usr/share/icons") if os.path.isdir(os.path.join("/usr/share/icons", d))]) #self.themes = map( createTheme, [d for d in os.listdir("/usr/share/icons") if os.path.isdir(os.path.join("/usr/share/icons", d))])
self.defaultTheme = Gtk.IconTheme.get_default() self.defaultTheme = Gtk.IconTheme.get_default()
defaultKdeTheme = createTheme("kde.default") #defaultKdeTheme = createTheme("kde.default")
# Setup and clean up the temp icon dir # Setup and clean up the temp icon dir
configDir = GLib.get_user_config_dir() configDir = GLib.get_user_config_dir()
@ -49,19 +48,17 @@ class IconManager(GObject.GObject):
os.remove(os.path.join(self.iconDir, fn)) os.remove(os.path.join(self.iconDir, fn))
self.defaultTheme.append_search_path(self.iconDir) self.defaultTheme.append_search_path(self.iconDir)
# Themes with the same content as the default them aren't needed # Themes with the same content as the default them aren't needed
#self.themes = [theme for theme in self.themes if theme.list_icons() != defaultTheme.list_icons()] #self.themes = [theme for theme in self.themes if theme.list_icons() != defaultTheme.list_icons()]
self.themes = [self.defaultTheme, defaultKdeTheme] #self.themes = [self.defaultTheme, defaultKdeTheme]
self.themes = [self.defaultTheme]
# Listen for changes in the themes # Listen for changes in the themes
for theme in self.themes: # for theme in self.themes:
theme.connect("changed", self.themeChanged) # theme.connect("changed", self.themeChanged)
def getIcon(self, iconName, iconSize): def getIcon(self, iconName, iconSize):
if not iconName: if not iconName:
return None return None
@ -89,22 +86,12 @@ class IconManager(GObject.GObject):
shutil.copyfile(iconFileName, os.path.join(self.iconDir, tmpIconName)) shutil.copyfile(iconFileName, os.path.join(self.iconDir, tmpIconName))
self.defaultTheme.append_search_path(self.iconDir) self.defaultTheme.append_search_path(self.iconDir)
image = Gtk.Image() image = Gtk.Image.new_from_icon_name(realIconName, Gtk.IconSize.DND)
icon_found = False
for theme in self.themes:
if theme.lookup_icon(realIconName, 0, Gtk.IconLookupFlags.FORCE_REGULAR):
icon_found = True
break
if icon_found:
image.set_from_icon_name(realIconName, Gtk.IconSize.DND)
image.set_pixel_size(iconSize) image.set_pixel_size(iconSize)
else:
image = None
return image return image
except Exception, e:
print "Exception " + e.__class__.__name__ + ": " + e.message except Exception as e:
print("Exception %s: %s" % (e.__class__.__name__, e))
return None return None
def themeChanged(self, theme): def themeChanged(self, theme):
@ -128,14 +115,11 @@ class easyButton(Gtk.Button):
HBox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) HBox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.labelBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2) self.labelBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
self.buttonImage = self.getIcon(self.iconSize)
if not self.buttonImage:
self.buttonImage = Gtk.Image() self.buttonImage = Gtk.Image()
icon = self.getIcon(self.iconSize) self.buttonImage.set_size_request(self.iconSize, self.iconSize)
if icon:
self.buttonImage = icon
else:
#[iW, iH] = iconManager.getIconSize(self.iconSize)
self.buttonImage.set_size_request(self.iconSize, self.iconSize )
self.image_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) self.image_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.image_box.pack_start(self.buttonImage, False, False, 5) self.image_box.pack_start(self.buttonImage, False, False, 5)
self.image_box.show_all() self.image_box.show_all()
@ -158,7 +142,7 @@ class easyButton(Gtk.Button):
self.connectSelf("destroy", self.onDestroy) self.connectSelf("destroy", self.onDestroy)
self.connect("released", self.onRelease) self.connect("released", self.onRelease)
# Reload icons when the theme changed # Reload icons when the theme changed
self.themeChangedHandlerId = iconManager.connect("changed", self.themeChanged) # self.themeChangedHandlerId = iconManager.connect("changed", self.themeChanged)
def connectSelf(self, event, callback): def connectSelf(self, event, callback):
self.connections.append(self.connect(event, callback)) self.connections.append(self.connect(event, callback))
@ -168,12 +152,11 @@ class easyButton(Gtk.Button):
def onDestroy(self, widget): def onDestroy(self, widget):
self.buttonImage.clear() self.buttonImage.clear()
iconManager.disconnect(self.themeChangedHandlerId) # iconManager.disconnect(self.themeChangedHandlerId)
for connection in self.connections: for connection in self.connections:
self.disconnect(connection) self.disconnect(connection)
del self.connections del self.connections
def addLabel(self, text, styles = None): def addLabel(self, text, styles = None):
label = Gtk.Label() label = Gtk.Label()
if "<b>" in text or "<span" in text: if "<b>" in text or "<span" in text:
@ -193,15 +176,10 @@ class easyButton(Gtk.Button):
label.show() label.show()
self.labelBox.pack_start(label , True, True, 0) self.labelBox.pack_start(label , True, True, 0)
def getIcon(self, iconSize): def getIcon(self, iconSize):
if not self.iconName: if not self.iconName:
return None return None
icon = iconManager.getIcon(self.iconName, iconSize) icon = iconManager.getIcon(self.iconName, iconSize)
if icon is None:
icon = iconManager.getIcon("application-default-icon", iconSize)
return icon return icon
def setIcon(self, iconName): def setIcon(self, iconName):
@ -248,7 +226,6 @@ class ApplicationLauncher(easyButton):
desktopFile = desktopItem.filename desktopFile = desktopItem.filename
self.appDirs = [os.path.dirname(desktopItem.filename)] self.appDirs = [os.path.dirname(desktopItem.filename)]
else: else:
# XXX: All menu entries on LM19.1 end here
desktopItem = xdg.DesktopEntry.DesktopEntry(desktopFile) desktopItem = xdg.DesktopEntry.DesktopEntry(desktopFile)
self.appDirs = [os.path.dirname(desktopFile)] self.appDirs = [os.path.dirname(desktopFile)]
@ -260,8 +237,8 @@ class ApplicationLauncher(easyButton):
self.desktopEntryMonitors = [] self.desktopEntryMonitors = []
base = os.path.basename(self.desktopFile) base = os.path.basename(self.desktopFile)
for dir in self.appDirs: for directory in self.appDirs:
self.desktopEntryMonitors.append(filemonitor.addMonitor(os.path.join(dir, base) , self.desktopEntryFileChangedCallback)) self.desktopEntryMonitors.append(filemonitor.addMonitor(os.path.join(directory, base) , self.desktopEntryFileChangedCallback))
easyButton.__init__(self, self.appIconName, iconSize) easyButton.__init__(self, self.appIconName, iconSize)
self.setupLabels() self.setupLabels()
@ -271,11 +248,7 @@ class ApplicationLauncher(easyButton):
targets = (Gtk.TargetEntry.new("text/plain", 0, 100), Gtk.TargetEntry.new("text/uri-list", 0, 101)) targets = (Gtk.TargetEntry.new("text/plain", 0, 100), Gtk.TargetEntry.new("text/uri-list", 0, 101))
self.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, targets, Gdk.DragAction.COPY) self.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, targets, Gdk.DragAction.COPY)
self.drag_source_set_icon_name(self.iconName)
icon = self.getIcon(Gtk.IconSize.DND)
if icon:
iconName, s = icon.get_icon_name()
self.drag_source_set_icon_name(iconName)
self.connectSelf("focus-in-event", self.onFocusIn) self.connectSelf("focus-in-event", self.onFocusIn)
self.connectSelf("focus-out-event", self.onFocusOut) self.connectSelf("focus-out-event", self.onFocusOut)
@ -301,14 +274,14 @@ class ApplicationLauncher(easyButton):
self.appComment = self.appComment.strip() self.appComment = self.appComment.strip()
basename = os.path.basename(self.desktopFile) basename = os.path.basename(self.desktopFile)
self.startupFilePath = os.path.join(os.path.expanduser("~"), ".config", "autostart", basename) self.startupFilePath = os.path.join(os.environ['HOME'], ".config/autostart", basename)
if self.startupMonitorId: if self.startupMonitorId:
filemonitor.removeMonitor(self.startupMonitorId ) filemonitor.removeMonitor(self.startupMonitorId )
if os.path.exists(self.startupFilePath): if os.path.exists(self.startupFilePath):
self.startupMonitorId = filemonitor.addMonitor(self.startupFilePath, self.startupFileChanged) self.startupMonitorId = filemonitor.addMonitor(self.startupFilePath, self.startupFileChanged)
except Exception, e: except Exception as e:
print e print(e)
self.appName = "" self.appName = ""
self.appGenericName = "" self.appGenericName = ""
self.appComment = "" self.appComment = ""
@ -338,7 +311,6 @@ class ApplicationLauncher(easyButton):
if keyw != "" and appName.find(keyw) == -1 and appGenericName.find(keyw) == -1 and appComment.find(keyw) == -1 and appExec.find(keyw) == -1: if keyw != "" and appName.find(keyw) == -1 and appGenericName.find(keyw) == -1 and appComment.find(keyw) == -1 and appExec.find(keyw) == -1:
self.hide() self.hide()
return False return False
self.show() self.show()
return True return True
@ -392,39 +364,39 @@ class ApplicationLauncher(easyButton):
def startupFileChanged(self, *args): def startupFileChanged(self, *args):
self.inStartup = os.path.exists(self.startupFilePath) self.inStartup = os.path.exists(self.startupFilePath)
# def addToStartup(self): def addToStartup(self):
# startupDir = os.path.join(os.path.expanduser("~"), ".config", "autostart") startupDir = os.path.join(os.path.dirname(self.startupFilePath))
# if not os.path.exists(startupDir): if not os.path.exists(startupDir):
# os.makedirs(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 # 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) item = MateDesktop.DesktopItem.new_from_uri(self.startupFilePath, MateDesktop.DesktopItemLoadFlags.ONLY_IF_EXISTS)
# if item: if item:
# r = re.compile("%[A-Za-z]"); r = re.compile("%[A-Za-z]")
# tmp = r.sub("", item.get_string(MateDesktop.DESKTOP_ITEM_EXEC)).strip() tmp = r.sub("", item.get_string(MateDesktop.DESKTOP_ITEM_EXEC)).strip()
# item.set_string(MateDesktop.DESKTOP_ITEM_EXEC, tmp) item.set_string(MateDesktop.DESKTOP_ITEM_EXEC, tmp)
# item.save(self.startupFilePath, 0) item.save(self.startupFilePath, 0)
# def removeFromStartup(self): def removeFromStartup(self):
# if os.path.exists(self.startupFilePath): if os.path.exists(self.startupFilePath):
# os.remove(self.startupFilePath) os.remove(self.startupFilePath)
# def addToFavourites(self): def addToFavourites(self):
# favouritesDir = os.path.join(os.path.expanduser("~"), ".linuxmint", "mintMenu", "applications") favouritesDir = os.path.join(os.environ['HOME'], ".linuxmint/mintMenu/applications")
# if not os.path.exists(favouritesDir): if not os.path.exists(favouritesDir):
# os.makedirs(favouritesDir) os.makedirs(favouritesDir)
# shutil.copyfile(self.desktopFile, self.favouritesFilePath) shutil.copyfile(self.desktopFile, self.favouritesFilePath)
# def removeFromFavourites(self): def removeFromFavourites(self):
# if os.path.exists(self.favouritesFilePath): if os.path.exists(self.favouritesFilePath):
# os.remove(self.favouritesFilePath) os.remove(self.favouritesFilePath)
# def isInStartup(self): def isInStartup(self):
# #return self.inStartup #return self.inStartup
# return os.path.exists(self.startupFilePath) return os.path.exists(self.startupFilePath)
def onDestroy(self, widget): def onDestroy(self, widget):
easyButton.onDestroy(self, widget) easyButton.onDestroy(self, widget)
@ -439,10 +411,10 @@ class ApplicationLauncher(easyButton):
def onDesktopEntryFileChanged(self): def onDesktopEntryFileChanged(self):
exists = False exists = False
base = os.path.basename(self.desktopFile) base = os.path.basename(self.desktopFile)
for dir in self.appDirs: for directory in self.appDirs:
if os.path.exists(os.path.join(dir, base)): if os.path.exists(os.path.join(directory, base)):
# print os.path.join(dir, base), self.desktopFile # print os.path.join(dir, base), self.desktopFile
self.loadDesktopEntry(xdg.DesktopEntry.DesktopEntry(os.path.join(dir, base))) self.loadDesktopEntry(xdg.DesktopEntry.DesktopEntry(os.path.join(directory, base)))
for child in self.labelBox: for child in self.labelBox:
child.destroy() child.destroy()
@ -468,7 +440,6 @@ class MenuApplicationLauncher(ApplicationLauncher):
ApplicationLauncher.__init__(self, desktopFile, iconSize) ApplicationLauncher.__init__(self, desktopFile, iconSize)
def filterCategory(self, category): def filterCategory(self, category):
if self.appCategory == category or category == "": if self.appCategory == category or category == "":
self.show() self.show()
@ -491,17 +462,16 @@ class MenuApplicationLauncher(ApplicationLauncher):
#appComment = "<b>%s</b>" % (appComment); #appComment = "<b>%s</b>" % (appComment);
appName = "<b>%s</b>" % appName appName = "<b>%s</b>" % appName
appComment = "<b>%s</b>" % appComment appComment = "<b>%s</b>" % appComment
except Exception, detail: except Exception as e:
print detail print(e)
pass
if self.showComment and self.appComment != "": if self.showComment and self.appComment != "":
if self.iconSize <= 2: if self.iconSize <= 2:
self.addLabel('<span size="small">%s</span>' % appName) self.addLabel('<span size="small">%s</span>\n<span size="x-small">%s</span>' %
self.addLabel('<span size="x-small">%s</span>' % appComment) (appName, appComment))
else: else:
self.addLabel(appName) self.addLabel('%s\n<span size="small">%s</span>' %
self.addLabel('<span size="small">%s</span>' % appComment) (appName, appComment))
else: else:
self.addLabel(appName) self.addLabel(appName)
@ -548,12 +518,10 @@ class FavApplicationLauncher(ApplicationLauncher):
self.setupLabels() self.setupLabels()
class CategoryButton(easyButton): class CategoryButton(easyButton):
def __init__(self, iconName, iconSize, labels , f): def __init__(self, iconName, iconSize, labels , f):
easyButton.__init__(self, iconName, iconSize, labels) easyButton.__init__(self, iconName, iconSize, labels)
self.filter = f self.filter = f
iconManager = IconManager() iconManager = IconManager()

View File

@ -37,6 +37,6 @@ def Execute(cmd , commandCwd=None, desktopFile=None):
os.chdir(cwd) os.chdir(cwd)
os.system(cmd + " &") os.system(cmd + " &")
return True return True
except Exception as err: except Exception as e:
print err print(e)
return False return False

View File

@ -32,7 +32,7 @@ if hasInotify:
mId = self.wm.add_watch(filename, mask, rec = True)[filename] mId = self.wm.add_watch(filename, mask, rec = True)[filename]
if mId >= 0: if mId >= 0:
self.callbacks[mId] = (callback, args) self.callbacks[mId] = (callback, args)
except Exception, detail: except:
mId = 0 mId = 0
return mId return mId
@ -43,7 +43,7 @@ if hasInotify:
def fileChanged(self, event): def fileChanged(self, event):
if event.wd in self.callbacks: if event.wd in self.callbacks:
# print event.path #print event.path
callback = self.callbacks[event.wd] callback = self.callbacks[event.wd]
if callback[1]: if callback[1]:
GLib.idle_add(callback[0], callback[1]) GLib.idle_add(callback[0], callback[1])

View File

@ -1,16 +1,27 @@
#!/usr/bin/python2 #!/usr/bin/python2
import apt, sys import sys
try: import apt_pkg
cache = apt.Cache()
for pkg in cache: if len(sys.argv) != 2:
if not pkg.is_installed: sys.exit(1)
name = pkg.name try:
summary = pkg.candidate.summary.capitalize() apt_pkg.init()
description = pkg.candidate.description.replace("\n", "~~~") cache = apt_pkg.Cache()
print "CACHE" + "###" + str(name) + "###" + str(summary) + "###" + str(description) package_records = apt_pkg.PackageRecords(cache)
except Exception, detail: known_packages = set()
print "ERROR###ERROR###ERROR###ERROR" with open(sys.argv[1], "w") as f:
print detail for pkg in cache.packages:
if pkg.selected_state or not pkg.version_list or pkg.name in known_packages:
continue
name = pkg.name
package_records.lookup(pkg.version_list.pop(0).translated_description.file_list.pop(0))
summary = package_records.short_desc
description = package_records.long_desc.replace(summary + "\n ", "").replace("\n .\n ", "~~~").replace("\n", "")
f.write("CACHE###%s###%s###%s\n" % (name, summary, description))
known_packages.add(name)
except Exception as e:
print("ERROR###ERROR###ERROR###ERROR")
print(e)
sys.exit(1) sys.exit(1)

View File

@ -1,11 +1,10 @@
#!/usr/bin/python2 #!/usr/bin/python2
from glob import glob
import gettext import gettext
import os import os
import string import string
from glob import glob
from urllib import unquote from urllib import unquote
from user import home
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
@ -18,6 +17,7 @@ from plugins.execute import Execute
# i18n # i18n
gettext.install("mintmenu", "/usr/share/linuxmint/locale") gettext.install("mintmenu", "/usr/share/linuxmint/locale")
home = os.environ.get("HOME")
class pluginclass(object): class pluginclass(object):
@ -173,8 +173,8 @@ class pluginclass(object):
tmpdesktopDir = config['XDG_DESKTOP_DIR'] tmpdesktopDir = config['XDG_DESKTOP_DIR']
if os.path.exists(os.path.expandvars(tmpdesktopDir)): if os.path.exists(os.path.expandvars(tmpdesktopDir)):
desktopDir = tmpdesktopDir desktopDir = tmpdesktopDir
except Exception, detail: except Exception as e:
print detail print(e)
Button4 = easyButton("desktop", self.iconsize, [_("Desktop")], -1, -1) Button4 = easyButton("desktop", self.iconsize, [_("Desktop")], -1, -1)
Button4.connect("clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"") Button4.connect("clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"")
Button4.show() Button4.show()

View File

@ -1,14 +1,15 @@
#!/usr/bin/python2 #!/usr/bin/python2
import os import os
import subprocess
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Pango from gi.repository import Gtk
from plugins.execute import Execute
import plugins.recentHelper as RecentHelper import plugins.recentHelper as RecentHelper
from plugins.easygsettings import EasyGSettings from plugins.easygsettings import EasyGSettings
from plugins.execute import Execute
class pluginclass: class pluginclass:
@ -70,7 +71,7 @@ class pluginclass:
self.builder.get_object("ClrBtn").connect("clicked", self.clrmenu) self.builder.get_object("ClrBtn").connect("clicked", self.clrmenu)
def wake(self): def wake(self):
pass return
def destroy(self): def destroy(self):
self.recentBox.destroy() self.recentBox.destroy()
@ -111,8 +112,6 @@ class pluginclass:
def RebuildPlugin(self): def RebuildPlugin(self):
self.content_holder.set_size_request(self.recentw, self.recenth) self.content_holder.set_size_request(self.recentw, self.recenth)
# TODO
print "recent.RebuildPlugin calling recent.DoRecent"
self.DoRecent() self.DoRecent()
def DoRecent(self, *args, **kargs): def DoRecent(self, *args, **kargs):
@ -135,18 +134,13 @@ class pluginclass:
self.AddRecentBtn(Name, self.IconList[loc]) self.AddRecentBtn(Name, self.IconList[loc])
loc = loc + 1 loc = loc + 1
# TODO
print "recent.DoRecent calling RecentHelper.doRecentApps"
RecentHelper.doRecentApps() RecentHelper.doRecentApps()
return True return True
def clrmenu(self, *args, **kargs): def clrmenu(self, *args, **kargs):
self.RecManagerInstance.purge_items() self.RecManagerInstance.purge_items()
# TODO
print "recent.clrmenu calling recent.DoRecent"
self.DoRecent() self.DoRecent()
return
def AddRecentBtn(self, Name, RecentImage): def AddRecentBtn(self, Name, RecentImage):
DispName=os.path.basename(Name) DispName=os.path.basename(Name)
@ -166,7 +160,7 @@ class pluginclass:
Box1.add(ButtonIcon) Box1.add(ButtonIcon)
Label1 = Gtk.Label(DispName) Label1 = Gtk.Label(DispName)
Label1.set_ellipsize(Pango.EllipsizeMode.END) Label1.set_ellipsize(3)
Box1.add(Label1) Box1.add(Label1)
AButton.add(Box1) AButton.add(Box1)
@ -174,27 +168,22 @@ class pluginclass:
self.recentBox.pack_start(AButton, False, True, 0) self.recentBox.pack_start(AButton, False, True, 0)
def callback(self, widget, filename=None): def callback(self, widget, filename):
self.Win.hide() self.Win.hide()
x = os.system("gvfs-open \""+filename+"\"") try:
if x == 256: subprocess.check_call(["xdg-open", filename])
dia = Gtk.Dialog('File not found!', except subprocess.CalledProcessError:
None, #the toplevel wgt of your app dialog = Gtk.MessageDialog(self.window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, #binary flags or'ed together Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, _("The file or location could not be opened."))
("Ok", 77)) dialog.set_title("mintMenu")
dia.vbox.pack_start(Gtk.Label('The location or file could not be found!'), False, False, 0) dialog.run()
dia.vbox.show_all() dialog.destroy()
dia.show()
result = dia.run()
if result == 77:
dia.destroy()
def GetRecent(self, *args, **kargs): def GetRecent(self, *args, **kargs):
FileString=[] FileString=[]
IconString=[] IconString=[]
RecentInfo=self.RecManagerInstance.get_items() RecentInfo=self.RecManagerInstance.get_items()
# print RecentInfo[0].get_icon(Gtk.IconSize.MENU)
count=0 count=0
MaxEntries=self.numentries MaxEntries=self.numentries
if self.numentries == -1: if self.numentries == -1:
@ -225,7 +214,6 @@ class pluginclass:
self.Win.plugins["applications"].wTree.get_widget("entry1").grab_focus() self.Win.plugins["applications"].wTree.get_widget("entry1").grab_focus()
Execute(w, self.Exec) Execute(w, self.Exec)
# TODO - skipping this because we're already doing this on __init__ def do_plugin(self):
# def do_plugin(self): return
# print "recent.do_plugin calling recent.DoRecent"
# self.DoRecent() # self.DoRecent()

View File

@ -1,7 +1,6 @@
#!/usr/bin/python2 #!/usr/bin/python2
import os import os
from user import home
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
@ -9,7 +8,7 @@ from gi.repository import Gtk
from plugins.easybuttons import ApplicationLauncher from plugins.easybuttons import ApplicationLauncher
home = os.environ.get("HOME")
recentApps = [] recentApps = []
mintMenuWin = None mintMenuWin = None
recentAppBox = None recentAppBox = None
@ -35,8 +34,8 @@ def recentAppsSave():
else: else:
recentAppListFile.write(recentApp.type + "\n") recentAppListFile.write(recentApp.type + "\n")
except Exception, e: except Exception as e:
print e print(e)
msgDlg = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, 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__() + ")") _("Couldn't save recent apps. Check if you have write access to ~/.linuxmint/mintMenu")+"\n(" + e.__str__() + ")")
msgDlg.run() msgDlg.run()
@ -74,18 +73,16 @@ def recentAppBuildLauncher(location):
appButton.connect("clicked", applicationButtonClicked) appButton.connect("clicked", applicationButtonClicked)
appButton.type = "location" appButton.type = "location"
return appButton return appButton
except Exception, e: except Exception as e:
print u"File in recentapp not found: '" + location + "'", e print("File in recentapp not found: '%s': %s" % (location, e))
return None return None
def buildRecentApps(): def buildRecentApps():
print "-- recentHelper.buildRecentApps"
del recentApps[:] del recentApps[:]
try: try:
path = os.path.join(home, ".linuxmint/mintMenu/recentApplications.list") path = os.path.join(home, ".linuxmint/mintMenu/recentApplications.list")
if not os.path.exists(path): if not os.path.exists(path):
print "does not exist"
recentApplicationsList = [] recentApplicationsList = []
else: else:
recentApplicationsList = open(path).readlines() recentApplicationsList = open(path).readlines()
@ -103,12 +100,11 @@ def buildRecentApps():
if appButton: if appButton:
recentApps.append(appButton) recentApps.append(appButton)
except Exception, e: except Exception as e:
print e print(e)
return recentApps return recentApps
def doRecentApps(): def doRecentApps():
print "-- recentHelper.doRecentApps"
if recentAppBox is not None: if recentAppBox is not None:
# recentAppBox is initiated by the recent plugin # recentAppBox is initiated by the recent plugin
# only build UI widgets if it's enabled # only build UI widgets if it's enabled

View File

@ -66,7 +66,7 @@ class pluginclass(object):
def destroy(self): def destroy(self):
self.settings.notifyRemoveAll() self.settings.notifyRemoveAll()
def wake(self) : def wake(self):
pass pass
def changePluginSize(self, settings, key, args): def changePluginSize(self, settings, key, args):

View File

@ -66,7 +66,7 @@ class PointerMonitor(GObject.GObject, threading.Thread):
else: else:
self.display.allow_events(X.ReplayPointer, X.CurrentTime) self.display.allow_events(X.ReplayPointer, X.CurrentTime)
except Exception as e: except Exception as e:
print "Unexpected error: " + str(e) print("Unexpected error:", e)
def stop(self): def stop(self):
self.running = False self.running = False

Binary file not shown.

Before

(image error) Size: 573 B

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 127 127" style="enable-background:new 0 0 127 127;" xml:space="preserve">
<style type="text/css">
.st0{fill:#DE5833;}
.st1{fill:#FFFFFF;}
.st2{fill-rule:evenodd;clip-rule:evenodd;fill:#FED30A;}
.st3{fill:#2D4F8D;}
.st4{fill:#D5D7D8;}
.st5{fill:#67BD47;}
.st6{fill:#43A347;}
.st7{fill:#4C4C4C;}
</style>
<g>
<g>
<circle class="st0" cx="63.3" cy="63.3" r="60"/>
<path class="st1" d="M114.1,41.8c-2.8-6.6-6.8-12.5-11.8-17.5c-5.1-5.1-11-9-17.5-11.8c-6.8-2.9-14-4.3-21.5-4.3
s-14.7,1.5-21.5,4.3c-6.6,2.8-12.5,6.8-17.5,11.8c-5.1,5.1-9,11-11.8,17.5c-2.9,6.8-4.3,14-4.3,21.5c0,7.4,1.5,14.7,4.3,21.5
c2.8,6.6,6.8,12.5,11.8,17.5c5.1,5.1,11,9,17.5,11.8c6.8,2.9,14,4.3,21.5,4.3s14.7-1.5,21.5-4.3c6.6-2.8,12.5-6.8,17.5-11.8
c5.1-5.1,9-11,11.8-17.5c2.9-6.8,4.3-14,4.3-21.5C118.4,55.8,117,48.6,114.1,41.8z M75.3,112.8c-3.2-5.4-11.6-20.5-11.6-31.7
c0-25.8,17.3-3.7,17.3-24.3c0-4.9-2.4-22.1-17.4-25.7c-3.7-4.9-12.4-9.6-26.2-7.7c0,0,2.3,0.7,4.9,2c0,0-5,0.7-5.2,4.1
c0,0,9.9-0.5,15.5,1.3c-12.9,1.7-19.6,8.4-18.4,20.8c1.7,17.5,9.1,48.7,11.7,59.6c-19.6-7.1-33.7-25.9-33.7-48
c0-28.1,22.8-51,51-51s51,22.8,51,51C114.2,87.3,97.6,107.4,75.3,112.8z"/>
<path id="Beak_2_" class="st2" d="M60.5,71.6c0-6.6,9-8.7,12.4-8.7c9.2,0,22.2-5.9,25.4-5.8c3.3,0.1,5.4,1.4,5.4,2.9
c0,2.2-18.4,10.5-25.5,9.8c-6.8-0.6-8.4,0.1-8.4,2.9c0,2.4,4.9,4.6,10.3,4.6c8.1,0,16-3.6,18.4-1.9c2.1,1.5-5.5,6.9-14.2,6.9
S60.5,78.2,60.5,71.6z"/>
<g>
<path class="st3" d="M76.5,43.6c-2.4-3.1-6.7-3.2-8.2,0.4C70.6,42.2,73.4,41.8,76.5,43.6z"/>
<path class="st3" d="M49.7,43.7c-3.3-2-8.8-2.2-8.5,4.1C42.9,43.9,45.1,43.2,49.7,43.7z"/>
<path class="st3" d="M74.5,49.5c-1.8,0-3.3,1.5-3.3,3.3c0,1.8,1.5,3.3,3.3,3.3s3.3-1.5,3.3-3.3C77.8,51,76.3,49.5,74.5,49.5z
M75.7,52.5c-0.5,0-1-0.4-1-1c0-0.5,0.4-1,1-1s1,0.4,1,1C76.6,52.1,76.2,52.5,75.7,52.5z"/>
<path class="st3" d="M48.9,51.3c-2.1,0-3.8,1.7-3.8,3.8c0,2.1,1.7,3.8,3.8,3.8c2.1,0,3.8-1.7,3.8-3.8C52.7,53,51,51.3,48.9,51.3z
M50.3,54.8c-0.6,0-1.1-0.5-1.1-1.1c0-0.6,0.5-1.1,1.1-1.1c0.6,0,1.1,0.5,1.1,1.1C51.4,54.3,50.9,54.8,50.3,54.8z"/>
</g>
<g>
<path class="st4" d="M40.6,35.1c-4.8,3.5-7,8.9-6.3,16.5c1.7,17.5,9.1,48.8,11.7,59.7c0.9,0.3,1.8,0.6,2.7,0.9
c-1.6-6.6-9.3-38.8-12.7-63.5C35.1,42.1,37.6,38.2,40.6,35.1z"/>
<path class="st4" d="M52.5,30.8c0.4,0,0.7-0.1,0.7-0.1c-5.2-2.5-13.4-2.6-15.6-2.6c-0.2,0.4-0.4,0.9-0.4,1.4
C37.1,29.6,46.8,29,52.5,30.8z"/>
<path class="st4" d="M43.1,25.4c-1.6-1.1-2.9-1.8-3.7-2.2c-0.7,0.1-1.3,0.1-2,0.2c0,0,2.3,0.7,4.9,2c0,0-0.1,0-0.2,0
C42.7,25.4,43.1,25.4,43.1,25.4z"/>
</g>
<g>
<path class="st5" d="M83.4,91.9c-1.7-0.4-8.3,4.3-10.8,6.1c-0.1-0.5-0.2-0.9-0.3-1.1c-0.3-1-6.7-0.4-8.2,1.2
c-4-1.9-12-5.6-12.1-3.3c-0.3,3,0,15.5,1.6,16.4c1.2,0.7,8-3,11.4-4.9c0,0,0,0,0.1,0c2.1,0.5,6,0,7.4-0.9
c0.2-0.1,0.3-0.3,0.4-0.5c3.1,1.2,9.8,3.6,11.2,3.1C85.9,107.5,85.5,92.4,83.4,91.9z"/>
<path class="st6" d="M65.1,106.3c-2.1-0.4-1.4-2.5-1.4-7.4c0,0,0,0,0,0c-0.5,0.3-0.9,0.7-0.9,1.1c0,4.9-0.8,7.1,1.4,7.4
c2.1,0.5,6,0,7.6-0.9c0.3-0.2,0.4-0.5,0.5-1C70.8,106.4,67.1,106.8,65.1,106.3z"/>
</g>
</g>
<g>
<path class="st7" d="M110.5,106.4c-0.9,0-1.7,0.7-1.7,1.6c0,0.9,0.7,1.7,1.7,1.7c0.9,0,1.7-0.7,1.7-1.7
C112.2,107.2,111.5,106.4,110.5,106.4z M110.6,109.4c-0.7,0-1.3-0.6-1.3-1.3c0-0.7,0.5-1.3,1.3-1.3c0.7,0,1.3,0.6,1.3,1.3
C111.8,108.8,111.3,109.4,110.6,109.4z"/>
<path class="st7" d="M110.6,107.4c0.2,0,0.3,0.1,0.4,0.3l0.3-0.2c-0.1-0.2-0.4-0.5-0.7-0.5c-0.5,0-1,0.4-1,1c0,0.6,0.4,1,1,1
c0.4,0,0.6-0.2,0.7-0.5l-0.3-0.2c-0.1,0.2-0.2,0.3-0.4,0.3c-0.3,0-0.6-0.3-0.6-0.6C110.1,107.7,110.3,107.4,110.6,107.4z"/>
</g>
</g>
</svg>

After

(image error) Size: 3.8 KiB

Binary file not shown.

Before

(image error) Size: 733 B

Binary file not shown.

Before

(image error) Size: 443 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" stroke-miterlimit="10" style="shape-rendering:geometricPrecision; fill-rule:evenodd">
<rect width="100%" height="100%" fill="white"/>
<path d="M 120.85,29.21 C 120.85,29.62 120.72,29.99 120.47,30.33 C 120.21,30.66 119.94,30.83 119.63,30.83 C 117.14,31.07 115.09,31.87 113.51,33.24 C 111.92,34.6 110.29,37.21 108.6,41.05 L 82.8,99.19 C 82.63,99.73 82.16,100 81.38,100 C 80.77,100 80.3,99.73 79.96,99.19 L 65.49,68.93 L 48.85,99.19 C 48.51,99.73 48.04,100 47.43,100 C 46.69,100 46.2,99.73 45.96,99.19 L 20.61,41.05 C 19.03,37.44 17.36,34.92 15.6,33.49 C 13.85,32.06 11.4,31.17 8.27,30.83 C 8,30.83 7.74,30.69 7.51,30.4 C 7.27,30.12 7.15,29.79 7.15,29.42 C 7.15,28.47 7.42,28 7.96,28 C 10.22,28 12.58,28.1 15.05,28.3 C 17.34,28.51 19.5,28.61 21.52,28.61 C 23.58,28.61 26.01,28.51 28.81,28.3 C 31.74,28.1 34.34,28 36.6,28 C 37.14,28 37.41,28.47 37.41,29.42 C 37.41,30.36 37.24,30.83 36.91,30.83 C 34.65,31 32.87,31.58 31.57,32.55 C 30.27,33.53 29.62,34.81 29.62,36.4 C 29.62,37.21 29.89,38.22 30.43,39.43 L 51.38,86.74 L 63.27,64.28 L 52.19,41.05 C 50.2,36.91 48.56,34.23 47.28,33.03 C 46,31.84 44.06,31.1 41.46,30.83 C 41.22,30.83 41,30.69 40.78,30.4 C 40.56,30.12 40.45,29.79 40.45,29.42 C 40.45,28.47 40.68,28 41.16,28 C 43.42,28 45.49,28.1 47.38,28.3 C 49.2,28.51 51.14,28.61 53.2,28.61 C 55.22,28.61 57.36,28.51 59.62,28.3 C 61.95,28.1 64.24,28 66.5,28 C 67.04,28 67.31,28.47 67.31,29.42 C 67.31,30.36 67.15,30.83 66.81,30.83 C 62.29,31.14 60.03,32.42 60.03,34.68 C 60.03,35.69 60.55,37.26 61.6,39.38 L 68.93,54.26 L 76.22,40.65 C 77.23,38.73 77.74,37.11 77.74,35.79 C 77.74,32.69 75.48,31.04 70.96,30.83 C 70.55,30.83 70.35,30.36 70.35,29.42 C 70.35,29.08 70.45,28.76 70.65,28.46 C 70.86,28.15 71.06,28 71.26,28 C 72.88,28 74.87,28.1 77.23,28.3 C 79.49,28.51 81.35,28.61 82.8,28.61 C 83.84,28.61 85.38,28.52 87.4,28.35 C 89.96,28.12 92.11,28 93.83,28 C 94.23,28 94.43,28.4 94.43,29.21 C 94.43,30.29 94.06,30.83 93.32,30.83 C 90.69,31.1 88.57,31.83 86.97,33.01 C 85.37,34.19 83.37,36.87 80.98,41.05 L 71.26,59.02 L 84.42,85.83 L 103.85,40.65 C 104.52,39 104.86,37.48 104.86,36.1 C 104.86,32.79 102.6,31.04 98.08,30.83 C 97.67,30.83 97.47,30.36 97.47,29.42 C 97.47,28.47 97.77,28 98.38,28 C 100.03,28 101.99,28.1 104.25,28.3 C 106.34,28.51 108.1,28.61 109.51,28.61 C 111,28.61 112.72,28.51 114.67,28.3 C 116.7,28.1 118.52,28 120.14,28 C 120.61,28 120.85,28.4 120.85,29.21 z" />
</svg>

After

(image error) Size: 2.4 KiB