diff --git a/resources/icon.svg b/resources/icon.svg new file mode 100644 index 0000000..bae3a69 --- /dev/null +++ b/resources/icon.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + diff --git a/src/pycestorieseditor/wxlaunch.py b/src/pycestorieseditor/wxlaunch.py index dbeedff..9819846 100644 --- a/src/pycestorieseditor/wxlaunch.py +++ b/src/pycestorieseditor/wxlaunch.py @@ -6,6 +6,7 @@ from itertools import count import wx +import wx.svg import wx.lib.stattext as wxst from wx.lib.agw.multidirdialog import MultiDirDialog from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin @@ -29,6 +30,95 @@ logger = logging.getLogger(__name__) LAUNCH_SETTINGS = False +svgicon = b"""\ + + + + + + + + + + + + + + + +""" + + +class ArtProvider(wx.ArtProvider): + def CreateBitmap(self, id_art, client, size): + if size == wx.DefaultSize: + size = wx.Size(32, 32) + if id_art == 'ICON': + svg = wx.svg.SVGimage.CreateFromBytes(svgicon) + return svg.ConvertToScaledBitmap(size) + return wx.NullBitmap + class CeListPathItem(wx.ListItem): _wid = count() @@ -356,19 +446,7 @@ def _show_warning(self, txt: str): class CeStoriesViewer(wx.App): def OnInit(self): - global LAUNCH_SETTINGS self.SetAppName(APPNAME) - if PORTABLE: - conf = get_config("settings") - if os.path.exists(conf) and not LAUNCH_SETTINGS: - window = MainWindow(conf) - else: - window = CeSettingsWindow(None, conf) - else: - raise Exception("Non portable version not written yet.") - - window.Show() - self.SetTopWindow(window) return True @@ -376,4 +454,17 @@ def launch(settings=False): global LAUNCH_SETTINGS LAUNCH_SETTINGS = settings app = CeStoriesViewer() + wx.ArtProvider.Push(ArtProvider()) + + if PORTABLE: + conf = get_config("settings") + if os.path.exists(conf) and not LAUNCH_SETTINGS: + window = MainWindow(conf) + else: + window = CeSettingsWindow(None, conf) + else: + raise Exception("Non portable version not written yet.") + + window.Show() + app.SetTopWindow(window) app.MainLoop() diff --git a/src/pycestorieseditor/wxui.py b/src/pycestorieseditor/wxui.py index 70f467d..f43321a 100644 --- a/src/pycestorieseditor/wxui.py +++ b/src/pycestorieseditor/wxui.py @@ -1537,6 +1537,7 @@ class MainWindow(wx.Frame): def __init__(self, conffile, *args, **kwds): kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE super().__init__(None, wx.ID_ANY, *args, title="CE Events Visualizer", **kwds) + self.SetIcon(wx.ArtProvider.GetIcon('ICON')) self._conffile = conffile self._load_conf() bbx = get_bigbadxml() @@ -1674,6 +1675,7 @@ def _load_conf(self): maximum=1, style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_SMOOTH, ) + dialog.SetIcon(wx.ArtProvider.GetIcon('ICON')) def pulse(m=None): if not m: