@@ -32,18 +32,7 @@ def __init__(self, args, parent=None):
3232 super (MainWindow , self ).__init__ (parent )
3333 self .setupUi (self )
3434 rightClick (self )
35- '''
36- pal = QPalette()
37- pal.setColor(QPalette.Background, QColor(125,125 ,125))
38-
39- self.setAutoFillBackground(True)
40- self.setPalette(pal)
41- '''
42- print (args )
4335 self .initForms ()
44-
45- #self.comboBoxBaud.setCurrentIndex(len(bauds) - 1)
46-
4736
4837 def initForms (self ):
4938
@@ -54,48 +43,39 @@ def initForms(self):
5443 self .comboBoxPort .addItems (ports )
5544 print (ports )
5645 else :
57- #todo:scan system serial port
5846 self .__scanSerialPorts__ ()
59-
47+ # setting bauds and get serial port
6048 bauds = ["50" ,"75" ,"134" ,"110" ,"150" ,"200" ,"300" ,"600" ,"1200" ,"2400" ,"4800" ,"9600" ,"14400" ,"19200" ,"38400" ,"56000" ,"57600" ,
6149 "115200" ]
6250 self .comboBoxBaud .addItems (bauds )
6351 self .comboBoxBaud .setCurrentIndex (len (bauds ) - 1 )
64-
52+ # setting Checkbox
6553 checks = ["None" ,"Odd" ,"Even" ,"Zero" ,"One" ]
6654 self .comboBoxCheckSum .addItems (checks )
6755 self .comboBoxCheckSum .setCurrentIndex (len (checks ) - 1 )
68-
56+ # setting start Bit of the hex
6957 bits = ["4 Bits" , "5 Bits" ,"6 Bits" , "7 Bits" , "8 Bits" ]
7058 self .comboBoxBits .addItems (bits )
7159 self .comboBoxBits .setCurrentIndex (len (bits ) - 1 )
72-
60+ #setting stop bit of the box
7361 stopbits = ["1 Bit" ,"1.5 Bits" ,"2 Bits" ];
7462 self .comboBoxStopBits .addItems (stopbits )
7563 self .comboBoxStopBits .setCurrentIndex (0 )
76-
77-
78- #self._auto_send_signal.connect(self.__auto_send_update__)
79-
64+ # get the comboBox get number
8065 port = self .comboBoxPort .currentText ()
8166 baud = int ("%s" % self .comboBoxBaud .currentText (), 10 )
8267 self ._serial_context_ = serialportcontext .SerialPortContext (port = port ,baud = baud )
8368
84- # self.lineEditReceivedCounts.setText("0")
85- # self.lineEditSentCounts.setText("0")
8669 self .pushButtonOpenSerial .clicked .connect (self .__open_serial_port__ )
87- # self.pushButtonClearRecvArea.clicked.connect(self.__clear_recv_area__)
8870 self .pushButtonSendData .clicked .connect (self .__send_data__ )
8971 self ._receive_signal .connect (self .__display_recv_data__ )
90- # self.pushButtonOpenRecvFile.clicked.connect(self.__save_recv_file__)
9172 self .actionSend .triggered .connect (self .__open_send_file__ )
9273 self .actionOpenGL .triggered .connect (self .__opengl__ )
9374 self .actionVrep .triggered .connect (self .__teset__ )
9475 self ._send_file_data = ''
9576 self .numberx = 0
9677 self .numbery = 0
9778 self .numberz = 0
98- #self.__control__()
9979 self .actionControl .triggered .connect (self .__control__ )
10080
10181 ##machine_control button setting
@@ -107,9 +87,8 @@ def initForms(self):
10787 self .zupButton .clicked .connect (self .__zupButton__ )
10888 self .zdownButton .clicked .connect (self .__zdownButton__ )
10989 self .graphyViewModule .insertWidget (1 , graphy ())
110- # def __auto_send_update__(self):
111- # self.lineEditSentCounts.setText("%d" % self._serial_context_.getSendCounts())
11290
91+ #TODO: context menu not yet
11392 @pyqtSlot (QPoint )
11493 def on_treeWidget_context_menu (self , point ):
11594 action = self .popMenu_treeWidget .exec_ (self .treeWidget .mapToGlobal (point ))
@@ -126,14 +105,7 @@ def on_treeWidget_context_menu(self, point):
126105 except :
127106 print ("No select" )
128107 elif action == self .action_treeWidget_send :
129- try :
130- ## 0807 not yet to do
131- data = 'asa'
132- if self ._serial_context_ .isRunning ():
133- if len (data ) > 0 : self ._serial_context_ .send (data , 0 )
134- print (self .tree .currentItem ().takeChildren ())
135- except :
136- pass
108+ self .graphyViewModule ()
137109
138110
139111 def reflesh (self ):
@@ -177,7 +149,7 @@ def __control__(self):
177149 print ("control open" )
178150 dlg = Machine ()
179151 dlg .show ()
180- if dlg .exec_ (): pass
152+ dlg .exec_ ()
181153
182154 def __open_send_file__ (self ):
183155 filename = QFileDialog .getOpenFileName (self , caption = "Open Send File" )
@@ -326,7 +298,7 @@ def __open_serial_port__(self):
326298 self .pushButtonOpenSerial .setText (u'close' )
327299 except Exception as e :
328300 print ("error" )
329- #QtGui.QMessageBox.critical(self,u"打开端口 ",u"打开端口失败,请检查 !")
301+ #QtGui.QMessageBox.critical(self,u"Open port ",u"please check the port !")
330302
331303 def __clear_recv_area__ (self ): self .textEditReceived .clear ()
332304 def __clear_send_area__ (self ): self .textEditSent .clear ()
@@ -411,20 +383,6 @@ def on_homeButton_clicked(self):
411383
412384
413385
414- @pyqtSlot (QTreeWidgetItem , QTreeWidgetItem )
415- def on_tree_currentItemChanged (self , current , previous ):
416- """
417- Slot documentation goes here.
418-
419- @param current DESCRIPTION
420- @type QTreeWidgetItem
421- @param previous DESCRIPTION
422- @type QTreeWidgetItem
423- """
424- # TODO: not implemented yet
425- #print(current.text(0))
426-
427-
428386 @pyqtSlot (QTreeWidgetItem , int )
429387 def on_tree_itemChanged (self , item , column ):
430388 if column == 0 :
0 commit comments