Compare commits

...

5 Commits

Author SHA1 Message Date
Clement Lefebvre
cc94108b85 6.0.5.1 2020-07-18 12:25:37 +01:00
Michael Webster
3e863c8b74 recentHelper.py: Don't try to modify the recent list unless recents
are enabled.

This was throwing an error when launching a program with the recent
plugin disabled.
2020-07-18 12:25:08 +01:00
Michael Webster
d7f650b79f applications.py: Fix dnd for re-ordering/adding favorites.
Fixes https://github.com/linuxmint/mint20-beta/issues/22
2020-07-18 12:25:06 +01:00
Clement Lefebvre
77476ded54 Add missing dependency 2020-07-18 12:24:38 +01:00
Clement Lefebvre
3169e80707 Search: Fix searching for accentuated strings 2020-07-18 12:24:28 +01:00
5 changed files with 42 additions and 29 deletions

12
debian/changelog vendored
View File

@ -1,3 +1,15 @@
mintmenu (6.0.5.1) ulyana; urgency=medium
[ Clement Lefebvre ]
* Search: Fix searching for accentuated strings
* Add missing dependency
[ Michael Webster ]
* applications.py: Fix dnd for re-ordering/adding favorites.
* recentHelper.py: Don't try to modify the recent list unless recents are enabled.
-- Clement Lefebvre <root@linuxmint.com> Sat, 18 Jul 2020 12:25:24 +0100
mintmenu (6.0.5) ulyana; urgency=medium
* Fix typo in file path

1
debian/control vendored
View File

@ -15,6 +15,7 @@ Depends:
python3-configobj,
python3-gi-cairo,
python3-setproctitle,
python3-unidecode,
python3-xlib,
python3-xdg,
python3-xapp,

View File

@ -12,7 +12,8 @@ import urllib.request, urllib.parse, urllib.error
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("MateMenu", "2.0")
from gi.repository import Gtk, Gdk, GdkPixbuf, Gio, GLib, MateMenu
gi.require_version("XApp", "1.0")
from gi.repository import Gtk, Gdk, GdkPixbuf, Gio, GLib, MateMenu, XApp
import plugins.recentHelper as RecentHelper
from plugins.easybuttons import (ApplicationLauncher, CategoryButton,
@ -173,11 +174,11 @@ class pluginclass(object):
toButton = (Gtk.TargetEntry.new("text/uri-list", 0, TARGET_TYPE_TEXT),
Gtk.TargetEntry.new("text/uri-list", 0, TARGET_TYPE_TEXT))
TARGET_TYPE_FAV = 81
toFav = (Gtk.TargetEntry.new("FAVORITES", Gtk.TargetFlags.SAME_APP, 81),
toFav = (Gtk.TargetEntry.new("text/plain", 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("text/plain", Gtk.TargetFlags.SAME_APP, 81),
Gtk.TargetEntry.new("text/plain", Gtk.TargetFlags.SAME_APP, 81))
#@print_timing
def __init__(self, mintMenuWin, toggleButton, de):
@ -1412,12 +1413,11 @@ class pluginclass(object):
def on_drag_data_get(self, widget, context, selection, info, time):
if info == self.TARGET_TYPE_FAV:
self.drag_origin = widget.position
# FIXME: This fails in python3:
selection.set(selection.get_target(), 8, str(widget.position))
selection.set_text(str(widget.position), -1)
def on_drag_data_received(self, widget, context, x, y, selection, info, time):
if info == self.TARGET_TYPE_FAV:
self.favoritesReorder(int(selection.get_data()), widget.position)
self.favoritesReorder(int(selection.get_data().decode()), widget.position)
# def on_icon_theme_changed(self, theme):
# print("on_icon_theme_changed")

View File

@ -2,6 +2,7 @@
import os.path
import shutil
import unidecode
import xdg.DesktopEntry
import xdg.Menu
@ -258,10 +259,10 @@ class ApplicationLauncher(easyButton):
def loadDesktopEntry(self, desktopItem):
try:
self.appName = self.strip_accents(desktopItem.getName())
self.appGenericName = self.strip_accents(desktopItem.getGenericName())
self.appComment = self.strip_accents(desktopItem.getComment())
self.appExec = self.strip_accents(desktopItem.getExec().replace('\\\\', '\\'))
self.appName = desktopItem.getName()
self.appGenericName = desktopItem.getGenericName()
self.appComment = desktopItem.getComment()
self.appExec = desktopItem.getExec().replace('\\\\', '\\')
self.appIconName = desktopItem.getIcon()
self.appCategories = desktopItem.getCategories()
self.appMateDocPath = desktopItem.get("X-MATE-DocPath") or ""
@ -303,30 +304,25 @@ class ApplicationLauncher(easyButton):
self.addLabel(self.appName)
def filterText(self, text):
keywords = text.lower().split()
appName = self.appName.lower()
appGenericName = self.appGenericName.lower()
appComment = self.appComment.lower()
appExec = self.appExec.lower()
keywords = self.strip_case_and_accents(text).split()
appName = self.strip_case_and_accents(self.appName)
appGenericName = self.strip_case_and_accents(self.appGenericName)
appComment = self.strip_case_and_accents(self.appComment)
appExec = self.strip_case_and_accents(self.appExec)
for keyword in keywords:
keyw = self.strip_accents(keyword)
if keyw != "" and appName.find(keyw) == -1 and appGenericName.find(keyw) == -1 and appComment.find(keyw) == -1 and appExec.find(keyw) == -1:
if keyword != "" and appName.find(keyword) == -1 and appGenericName.find(keyword) == -1 and appComment.find(keyword) == -1 and appExec.find(keyword) == -1:
self.hide()
return False
self.show()
return True
def strip_accents(self, string):
# FIXME: Is this right??
return string
# value = string
# print(value, "...")
# if isinstance(string, str):
# try:
# value = string.encode('UTF8', 'ignore')
# except:
# pass
# return value
def strip_case_and_accents(self, string):
if isinstance(string, str):
try:
value = unidecode.unidecode(string.lower())
except:
pass
return value
def getTooltip(self):
tooltip = self.appName

View File

@ -115,6 +115,10 @@ def doRecentApps():
def applicationButtonClicked(widget):
mintMenuWin.hide()
if settings == None:
return
recentAppsAdd(widget)
recentAppsSave()
doRecentApps()