mirror of
https://github.com/WoeUSB/WoeUSB-ng.git
synced 2026-01-09 06:12:41 +08:00
Create desktop icon
This commit is contained in:
parent
174b2c6e28
commit
5731728a41
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@ -30,7 +30,7 @@ class MainFrame(wx.Frame):
|
||||
def __init__(self, title, pos, size, style=wx.DEFAULT_FRAME_STYLE):
|
||||
super(MainFrame, self).__init__(None, -1, title, pos, size, style)
|
||||
|
||||
self.SetIcon(wx.Icon(data_directory + "icon.png"))
|
||||
self.SetIcon(wx.Icon(data_directory + "icon.ico"))
|
||||
|
||||
file_menu = wx.Menu()
|
||||
self.__menuItemShowAll = wx.MenuItem(file_menu, wx.ID_ANY, _("Show all drives") + " \tCtrl+A",
|
||||
@ -289,7 +289,7 @@ class DialogAbout(wx.Dialog):
|
||||
sizer_all = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer_img = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
img = wx.Image(data_directory + "icon.png", wx.BITMAP_TYPE_PNG)
|
||||
img = wx.Image(data_directory + "icon.ico", wx.BITMAP_TYPE_PNG)
|
||||
self.__bitmapIcone = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(img), wx.DefaultPosition, wx.Size(48, 48))
|
||||
sizer_img.Add(self.__bitmapIcone, 0, wx.ALL, 5)
|
||||
|
||||
|
||||
@ -165,4 +165,4 @@ texinfo_documents = [
|
||||
todo_include_todos = True
|
||||
|
||||
html_logo = "../src/data/woeusb-logo.png"
|
||||
html_favicon = "../src/data/icon.png"
|
||||
html_favicon = "../src/data/icon.ico"
|
||||
7
miscellaneous/WoeUSB-ng.desktop
Executable file
7
miscellaneous/WoeUSB-ng.desktop
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Name=WoeUSB-ng
|
||||
Exec=/usr/bin/woeusbgui
|
||||
Icon=/usr/share/icons/WoeUSB-ng/icon.ico
|
||||
Terminal=false
|
||||
Type=Application
|
||||
@ -23,4 +23,22 @@ DOC: https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/woeusbgui</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
<action id="com.github.slacka.woeusb.run-gui-using-pkexec-local">
|
||||
<description>Run `woeusb` as SuperUser</description>
|
||||
<description xml:lang="zh_TW">以超級使用者(SuperUser)身份執行 `woeusb`</description>
|
||||
<description xml:lang="pl_PL">Uruchom `woeusb` jako root</description>
|
||||
|
||||
<message>Authentication is required to run `woeusb` as SuperUser.</message>
|
||||
<message xml:lang="zh_TW">以超級使用者(SuperUser)身份執行 `woeusb` 需要通過身份驗證。</message>
|
||||
<message xml:lang="pl_PL">Wymagana jest autoryzacja do uruchomienia `woeusb` jako root</message>
|
||||
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/woeusbgui</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
</policyconfig>
|
||||
45
setup.py
45
setup.py
@ -2,9 +2,11 @@ from setuptools import setup
|
||||
from setuptools.command.develop import develop
|
||||
from setuptools.command.install import install
|
||||
from xml.dom.minidom import parse
|
||||
import configparser
|
||||
import shutil
|
||||
import os
|
||||
|
||||
|
||||
this_directory = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
||||
@ -23,19 +25,40 @@ class PostInstallCommand(install):
|
||||
"""Post-installation for installation mode."""
|
||||
|
||||
def run(self):
|
||||
path = shutil.which('woeusbgui')
|
||||
path = shutil.which('woeusbgui') # I have no clue how to find were pip puts exec's
|
||||
if path is None:
|
||||
path = 'usr/local/bin/woeusbgui'
|
||||
else:
|
||||
dom = parse(this_directory + '/miscellaneous/com.github.woeusb.woeusb-ng.policy')
|
||||
for action in dom.getElementsByTagName('action'):
|
||||
if action.getAttribute('id') == "com.github.slacka.woeusb.run-gui-using-pkexec":
|
||||
for annotate in action.getElementsByTagName('annotate'):
|
||||
if annotate.getAttribute('key') == "org.freedesktop.policykit.exec.path":
|
||||
annotate.childNodes[0].nodeValue = path
|
||||
|
||||
dom = parse(this_directory + '/polkit/com.github.woeusb.woeusb-ng.policy')
|
||||
for action in dom.getElementsByTagName('action'):
|
||||
if action.getAttribute('id') == "com.github.slacka.woeusb.run-gui-using-pkexec":
|
||||
for annotate in action.getElementsByTagName('annotate'):
|
||||
if annotate.getAttribute('key') == "org.freedesktop.policykit.exec.path":
|
||||
annotate.childNodes[0].nodeValue = path
|
||||
with open(this_directory + '/miscellaneous/com.github.woeusb.woeusb-ng.policy', "w") as file:
|
||||
dom.writexml(file)
|
||||
|
||||
with open(this_directory + '/polkit/com.github.woeusb.woeusb-ng.policy', "w") as file:
|
||||
dom.writexml(file)
|
||||
shutil.copy2(this_directory + '/miscellaneous/com.github.woeusb.woeusb-ng.policy', "/usr/share/polkit-1/actions")
|
||||
|
||||
try:
|
||||
os.makedirs('/usr/share/icons/WoeUSB-ng')
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
shutil.copy2(this_directory + '/WoeUSB/data/icon.ico', '/usr/share/icons/WoeUSB-ng/icon.ico')
|
||||
|
||||
desktop = configparser.ConfigParser()
|
||||
desktop.read(this_directory + '/miscellaneous/WoeUSB-ng.desktop')
|
||||
desktop.set('Desktop Entry', 'value', path)
|
||||
with open(this_directory + '/miscellaneous/WoeUSB-ng.desktop', "w") as file:
|
||||
desktop.write(file)
|
||||
|
||||
shutil.copy2(
|
||||
this_directory + '/miscellaneous/WoeUSB-ng.desktop',
|
||||
'/home/' + os.environ['SUDO_USER'] + '/.local/share/applications'
|
||||
)
|
||||
|
||||
shutil.copy2(this_directory + '/polkit/com.github.woeusb.woeusb-ng.policy', "/usr/share/polkit-1/actions")
|
||||
install.run(self)
|
||||
|
||||
|
||||
@ -58,7 +81,7 @@ setup(
|
||||
],
|
||||
install_requires=[
|
||||
'termcolor',
|
||||
'wxPython'
|
||||
'wxPython',
|
||||
],
|
||||
cmdclass={
|
||||
'develop': PostDevelopCommand,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user