mirror of https://github.com/chriskiehl/Gooey.git
16 changed files with 204 additions and 57 deletions
Unified View
Diff Options
-
22src/app/dialogs/base_window.py
-
2src/app/dialogs/basic_config_panel.py
-
23src/app/dialogs/controller.py
-
8src/app/dialogs/display_main.py
-
52src/app/dialogs/footer.py
-
BINsrc/app/dialogs/footer.pyc
-
31src/app/dialogs/header.py
-
BINsrc/app/dialogs/header.pyc
-
72src/app/dialogs/runtime_display_panel.py
-
2src/app/dialogs/window.py
-
BINsrc/app/images/harwen_monitor.png
-
1src/app/images/image_store.py
-
BINsrc/app/images/image_store.pyc
-
39src/experiments/thread_interupt.py
-
4src/languages/eng.py
-
5src/languages/english.json
@ -0,0 +1,72 @@ |
|||||
|
''' |
||||
|
Created on Dec 23, 2013 |
||||
|
|
||||
|
@author: Chris |
||||
|
''' |
||||
|
|
||||
|
import wx |
||||
|
import sys |
||||
|
import Queue |
||||
|
import threading |
||||
|
from model.i18n import I18N |
||||
|
|
||||
|
class MessagePump(object): |
||||
|
def __init__(self, queue): |
||||
|
self.queue = queue |
||||
|
self.stdout = sys.stdout |
||||
|
|
||||
|
# Overrides stdout's write method |
||||
|
def write(self, text): |
||||
|
if text != '': |
||||
|
self.queue.put(text) |
||||
|
|
||||
|
|
||||
|
class Listener(threading.Thread): |
||||
|
def __init__(self, queue, textbox): |
||||
|
threading.Thread.__init__(self) |
||||
|
self.queue = queue |
||||
|
self.update_text = lambda x: textbox.AppendText(x) |
||||
|
|
||||
|
def run(self): |
||||
|
while True: |
||||
|
try: |
||||
|
stdout_msg = self.queue.get(timeout=1) |
||||
|
if stdout_msg != '': |
||||
|
self.update_text(stdout_msg) |
||||
|
except Exception as e: |
||||
|
pass # Timeout. Aint nobody care 'bout dat |
||||
|
|
||||
|
class RuntimeDisplay(wx.Panel): |
||||
|
def __init__(self, parent, **kwargs): |
||||
|
wx.Panel.__init__(self, parent, **kwargs) |
||||
|
|
||||
|
self._translator = I18N() |
||||
|
|
||||
|
self._init_properties() |
||||
|
self._init_components() |
||||
|
self._do_layout() |
||||
|
|
||||
|
self.queue = Queue.Queue() |
||||
|
_stdout = sys.stdout |
||||
|
sys.stdout = MessagePump(self.queue) |
||||
|
listener = Listener(self.queue, self.cmd_textbox) |
||||
|
listener.start() |
||||
|
|
||||
|
def _init_properties(self): |
||||
|
self.SetBackgroundColour('#F0F0F0') |
||||
|
|
||||
|
def _init_components(self): |
||||
|
self.text = wx.StaticText(self, label=self._translator["status"]) |
||||
|
self.cmd_textbox = wx.TextCtrl( |
||||
|
self, -1, "", |
||||
|
style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH) |
||||
|
|
||||
|
def _do_layout(self): |
||||
|
sizer = wx.BoxSizer(wx.VERTICAL) |
||||
|
sizer.AddSpacer(10) |
||||
|
sizer.Add(self.text, 0, wx.LEFT, 30) |
||||
|
sizer.AddSpacer(10) |
||||
|
sizer.Add(self.cmd_textbox, 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 30) |
||||
|
sizer.AddSpacer(20) |
||||
|
self.SetSizer(sizer) |
||||
|
|
@ -0,0 +1,39 @@ |
|||||
|
''' |
||||
|
Created on Jan 26, 2014 |
||||
|
|
||||
|
@author: Chris |
||||
|
''' |
||||
|
|
||||
|
import time |
||||
|
import threading |
||||
|
from multiprocessing import Process |
||||
|
|
||||
|
class MyClass(threading.Thread): |
||||
|
''' |
||||
|
classdocs |
||||
|
''' |
||||
|
def __init__(self): |
||||
|
threading.Thread.__init__(self) |
||||
|
self.start_time = time.time() |
||||
|
|
||||
|
def run(self): |
||||
|
while time.time() - self.start_time < 10: |
||||
|
pass |
||||
|
|
||||
|
def throw_exception(self): |
||||
|
raise KeyboardInterrupt |
||||
|
|
||||
|
|
||||
|
if __name__ == '__main__': |
||||
|
a = MyClass() |
||||
|
a.start() |
||||
|
|
||||
|
time.sleep(2) |
||||
|
a.exit() |
||||
|
time.sleep(2) |
||||
|
print a.is_alive() |
||||
|
|
||||
|
a.join() |
||||
|
|
||||
|
|
||||
|
|
@ -1,9 +1,12 @@ |
|||||
{ |
{ |
||||
"cancel": "Cancel", |
"cancel": "Cancel", |
||||
|
"close_program": "Close Program?", |
||||
"next": "Next", |
"next": "Next", |
||||
"optional_args_msg": "Optional Arguments", |
"optional_args_msg": "Optional Arguments", |
||||
"required_args_msg": "Required Arguments", |
"required_args_msg": "Required Arguments", |
||||
"running": "Running", |
"running": "Running", |
||||
"settings": "Settings", |
"settings": "Settings", |
||||
"simple_config": "Enter Command Line Arguments" |
|
||||
|
"simple_config": "Enter Command Line Arguments", |
||||
|
"status": "Status", |
||||
|
"sure_you_want_to_exit": "Are you sure you want to exit?" |
||||
} |
} |
Write
Preview
Loading…
Cancel
Save