-
Notifications
You must be signed in to change notification settings - Fork 0
/
WhitebearEditor.py
executable file
·47 lines (36 loc) · 1.62 KB
/
WhitebearEditor.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
#!/usr/bin/python3
"""
Starting class for the whitebear editor GUI. This class is necessary and must be in all wx python programs.
OnInit must be overridden here.
# TODO fix bugs and package this into a binary. Package into rpm.
# TODO https://www.blog.pythonlibrary.org/2019/03/19/distributing-a-wxpython-application/
# TODO https://discuss.wxpython.org/t/cropping-an-image-with-wxpython/34983/6 for logos?
# TODO search for todos.
# TODO richtext control does not yet support red waved underline, change underline once available.
# TODO look at cookies from whitebear using requests headers, beware of redirect, set cookie warning if we use them?
"""
import wx
import wx.adv
from Constants.Constants import Strings
from Gui.Frames.MainFrame import MainFrame
class WhitebearEditor(wx.App):
"""
Main class for running the gui.
"""
def __init__(self, redirect, filename):
wx.App.__init__(self, redirect, filename)
self._frame = None
def OnInit(self):
# Frame with None parent is a top level frame. This frame must be created after the App object is created.
self._frame = MainFrame()
# Optional set the frame as the main one, the main window is the default parent for dialogs without parent set.
self.SetTopWindow(self._frame)
self._frame.Show()
return True
def OnExit(self):
print('_Done_')
return True
if __name__ == "__main__":
# Redirect allows the gui to show a window with std and err text output, or if set, send it to a file.
app = WhitebearEditor(redirect=False, filename=Strings.editor_output_debug_file)
app.MainLoop()