move images to icons dir

and be able to locate them it local non-installed dir
This commit is contained in:
glasseyes 2018-08-30 13:18:56 +07:00
parent 54689a3643
commit 4eff488d04
9 changed files with 42 additions and 14 deletions

View file

@ -1 +1 @@
include *.gif *.png
recursive-include keyman/icons *

View file

Before

Width:  |  Height:  |  Size: 687 B

After

Width:  |  Height:  |  Size: 687 B

View file

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 551 B

View file

Before

Width:  |  Height:  |  Size: 681 B

After

Width:  |  Height:  |  Size: 681 B

View file

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 775 B

View file

@ -93,7 +93,14 @@ class InstallKmpWindow(Gtk.Window):
if options and "graphicFile" in options:
image.set_from_file(os.path.join(tmpdirname, options['graphicFile']))
else:
image.set_from_file("defaultpackage.gif")
img_default = "/usr/share/keyman/icons/defaultpackage.gif"
if not os.path.isfile(img_default):
img_default = "keyman/icons/defaultpackage.gif"
if not os.path.isfile(img_default):
img_default = "defaultpackage.gif"
if not os.path.isfile(img_default):
img_default = "icons/defaultpackage.gif"
image.set_from_file(img_default)
mainhbox.pack_start(image, False, False, 0)

View file

@ -22,8 +22,14 @@ class KeyboardBox(Gtk.Box):
#print(kmp)
self.kmp = kmp
icofile = os.path.join("/usr/local/share/keyman", self.kmp["id"], self.kmp["id"] + ".ico.bmp")
if not os.path.isfile(icofile):
icofile = "/usr/share/keyman/icons/icon_kmp.png"
if not os.path.isfile(icofile):
icofile = "keyman/icons/icon_kmp.png"
if not os.path.isfile(icofile):
icofile = "icon_kmp.png"
if not os.path.isfile(icofile):
icofile = "icons/icon_kmp.png"
self.image = Gtk.Image.new_from_file(icofile)
#image.set_from_pixbuf(pics[0])
#grid.add(image)
@ -36,16 +42,30 @@ class KeyboardBox(Gtk.Box):
#grid.attach_next_to(label1, image, Gtk.PositionType.RIGHT, 1, 1)
self.pack_start(self.label1, False, False, 10)
img_expand = "/usr/share/keyman/icons/expand20.png"
if not os.path.isfile(img_expand):
img_expand = "keyman/icons/expand20.png"
if not os.path.isfile(img_expand):
img_expand = "expand20.png"
if not os.path.isfile(img_expand):
img_expand = "icons/expand20.png"
self.expandbutton = Gtk.Button()
self.expandimage = Gtk.Image.new_from_file("expand20.png")
self.expandimage = Gtk.Image.new_from_file(img_expand)
self.expandbutton.set_image(self.expandimage)
self.expandbutton.set_tooltip_text("More information about " + kmp["name"])
#grid.attach_next_to(expandbutton, helpbutton, Gtk.PositionType.RIGHT, 1, 1)
self.expandbutton.connect("clicked", self.on_expand_clicked)
self.pack_end(self.expandbutton, False, False, 0)
img_cross = "/usr/share/keyman/icons/cross20.png"
if not os.path.isfile(img_cross):
img_cross = "keyman/icons/cross20.png"
if not os.path.isfile(img_cross):
img_cross = "cross20.png"
if not os.path.isfile(img_cross):
img_cross = "icons/cross20.png"
self.uninstallbutton = Gtk.Button()
self.uninstallimage = Gtk.Image.new_from_file("cross20.png")
self.uninstallimage = Gtk.Image.new_from_file(img_cross)
self.uninstallbutton.set_image(self.uninstallimage)
self.uninstallbutton.set_tooltip_text("Uninstall " + kmp["name"] + " (" + kmp["id"] + ")")
#grid.attach_next_to(uninstallbutton, expandbutton, Gtk.PositionType.RIGHT, 1, 1)
@ -54,8 +74,15 @@ class KeyboardBox(Gtk.Box):
welcome_file = os.path.join("/usr/local/share/doc/keyman", self.kmp["id"], "welcome.htm")
if os.path.isfile(welcome_file):
img_help = "/usr/share/keyman/icons/help20.png"
if not os.path.isfile(img_help):
img_help = "keyman/icons/help20.png"
if not os.path.isfile(img_help):
img_help = "help20.png"
if not os.path.isfile(img_help):
img_help = "icons/help20.png"
self.helpbutton = Gtk.Button()
self.helpimage = Gtk.Image.new_from_file("help20.png")
self.helpimage = Gtk.Image.new_from_file(img_help)
self.helpbutton.set_image(self.helpimage)
self.helpbutton.set_tooltip_text("Help for " + kmp["name"])
#grid.attach_next_to(helpbutton, label1, Gtk.PositionType.RIGHT, 1, 1)

View file

@ -9,9 +9,6 @@ setup(
'install_kmp', 'kvk2ldml',
'uninstall_kmp',
'list_installed_kmp', ],
package_data={
'': ['*.png', '*.gif'],
},
install_requires=[
'lxml', 'gi', 'numpy', 'PIL', 'requests', 'requests_cached',
@ -28,9 +25,6 @@ setup(
project_urls={
"Bug Tracker": "https://github.com/keymanapp/issues",
"Source Code": "https://github.com/keymanapp/keyman/linux/tree/master/linux/keyman-config",
}
)
#accelerators.py downloadkeyboard.py install_window.py kvk2ldml.py uninstall_kmp.py
#check_mime_type.py get_kmp.py keyboard_details.py list_installed_kmp.py view_installed.py
#convertico.py install_kmp.py kmpmetadata.py setup.py welcome.py
},
include_package_data=True,
)