Commit 5226bc29 authored by Guillaume Seguin's avatar Guillaume Seguin

Factor Windows-binary-specific hack for icons loading

parent 495cbaea
......@@ -19,7 +19,7 @@ import os
# Set up Internationalization using gettext
# searching for installed locales on /usr/share; uses relative folder if not found (windows)
from printrun.printrun_utils import install_locale
from printrun.printrun_utils import install_locale, iconfile
install_locale('plater')
import wx
......@@ -30,7 +30,6 @@ import sys
import traceback
from printrun import stltool
from printrun.printrun_utils import pixmapfile
glview = False
if "-nogl" not in sys.argv:
......@@ -235,10 +234,7 @@ class stlwin(wx.Frame):
def __init__(self, filenames = [], size = (800, 580), callback = None, parent = None, build_dimensions = None):
wx.Frame.__init__(self, parent, title = _("Plate building tool"), size = size)
self.filenames = filenames
if hasattr(sys, "frozen") and sys.frozen == "windows_exe":
self.SetIcon(wx.Icon(sys.executable, wx.BITMAP_TYPE_ICO))
else:
self.SetIcon(wx.Icon(pixmapfile("plater.ico"), wx.BITMAP_TYPE_ICO))
self.SetIcon(wx.Icon(iconfile("plater.ico"), wx.BITMAP_TYPE_ICO))
self.mainsizer = wx.BoxSizer(wx.HORIZONTAL)
self.panel = wx.Panel(self, -1, size = (150, 600), pos = (0, 0))
#self.panel.SetBackgroundColour((10, 10, 10))
......
......@@ -29,6 +29,12 @@ def install_locale(domain):
else:
gettext.install(domain, './locale', unicode = 1)
def iconfile(filename):
if hasattr(sys, "frozen") and sys.frozen == "windows_exe":
return sys.executable
else:
return pixmapfile("plater.ico")
def imagefile(filename):
for prefix in ['/usr/local/share/pronterface/images',
'/usr/share/pronterface/images']:
......
......@@ -45,7 +45,7 @@ layerindex = 0
if os.name == "nt":
winsize = (800, 530)
from printrun.printrun_utils import pixmapfile, configfile
from printrun.printrun_utils import iconfile, configfile
from printrun.gui import MainWindow
from printrun.excluder import Excluder
import pronsole
......@@ -218,10 +218,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.filename = filename
os.putenv("UBUNTU_MENUPROXY", "0")
MainWindow.__init__(self, None, title = _("Pronterface"), size = size)
if hasattr(sys, "frozen") and sys.frozen == "windows_exe":
self.SetIcon(wx.Icon(sys.executable, wx.BITMAP_TYPE_ICO))
else:
self.SetIcon(wx.Icon(pixmapfile("P-face.ico"), wx.BITMAP_TYPE_ICO))
self.SetIcon(wx.Icon(iconfile("P-face.ico"), wx.BITMAP_TYPE_ICO))
self.statuscheck = False
self.status_thread = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment