This repository has been archived by the owner on Sep 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmainframe.py
47 lines (35 loc) · 1.51 KB
/
mainframe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
__author__ = '[email protected]'
# Import program components / modules from python standard library / non-standard modules.
import gui
import wx
import logging
import logging.config
import os
import sys
import platform
# Logging config on sub-module level.
logger = logging.getLogger(__name__)
class MainFrame(gui.MainFrame):
def __init__(self, parent):
gui.MainFrame.__init__(self, parent)
logger.debug('Running __init__ ...')
# Bind the "on close" event.
self.Bind(wx.EVT_CLOSE, self.on_close)
# Determine if program is running compiled to *.exe/*.app or from Python interpreter.
if hasattr(sys, 'frozen'):
running_mode_string = ' (frozen)'
application_path = os.path.dirname(sys.executable)
else:
running_mode_string = ' (not frozen)'
application_path = os.path.dirname(__file__)
# Set the application icon, unsupported on Mac OS X.
if platform.system() != 'Darwin':
ico = wx.Icon(application_path + os.sep + 'icon.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(ico)
# Append current version number to existing static text.
self.VersionText.SetLabelText(self.VersionText.GetLabelText() + u' 1.2.3.4' + running_mode_string)
def on_close(self, event):
logger.debug('Running on_close (event "%s", id "%i") ...' % (event.GetClassName(), event.GetId()))
# Close GUI.
self.Destroy()