summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2024-04-16 23:34:47 +0100
committerDave Hibberd <hibby@debian.org>2024-04-16 23:34:47 +0100
commit562203a21ac7f438b5966ff57e7788f31a6b29bc (patch)
tree1d123e263bac2e7c5d803a62c7f063b0b678bf97 /debian
parent747e58aa84b7adda2c3d0bbf1f5fb1bd4b33574f (diff)
rewrite wxui-chirp-share patch
Diffstat (limited to 'debian')
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/wxui-chirp-share.patch168
2 files changed, 96 insertions, 73 deletions
diff --git a/debian/patches/series b/debian/patches/series
index 498dc9a..5446d00 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+wxui-chirp-share.patch
remove-future.patch
desktop-file.patch
02-fix-setup-py.patch
diff --git a/debian/patches/wxui-chirp-share.patch b/debian/patches/wxui-chirp-share.patch
index f328df7..1062559 100644
--- a/debian/patches/wxui-chirp-share.patch
+++ b/debian/patches/wxui-chirp-share.patch
@@ -1,73 +1,41 @@
Description: A patch to direct chirp on startup to /usr/share for images, icons etc
and to remove the desktop-install feature shipped with chirp
-Author: Dave Hibberd <d@vehibberd.com>
-Last-Update: 2023-10-28
+Author: Dave Hibberd <hibby@debian.org>
+Last-Update: 2024-04-16
---
---- a/chirp/wxui/main.py
-+++ b/chirp/wxui/main.py
-@@ -373,11 +373,7 @@
-
- vbox = wx.BoxSizer(wx.VERTICAL)
- self.SetSizer(vbox)
-- with importlib_resources.as_file(
-- importlib_resources.files('chirp.share')
-- .joinpath('welcome_screen.png')
-- ) as welcome:
-- bmp = wx.Bitmap(str(welcome))
-+ bmp = wx.Bitmap(str('/usr/share/chirp/welcome_screen.png'))
- width, height = self.GetSize()
- img = wx.StaticBitmap(self, wx.ID_ANY, bmp)
- vbox.Add(img, 1, flag=wx.EXPAND)
-@@ -452,11 +448,7 @@
- self.add_tab_panel = wx.Panel(self, pos=(0, 0), size=(600, 600))
- self.add_tab_panel.Hide()
-
-- with importlib_resources.as_file(
-- importlib_resources.files('chirp.share')
-- .joinpath('plus-icon.png')
-- ) as icon:
-- self.add_tab_bm = wx.Bitmap(str(icon), wx.BITMAP_TYPE_ANY)
-+ self.add_tab_bm = wx.Bitmap(str('/usr/share/chirp/plus-icon.png'), wx.BITMAP_TYPE_ANY)
-
- self.add_tab_panel.Bind(wx.EVT_PAINT, self._paint_add_tab_panel)
-
-@@ -520,15 +512,7 @@
- self.PopupMenu(menu)
-
- def set_icon(self):
-- if sys.platform == 'win32':
-- icon = 'chirp.ico'
-- else:
-- icon = 'chirp.png'
-- with importlib_resources.as_file(
-- importlib_resources.files('chirp.share')
-- .joinpath(icon)
-- ) as path:
-- self.SetIcon(wx.Icon(str(path)))
-+ self.SetIcon(wx.Icon(str('/usr/share/chirp/chirp.png')))
-
- @property
- def current_editorset(self):
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/chirp/wxui/__init__.py
+++ b/chirp/wxui/__init__.py
-@@ -16,48 +16,48 @@
- CONF = None
+@@ -25,60 +25,60 @@
+ return CONF.get('developer_mode', 'state') == CHIRP_VERSION
--def maybe_install_desktop():
+-def maybe_install_desktop(args):
- local = os.path.join(os.path.expanduser('~'), '.local')
- desktop_path = os.path.join(local, 'share',
- 'applications', 'chirp.desktop')
-- with importlib_resources.as_file(
-- importlib_resources.files('chirp.share')
-- .joinpath('chirp.desktop')) as desktop_src:
+- with resources.as_file(
+- resources.files('chirp.share').joinpath('chirp.desktop')
+- ) as desktop_src:
- with open(desktop_src) as f:
- desktop_content = f.readlines()
-- with importlib_resources.as_file(
-- importlib_resources.files('chirp.share')
-- .joinpath('chirp.ico')) as p:
+- with resources.as_file(
+- resources.files('chirp.share').joinpath('chirp.ico')) as p:
- icon_path = str(p)
+-
+- # If asked not to do this, always bail
+- if args.no_install_desktop_app:
+- return
+-
+- # Already exists, don't prompt user
- if os.path.exists(desktop_path):
+- LOG.debug('Desktop file exists')
+- return
+-
+- # If already asked and not explicitly opted-in, stop nagging
+- if (CONF.get_bool('offered_desktop', 'state') and not
+- args.install_desktop_app):
+- LOG.debug('Desktop file missing but user previously offered')
- return
-
- import wx
@@ -96,22 +64,34 @@ Last-Update: 2023-10-28
- f.write(line)
- LOG.debug('Wrote %s with exec=%r icon=%r' % (
- f.name, exec_path, icon_path))
-+# def maybe_install_desktop():
++#def maybe_install_desktop(args):
+# local = os.path.join(os.path.expanduser('~'), '.local')
+# desktop_path = os.path.join(local, 'share',
+# 'applications', 'chirp.desktop')
-+# with importlib_resources.as_file(
-+# importlib_resources.files('chirp.share')
-+# .joinpath('chirp.desktop')) as desktop_src:
++# with resources.as_file(
++# resources.files('chirp.share').joinpath('chirp.desktop')
++# ) as desktop_src:
+# with open(desktop_src) as f:
+# desktop_content = f.readlines()
-+# with importlib_resources.as_file(
-+# importlib_resources.files('chirp.share')
-+# .joinpath('chirp.ico')) as p:
++# with resources.as_file(
++# resources.files('chirp.share').joinpath('chirp.ico')) as p:
+# icon_path = str(p)
++#
++# # If asked not to do this, always bail
++# if args.no_install_desktop_app:
++# return
++#
++# # Already exists, don't prompt user
+# if os.path.exists(desktop_path):
++# LOG.debug('Desktop file exists')
+# return
+#
++# # If already asked and not explicitly opted-in, stop nagging
++# if (CONF.get_bool('offered_desktop', 'state') and not
++# args.install_desktop_app):
++# LOG.debug('Desktop file missing but user previously offered')
++# return
++
+# import wx
+# r = wx.MessageBox(
+# _('Would you like CHIRP to install a desktop icon for you?'),
@@ -119,9 +99,9 @@ Last-Update: 2023-10-28
+# if r != wx.YES:
+# CONF.set_bool('offered_desktop', True, 'state')
+# return
-+#
++
+# os.makedirs(os.path.dirname(desktop_path), exist_ok=True)
-+#
++
+# # Try to run chirp by name from ~/.local/bin
+# exec_path = os.path.join(local, 'bin', 'chirp')
+# if not os.path.exists(exec_path):
@@ -141,19 +121,61 @@ Last-Update: 2023-10-28
def chirpmain():
-@@ -205,10 +205,10 @@
+@@ -242,10 +242,10 @@
report.check_for_updates(
lambda ver: wx.CallAfter(main.display_update_notice, ver))
-- if sys.platform == 'linux' and args.install_desktop_app:
+- if sys.platform == 'linux':
- try:
-- maybe_install_desktop()
+- maybe_install_desktop(args)
- except Exception as e:
- LOG.exception('Failed to run linux desktop installer: %s', e)
-+ # if sys.platform == 'linux' and args.install_desktop_app:
-+ # try:
-+ # maybe_install_desktop()
-+ # except Exception as e:
-+ # LOG.exception('Failed to run linux desktop installer: %s', e)
++# if sys.platform == 'linux':
++# try:
++# maybe_install_desktop(args)
++# except Exception as e:
++# LOG.exception('Failed to run linux desktop installer: %s', e)
app.MainLoop()
+--- a/chirp/wxui/main.py
++++ b/chirp/wxui/main.py
+@@ -371,10 +371,7 @@
+
+ vbox = wx.BoxSizer(wx.VERTICAL)
+ self.SetSizer(vbox)
+- with resources.as_file(
+- resources.files('chirp.share').joinpath('welcome_screen.png')
+- ) as welcome:
+- bmp = wx.Bitmap(str(welcome))
++ bmp = wx.Bitmap(str('/usr/share/chirp/welcome_screen.png'))
+ width, height = self.GetSize()
+ img = wx.StaticBitmap(self, wx.ID_ANY, bmp)
+ vbox.Add(img, 1, flag=wx.EXPAND)
+@@ -449,10 +446,7 @@
+ self.add_tab_panel = wx.Panel(self, pos=(0, 0), size=(600, 600))
+ self.add_tab_panel.Hide()
+
+- with resources.as_file(
+- resources.files('chirp.share').joinpath('plus-icon.png')
+- ) as icon:
+- self.add_tab_bm = wx.Bitmap(str(icon), wx.BITMAP_TYPE_ANY)
++ self.add_tab_bm = wx.Bitmap(str('/usr/share/chirp/plus-icon.png'), wx.BITMAP_TYPE_ANY)
+
+ self.add_tab_panel.Bind(wx.EVT_PAINT, self._paint_add_tab_panel)
+
+@@ -516,14 +510,7 @@
+ self.PopupMenu(menu)
+
+ def set_icon(self):
+- if sys.platform == 'win32':
+- icon = 'chirp.ico'
+- else:
+- icon = 'chirp.png'
+- with resources.as_file(
+- resources.files('chirp.share').joinpath(icon)
+- ) as path:
+- self.SetIcon(wx.Icon(str(path)))
++ self.SetIcon(wx.Icon(str('/usr/share/chirp/chirp.png')))
+
+ @property
+ def current_editorset(self):