summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2015-10-14 18:14:27 +0200
committerChris Liechti <cliechti@gmx.net>2015-10-14 18:14:27 +0200
commitd7e9e9e30a7d3cf4f6cda59ad660357f061917e6 (patch)
tree76e8a5341806118933060e42d343e67940e18d5b /examples
parent5665d573ec17de30e1be00a01d3444bcea91a724 (diff)
downloadpyserial-git-d7e9e9e30a7d3cf4f6cda59ad660357f061917e6.tar.gz
wxTerminal: center dialogs on parent, make "ESC" key work in TerminalSettingsDialog
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/wxTerminal.py10
-rw-r--r--examples/wxTerminal.wxg6
2 files changed, 9 insertions, 7 deletions
diff --git a/examples/wxTerminal.py b/examples/wxTerminal.py
index fa5d7d6..a02a418 100755
--- a/examples/wxTerminal.py
+++ b/examples/wxTerminal.py
@@ -72,8 +72,8 @@ class TerminalSettingsDialog(wx.Dialog):
self.checkbox_unprintable = wx.CheckBox(self, -1, "Show unprintable characters")
self.radio_box_newline = wx.RadioBox(self, -1, "Newline Handling", choices=["CR only", "LF only", "CR+LF"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
self.sizer_4_staticbox = wx.StaticBox(self, -1, "Input/Output")
- self.button_ok = wx.Button(self, -1, "OK")
- self.button_cancel = wx.Button(self, -1, "Cancel")
+ self.button_ok = wx.Button(self, wx.ID_OK, "")
+ self.button_cancel = wx.Button(self, wx.ID_CANCEL, "")
self.__set_properties()
self.__do_layout()
@@ -138,7 +138,7 @@ class TerminalFrame(wx.Frame):
# begin wxGlade: TerminalFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
-
+
# Menu Bar
self.frame_terminal_menubar = wx.MenuBar()
wxglade_tmp_menu = wx.Menu()
@@ -196,7 +196,7 @@ class TerminalFrame(wx.Frame):
# begin wxGlade: TerminalFrame.__set_properties
self.SetTitle("Serial Terminal")
self.SetSize((546, 383))
- self.text_ctrl_output.SetFont(wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, ""))
+ self.text_ctrl_output.SetFont(wx.Font(9, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, ""))
# end wxGlade
def __do_layout(self):
@@ -263,6 +263,7 @@ class TerminalFrame(wx.Frame):
"",
show=wxSerialConfigDialog.SHOW_BAUDRATE | wxSerialConfigDialog.SHOW_FORMAT | wxSerialConfigDialog.SHOW_FLOW,
serial=self.serial) as dialog_serial_cfg:
+ dialog_serial_cfg.CenterOnParent()
result = dialog_serial_cfg.ShowModal()
# open port if not called on startup, open it on startup and OK too
if result == wx.ID_OK or event is not None:
@@ -294,6 +295,7 @@ class TerminalFrame(wx.Frame):
with the current terminal settings.
"""
with TerminalSettingsDialog(self, -1, "", settings=self.settings) as dialog:
+ dialog.CenterOnParent()
dialog.ShowModal()
def OnKey(self, event):
diff --git a/examples/wxTerminal.wxg b/examples/wxTerminal.wxg
index b74bb31..d09e4ec 100644
--- a/examples/wxTerminal.wxg
+++ b/examples/wxTerminal.wxg
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- generated by wxGlade 0.6.5 on Sat Sep 12 02:36:17 2015 -->
+<!-- generated by wxGlade 0.6.5 on Wed Oct 14 18:12:48 2015 -->
<application path="wxTerminal.py" name="app" class="MyApp" option="0" language="python" top_window="frame_terminal" encoding="ISO-8859-1" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0" indent_amount="4" indent_symbol="space" source_extension=".cpp" header_extension=".h">
<object class="TerminalFrame" name="frame_terminal" base="EditFrame">
@@ -136,15 +136,15 @@
<border>0</border>
<option>0</option>
<object class="wxButton" name="button_ok" base="EditButton">
+ <stockitem>OK</stockitem>
<default>1</default>
- <label>OK</label>
</object>
</object>
<object class="sizeritem">
<border>0</border>
<option>0</option>
<object class="wxButton" name="button_cancel" base="EditButton">
- <label>Cancel</label>
+ <stockitem>CANCEL</stockitem>
</object>
</object>
</object>