- 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,

5
debian/postinst vendored
View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# postinst script # postinst script
# see: dh_installdeb(1) # see: dh_installdeb(1)
set -e set -e
@ -18,7 +18,8 @@ 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,13 +539,14 @@ 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:
if line.startswith("DESCRIPTION="): line = line.decode("utf-8")
tooltip = line.split("=",1)[1].replace('"','') if line.startswith("DESCRIPTION="):
self.systemlabel.set_tooltip_text(tooltip) tooltip = line.split("=",1)[1].strip('"\n')
self.button_icon.set_tooltip_text(tooltip) self.systemlabel.set_tooltip_text(tooltip)
break self.button_icon.set_tooltip_text(tooltip)
break
if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN: if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
self.button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) self.button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.button_box.pack_start(self.button_icon, False, False, 0) self.button_box.pack_start(self.button_icon, False, False, 0)
@ -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()

File diff suppressed because it is too large Load Diff

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 image.set_pixel_size(iconSize)
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)
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.set_size_request(self.iconSize, self.iconSize)
self.buttonImage = Gtk.Image()
icon = self.getIcon(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,19 +274,19 @@ 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 = ""
self.appExec = "" self.appExec = ""
self.appIconName = "" self.appIconName = ""
self.appCategories = "" self.appCategories = ""
self.appDocPath = "" self.appDocPath = ""
self.startupMonitorId = 0 self.startupMonitorId = 0
@ -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:
@ -205,7 +194,7 @@ class pluginclass:
count+=1 count+=1
if count >= MaxEntries: if count >= MaxEntries:
break break
return FileString, IconString return FileString, IconString
def ButtonClicked(self, widget, event, Exec): def ButtonClicked(self, widget, event, Exec):
self.press_x = event.x self.press_x = event.x
@ -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

Width:  |  Height:  |  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

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

Before

Width:  |  Height:  |  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

Width:  |  Height:  |  Size: 2.4 KiB