Fixing window title

This commit is contained in:
Alexis Delhaie
2020-12-15 17:05:39 +01:00
parent 749c14c488
commit 27f7027219

14
main.py
View File

@@ -8,6 +8,7 @@ import requests
import wx import wx
from wx import Size, Point from wx import Size, Point
## Installer configuration
REPO_URL = "https://alexisdelhaie.ovh/dlcenter/chronos-repo/installer/" REPO_URL = "https://alexisdelhaie.ovh/dlcenter/chronos-repo/installer/"
VERSION_FILE = "version" VERSION_FILE = "version"
COMPANY_NAME = "alexlegarnd" COMPANY_NAME = "alexlegarnd"
@@ -19,6 +20,7 @@ INSTALLED_VERSION_PATH = "{}\\{}".format(INSTALL_FOLDER, VERSION_FILE)
EXECUTABLE = "Install.exe" EXECUTABLE = "Install.exe"
EXECUTABLE_PATH = "{}\\{}".format(INSTALL_FOLDER, EXECUTABLE) EXECUTABLE_PATH = "{}\\{}".format(INSTALL_FOLDER, EXECUTABLE)
FILES = ["libeay32.dll", "ssleay32.dll", "7z.dll", EXECUTABLE] FILES = ["libeay32.dll", "ssleay32.dll", "7z.dll", EXECUTABLE]
WINDOW_TITLE = "Chronos Installer"
def create_install_folder(): def create_install_folder():
@@ -68,12 +70,12 @@ def is_admin():
class MyApplication(wx.App): class MyApplication(wx.App):
def OnInit(self): def OnInit(self):
self.SetAppName("EndPoint installer") self.SetAppName(WINDOW_TITLE)
if is_admin(): if is_admin():
self.main() self.main()
else: else:
dlg = wx.MessageDialog(None, "This application requires administrative privileges to run", dlg = wx.MessageDialog(None, "This application requires administrative privileges to run",
"EndPoint installer", style=wx.OK | wx.ICON_HAND) WINDOW_TITLE, style=wx.OK | wx.ICON_HAND)
dlg.ShowModal() dlg.ShowModal()
dlg.Destroy() dlg.Destroy()
return True return True
@@ -83,7 +85,7 @@ class MyApplication(wx.App):
create_install_folder() create_install_folder()
self.clean() self.clean()
if get_installed_version() != version: if get_installed_version() != version:
dlg = MyDialog(None, -1, "EndPoint installer", Size(400, 120)) dlg = MyDialog(None, -1, WINDOW_TITLE, Size(400, 120))
dlg.Show() dlg.Show()
self.clean_folder(INSTALL_FOLDER) self.clean_folder(INSTALL_FOLDER)
for file in FILES: for file in FILES:
@@ -98,7 +100,7 @@ class MyApplication(wx.App):
subprocess.Popen([EXECUTABLE_PATH], cwd=INSTALL_FOLDER) subprocess.Popen([EXECUTABLE_PATH], cwd=INSTALL_FOLDER)
else: else:
dlg = wx.MessageDialog(None, "Installer executable not found", dlg = wx.MessageDialog(None, "Installer executable not found",
"EndPoint installer", style=wx.OK | wx.ICON_HAND) WINDOW_TITLE, style=wx.OK | wx.ICON_HAND)
dlg.ShowModal() dlg.ShowModal()
dlg.Destroy() dlg.Destroy()
@@ -114,7 +116,7 @@ class MyApplication(wx.App):
shutil.rmtree(file_path) shutil.rmtree(file_path)
except Exception as e: except Exception as e:
dlg = wx.MessageDialog(self, 'Failed to delete {}. Reason: {}'.format(file_path, e), dlg = wx.MessageDialog(self, 'Failed to delete {}. Reason: {}'.format(file_path, e),
"EndPoint installer", style=wx.OK | wx.ICON_HAND) WINDOW_TITLE, style=wx.OK | wx.ICON_HAND)
dlg.ShowModal() dlg.ShowModal()
dlg.Destroy() dlg.Destroy()
@@ -132,7 +134,7 @@ class MyDialog(wx.Dialog):
def __init__(self, parent, i, title, size=wx.DefaultSize): def __init__(self, parent, i, title, size=wx.DefaultSize):
wx.Dialog.__init__(self) wx.Dialog.__init__(self)
self.Create(parent, i, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE, 'EndPoint installer') self.Create(parent, i, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE, WINDOW_TITLE)
self.Centre() self.Centre()
self.panel = wx.Panel(self) self.panel = wx.Panel(self)
self.status = wx.StaticText(self.panel, label="-------------------------------------------", pos=Point(17, 10)) self.status = wx.StaticText(self.panel, label="-------------------------------------------", pos=Point(17, 10))