dabodemo Commit
Revision 489
Date: 2007-01-23 12:11:45 -0800 (Tue, 23 Jan 2007)
Author: Nate

Changed:
A   trunk/SerialTerminal/
A   trunk/SerialTerminal/SerialSetupPanel.py
A   trunk/SerialTerminal/mainForm.py

Log:
Added a new program called the Serial Debugging Terminal.  It is basically 
Hyperterminal but far, far snazzier.  The program let's you open a serial port. 
 The program will monitor all incoming traffic from that port and also allow 
the user to send the port data.  The data can be displayed in a number of 
formats.

For now, the program is essentially a shell.  The layout is all correct, I just 
haven't implemented the backend yet.  That will be comming soon.  For now, 
enjoy....

Diff:
Added: trunk/SerialTerminal/SerialSetupPanel.py
===================================================================
--- trunk/SerialTerminal/SerialSetupPanel.py    2007-01-22 18:20:09 UTC (rev 
488)
+++ trunk/SerialTerminal/SerialSetupPanel.py    2007-01-23 20:11:45 UTC (rev 
489)
@@ -0,0 +1,61 @@
+"""
+File:                  serialSetupPanel.py
+
+Author:                        Nathan Lowrie
+
+Organization:  
+
+Description:   This file contains a Panel that includes Dabo widgets for 
setting
+       up and configuring a serial port.  The serial port object is provided 
in the 
+       panel.  Each control is also given a RegID incase you need to access 
them
+       for things like restricting baudrate choices.
+
+Dependencies:  Dabo            -> http://dabodev.com/
+                               PySerial        -> 
http://pyserial.sourceforge.net/
+"""
+
+import dabo
+import serial
+
+dabo.ui.loadUI('wx')
+
+#A Note about the serial setup Panel.  I broke it off from the others because 
this
+#Panel has the potential for reuse.  You can stick it in other applications 
without
+#having to do any redesign or changing of the code.
+class SerialSetupPanel(dabo.ui.dPanel):
+       def afterInit(self):
+               self.Sizer = dabo.ui.dSizer("vertical")
+               
+               #Set up the Control Panel
+               bs = dabo.ui.dBorderSizer(self, "vertical", Caption="Serial 
Port Setup")
+               gs = dabo.ui.dGridSizer(MaxCols=2)
+               gs.setColExpand(True, 1)
+               
+               #choices for the dropdown list
+               self.buadrateList = ('50', '75', '110', '134', '150', '200', 
'300', '600', '1200', '1800', '2400', '4800', '9600', '19200', '38400', 
'57600', '115200')
+               self.bytesizeList = ('5', '6', '7', '8')
+               self.parityList = ('N', 'E', 'O')
+               self.stopbitsList = ('1', '2')
+               
+               gs.append(dabo.ui.dLabel(self, Caption="Port"), halign="right")
+               gs.append(dabo.ui.dDropdownList(self, RegID="ddSerialPort", 
Choices=self.getAvailablePorts()), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Baudrate"), 
halign="right")
+               gs.append(dabo.ui.dDropdownList(self, RegID="ddSerialBaudrate", 
Choices=self.buadrateList), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Bytesize"), 
halign="right")
+               gs.append(dabo.ui.dDropdownList(self, RegID="ddSerialBytesize", 
Choices=self.bytesizeList), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Parity"), 
halign="right")
+               gs.append(dabo.ui.dDropdownList(self, RegID="ddSerialParity", 
Choices=self.parityList), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Stop Bits"), 
halign="right")
+               gs.append(dabo.ui.dDropdownList(self, RegID="ddSerialStopbits", 
Choices=self.stopbitsList), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Xon/Xoff control"), 
halign="right")
+               gs.append(dabo.ui.dCheckBox(self, RegID="chkSerialXonXoff", 
Caption="Enable Xon/Xoff flow control"), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Hardware control"), 
halign="right")
+               gs.append(dabo.ui.dCheckBox(self, RegID="chkSerialHardware", 
Caption="Enable Hardware flow control"), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Timeout (ms)"), 
halign="right")
+               gs.append(dabo.ui.dTextBox(self, RegID="txtSerialTimeout"), 
"expand")
+               
+               bs.append1x(gs)
+               self.Sizer.append(bs, "expand", 0)
+       
+       def getAvailablePorts(self):
+               return ["com1", "com13"]
\ No newline at end of file


Property changes on: trunk/SerialTerminal/SerialSetupPanel.py
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/SerialTerminal/mainForm.py
===================================================================
--- trunk/SerialTerminal/mainForm.py    2007-01-22 18:20:09 UTC (rev 488)
+++ trunk/SerialTerminal/mainForm.py    2007-01-23 20:11:45 UTC (rev 489)
@@ -0,0 +1,88 @@
+"""
+File:                  mainForm.py
+
+Author:                        Nathan Lowrie
+
+Organization:  
+
+Description:   This program is a utility program for debugging different Serial
+       Port interfaces like RS-232.  This program allows the The user to enter 
data
+       in various forms such as ASCII and Hex formats to be sent to the 
terminal
+       specified in the connections panel.
+
+Dependencies:  Dabo            -> http://dabodev.com/
+                               PySerial        -> 
http://pyserial.sourceforge.net/
+"""
+
+import dabo
+import serial
+
+dabo.ui.loadUI('wx')
+
+from SerialSetupPanel import SerialSetupPanel
+
+
+class SerialPanel(dabo.ui.dPanel):
+       def afterInit(self):
+               self.Sizer = dabo.ui.dSizer("horizontal")
+               
+               
########################################################################
+               # Add the setup and formatting controls 
################################
+               vs = dabo.ui.dSizer("vertical")
+               vs.DefaultSpacing = 5
+               vs.DefaultBorder= 5
+               vs.DefaultBorderAll = True
+               vs.append(SerialSetupPanel(self), "expand", 0)
+               
+               formats = ["ASCII", "Hex"]
+               
+               #set up the input and output format options
+               bs = dabo.ui.dBorderSizer(self, "vertical", Caption="Serial 
Port Setup")
+               gs = dabo.ui.dGridSizer(MaxCols=2)
+               gs.setColExpand(True, 1)
+               
+               gs.append(dabo.ui.dLabel(self, Caption="Input Format"), 
halign="right")
+               gs.append(dabo.ui.dDropdownList(self, RegID="ddInputFormat", 
Choices=formats), "expand")
+               gs.append(dabo.ui.dLabel(self, Caption="Output Format"), 
halign="right")
+               gs.append(dabo.ui.dDropdownList(self, RegID="ddOutputFormat", 
Choices=formats), "expand")
+               
+               bs.append1x(gs)
+               vs.append(bs, "expand", 0)
+               self.Sizer.append(vs, "expand", 0)
+               
+               
########################################################################
+               # Add the display controls 
#############################################
+               vs = dabo.ui.dSizer("vertical")
+               vs.DefaultSpacing = 5
+               vs.DefaultBorder= 5
+               vs.DefaultBorderAll = True
+               
+               #add the serial input command
+               bs = dabo.ui.dBorderSizer(self, "vertical", Caption="Serial 
Input")
+               bs.append1x(dabo.ui.dTextBox(self, RegID="txtSerialInput"))
+               vs.append(bs, "Expand", 0)
+               
+               #add the serial transfer viewscreen
+               bs = dabo.ui.dBorderSizer(self, "vertical", Caption="Serial 
Transfer Viewscreen")
+               bs.append1x(dabo.ui.dEditBox(self, RegID="edtSerialTransfer"))
+               vs.append1x(bs)
+               self.Sizer.append1x(vs)
+       
+       
+
+
+class mainForm(dabo.ui.dForm):
+       def afterInit(self):
+               self.Sizer = dabo.ui.dSizer("vertical")
+               self.Sizer.append1x(SerialPanel(self))
+               self.Sizer.layout()
+       
+       def initProperties(self):
+               self.Caption = "Serial Debugging Terminal"
+               self.Size = (500,500)
+
+
+if __name__ == "__main__":
+       app = dabo.dApp()
+       app.MainFormClass = mainForm
+       app.start()
\ No newline at end of file


Property changes on: trunk/SerialTerminal/mainForm.py
___________________________________________________________________
Name: svn:executable
   + *




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to