Changeset 376
- Timestamp:
- 04/02/12 08:00:40 (10 years ago)
- Location:
- trunk/Puzzlebox/Synapse
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Puzzlebox/Synapse/Interface.py
r375 r376 62 62 import pickle 63 63 64 64 65 from Interface_Design import Ui_Form as Design 65 66 … … 69 70 import Puzzlebox.Synapse.ThinkGear.Server as thinkgear_server 70 71 import Puzzlebox.Synapse.Emotiv.Server as emotiv_server 71 #import puzzlebox_logger72 72 73 73 … … 116 116 117 117 def __init__(self, log, \ 118 server=None, \119 118 DEBUG=DEBUG, \ 120 119 parent=None, \ … … 155 154 QtCore.SIGNAL("timeout()"), \ 156 155 self.updateInterface) 156 157 158 159 self.activePlugins = [] 160 161 162 ################################################################## 163 164 def configureSettings(self): 165 166 # Synapse Interface 167 image_path = "puzzlebox.ico" 168 if not os.path.exists(image_path): 169 image_path = os.path.join(DEFAULT_IMAGE_PATH, image_path) 170 171 if os.path.exists(image_path): 172 icon = QtGui.QIcon() 173 icon.addPixmap(QtGui.QPixmap(image_path), \ 174 QtGui.QIcon.Normal, \ 175 QtGui.QIcon.Off) 176 self.setWindowIcon(icon) 177 178 image_path = "puzzlebox_logo.png" 179 if not os.path.exists(image_path): 180 image_path = os.path.join(DEFAULT_IMAGE_PATH, image_path) 181 if os.path.exists(image_path): 182 self.labelPuzzleboxIcon.setPixmap(QtGui.QPixmap(image_path)) 157 183 158 184 … … 180 206 print "DEBUG: User default path not found" 181 207 self.homepath = os.getcwd() 182 183 184 self.activePlugins = []185 186 187 ##################################################################188 189 def configureSettings(self):190 191 # Synapse Interface192 image_path = "puzzlebox.ico"193 if not os.path.exists(image_path):194 image_path = os.path.join(DEFAULT_IMAGE_PATH, image_path)195 196 if os.path.exists(image_path):197 icon = QtGui.QIcon()198 icon.addPixmap(QtGui.QPixmap(image_path), \199 QtGui.QIcon.Normal, \200 QtGui.QIcon.Off)201 self.setWindowIcon(icon)202 203 image_path = "puzzlebox_logo.png"204 if not os.path.exists(image_path):205 image_path = os.path.join(DEFAULT_IMAGE_PATH, image_path)206 if os.path.exists(image_path):207 self.labelPuzzleboxIcon.setPixmap(QtGui.QPixmap(image_path))208 208 209 209 … … 294 294 ################################################################## 295 295 296 def updateInterface(self): 297 298 if not self.synapseServer.emulate_headset_data: 299 #self.processPacketThinkGear( \ 300 self.processPacketEEG( \ 301 self.synapseServer.protocol.data_packet) 302 303 304 ################################################################## 305 306 def updateDevices(self): 307 308 if (self.parent != None): 309 source = self.parent 310 else: 311 source = self 312 313 model = source.comboBoxEEGHeadsetModel.currentText() 314 315 devices = self.searchForDevices() 316 317 source.comboBoxDeviceSelect.clear() 318 319 if (model == 'NeuroSky MindWave' or \ 320 model == 'NeuroSky MindSet' or \ 321 model == 'NeuroSky MindWave Mobile'): 322 323 devices.insert(0, 'ThinkGear Emulator') 324 325 elif (model == 'Emotiv EPOC'): 326 327 devices.insert(0, 'EmoComposer') 328 devices.insert(0, 'Emotiv Control Panel') 329 330 331 for device in devices: 332 source.comboBoxDeviceSelect.addItem(device) 333 334 335 ################################################################## 336 296 337 def startSynapseServer(self): 297 338 298 339 eeg_headset_model = str(self.comboBoxEEGHeadsetModel.currentText()) 299 device_address = str(self.comboBoxDeviceSelect.currentText())340 #device_address = str(self.comboBoxDeviceSelect.currentText()) 300 341 server_interface = str(self.lineEditSynapseHost.text()) 301 342 server_port = int(self.lineEditSynapsePort.text()) … … 366 407 367 408 eeg_headset_model = str(self.comboBoxEEGHeadsetModel.currentText()) 368 device_address = str(self.comboBoxDeviceSelect.currentText())409 #device_address = str(self.comboBoxDeviceSelect.currentText()) 369 410 370 411 if ((eeg_headset_model == 'NeuroSky MindWave Mobile') or \ … … 551 592 ################################################################## 552 593 553 def updateInterface(self):554 555 if not self.synapseServer.emulate_headset_data:556 #self.processPacketThinkGear( \557 self.processPacketEEG( \558 self.synapseServer.protocol.data_packet)559 560 561 ##################################################################562 563 def updateDevices(self):564 565 if (self.parent != None):566 source = self.parent567 else:568 source = self569 570 model = source.comboBoxEEGHeadsetModel.currentText()571 572 devices = self.searchForDevices()573 574 source.comboBoxDeviceSelect.clear()575 576 if (model == 'NeuroSky MindWave' or \577 model == 'NeuroSky MindSet' or \578 model == 'NeuroSky MindWave Mobile'):579 580 devices.insert(0, 'ThinkGear Emulator')581 582 elif (model == 'Emotiv EPOC'):583 584 devices.insert(0, 'EmoComposer')585 devices.insert(0, 'Emotiv Control Panel')586 587 588 for device in devices:589 source.comboBoxDeviceSelect.addItem(device)590 591 592 ##################################################################593 594 594 def processPacketEEG(self, packet): 595 595 … … 622 622 return 623 623 else: 624 # NOTE: This is also logging Emotiv packets to 'signals' 624 625 self.packets['signals'].append(packet) 625 626 -
trunk/Puzzlebox/Synapse/Server.py
r375 r376 33 33 from PyQt4 import QtCore, QtGui, QtNetwork 34 34 35 35 36 ##################################################################### 36 37 # Globals -
trunk/Puzzlebox/Synapse/Session.py
r374 r376 46 46 DEBUG = configuration.DEBUG 47 47 48 PACKET_MINIMUM_TIME_DIFFERENCE_THRESHOLD = 0.75 49 48 50 49 51 ##################################################################### … … 117 119 session_time = self.calculateSessionTime() 118 120 119 if source == None: 120 if self.parent == None: 121 source = self 122 else: 123 source = self.parent 124 125 if target == None: 126 if self.parent == None: 127 target = self 128 else: 129 target = self.parent 130 131 target.textLabelSessionTime.setText(session_time) 121 #if source == None: 122 #if self.parent == None: 123 #source = self 124 #else: 125 #source = self.parent 126 127 #if target == None: 128 #if self.parent == None: 129 #target = self 130 #else: 131 #target = self.parent 132 133 #target.textLabelSessionTime.setText(session_time) 134 self.textLabelSessionTime.setText(session_time) 132 135 133 136 try: 134 target.textLabelPacketsReceived.setText( "%i" % \ 135 source.synapseServer.protocol.packet_count) 137 #target.textLabelPacketsReceived.setText( "%i" % \ 138 #source.synapseServer.protocol.packet_count) 139 self.textLabelPacketsReceived.setText( "%i" % \ 140 self.synapseServer.protocol.packet_count) 136 141 except: 137 142 pass 138 143 139 144 try: 140 target.textLabelPacketsDropped.setText( "%i" % \ 141 source.synapseServer.protocol.bad_packets) 145 #target.textLabelPacketsDropped.setText( "%i" % \ 146 #source.synapseServer.protocol.bad_packets) 147 self.textLabelPacketsDropped.setText( "%i" % \ 148 self.synapseServer.protocol.bad_packets) 142 149 except: 143 150 pass … … 148 155 def calculateSessionTime(self): 149 156 150 if self.parent == None:151 server = self.synapseServer152 else:153 server = self.parent.synapseServer157 #if self.parent == None: 158 #server = self.synapseServer 159 #else: 160 #server = self.parent.synapseServer 154 161 155 162 session_time = time.time() - \ 156 server.session_start_timestamp 163 self.synapseServer.session_start_timestamp 164 #server.session_start_timestamp 157 165 #server.protocol.session_start_timestamp 158 166
Note: See TracChangeset
for help on using the changeset viewer.