Project/ProjectInterfacesBrowser.py

changeset 500
c3abc7895a01
parent 476
121633976eca
child 501
5c615a85241a
equal deleted inserted replaced
499:622ab17a68d5 500:c3abc7895a01
29 29
30 class ProjectInterfacesBrowser(ProjectBaseBrowser): 30 class ProjectInterfacesBrowser(ProjectBaseBrowser):
31 """ 31 """
32 A class used to display the interfaces (IDL) part of the project. 32 A class used to display the interfaces (IDL) part of the project.
33 33
34 @signal sourceFile(string, int = 0) emitted to open a file
34 @signal closeSourceWindow(string) emitted after a file has been removed/deleted 35 @signal closeSourceWindow(string) emitted after a file has been removed/deleted
35 from the project 36 from the project
36 @signal appendStdout(string) emitted after something was received from 37 @signal appendStdout(string) emitted after something was received from
37 a QProcess on stdout 38 a QProcess on stdout
38 @signal appendStderr(string) emitted after something was received from 39 @signal appendStderr(string) emitted after something was received from
39 a QProcess on stderr 40 a QProcess on stderr
40 @signal showMenu(string, QMenu) emitted when a menu is about to be shown. The name 41 @signal showMenu(string, QMenu) emitted when a menu is about to be shown. The name
41 of the menu and a reference to the menu are given. 42 of the menu and a reference to the menu are given.
42 """ 43 """
44 closeSourceWindow = pyqtSignal(str)
45 appendStdout = pyqtSignal(str)
46 appendStderr = pyqtSignal(str)
47 showMenu = pyqtSignal(str, QMenu)
43 sourceFile = pyqtSignal((str, ), (str, int)) 48 sourceFile = pyqtSignal((str, ), (str, int))
44 49
45 def __init__(self, project, parent = None): 50 def __init__(self, project, parent = None):
46 """ 51 """
47 Constructor 52 Constructor
67 """<p>This allows to easily see all interfaces (CORBA IDL files)""" 72 """<p>This allows to easily see all interfaces (CORBA IDL files)"""
68 """ contained in the current project. Several actions can be executed""" 73 """ contained in the current project. Several actions can be executed"""
69 """ via the context menu.</p>""" 74 """ via the context menu.</p>"""
70 )) 75 ))
71 76
72 self.connect(project, SIGNAL("prepareRepopulateItem"), 77 project.prepareRepopulateItem.connect(self._prepareRepopulateItem)
73 self._prepareRepopulateItem) 78 project.completeRepopulateItem.connect(self._completeRepopulateItem)
74 self.connect(project, SIGNAL("completeRepopulateItem"),
75 self._completeRepopulateItem)
76 79
77 def _createPopupMenus(self): 80 def _createPopupMenus(self):
78 """ 81 """
79 Protected overloaded method to generate the popup menu. 82 Protected overloaded method to generate the popup menu.
80 """ 83 """
279 """ 282 """
280 Private slot called by the menu aboutToShow signal. 283 Private slot called by the menu aboutToShow signal.
281 """ 284 """
282 ProjectBaseBrowser._showContextMenu(self, self.menu) 285 ProjectBaseBrowser._showContextMenu(self, self.menu)
283 286
284 self.emit(SIGNAL("showMenu"), "Main", self.menu) 287 self.showMenu.emit("Main", self.menu)
285 288
286 def __showContextMenuMulti(self): 289 def __showContextMenuMulti(self):
287 """ 290 """
288 Private slot called by the multiMenu aboutToShow signal. 291 Private slot called by the multiMenu aboutToShow signal.
289 """ 292 """
290 ProjectBaseBrowser._showContextMenuMulti(self, self.multiMenu) 293 ProjectBaseBrowser._showContextMenuMulti(self, self.multiMenu)
291 294
292 self.emit(SIGNAL("showMenu"), "MainMulti", self.multiMenu) 295 self.showMenu.emit("MainMulti", self.multiMenu)
293 296
294 def __showContextMenuDir(self): 297 def __showContextMenuDir(self):
295 """ 298 """
296 Private slot called by the dirMenu aboutToShow signal. 299 Private slot called by the dirMenu aboutToShow signal.
297 """ 300 """
298 ProjectBaseBrowser._showContextMenuDir(self, self.dirMenu) 301 ProjectBaseBrowser._showContextMenuDir(self, self.dirMenu)
299 302
300 self.emit(SIGNAL("showMenu"), "MainDir", self.dirMenu) 303 self.showMenu.emit("MainDir", self.dirMenu)
301 304
302 def __showContextMenuDirMulti(self): 305 def __showContextMenuDirMulti(self):
303 """ 306 """
304 Private slot called by the dirMultiMenu aboutToShow signal. 307 Private slot called by the dirMultiMenu aboutToShow signal.
305 """ 308 """
306 ProjectBaseBrowser._showContextMenuDirMulti(self, self.dirMultiMenu) 309 ProjectBaseBrowser._showContextMenuDirMulti(self, self.dirMultiMenu)
307 310
308 self.emit(SIGNAL("showMenu"), "MainDirMulti", self.dirMultiMenu) 311 self.showMenu.emit("MainDirMulti", self.dirMultiMenu)
309 312
310 def __showContextMenuBack(self): 313 def __showContextMenuBack(self):
311 """ 314 """
312 Private slot called by the backMenu aboutToShow signal. 315 Private slot called by the backMenu aboutToShow signal.
313 """ 316 """
314 ProjectBaseBrowser._showContextMenuBack(self, self.backMenu) 317 ProjectBaseBrowser._showContextMenuBack(self, self.backMenu)
315 318
316 self.emit(SIGNAL("showMenu"), "MainBack", self.backMenu) 319 self.showMenu.emit("MainBack", self.backMenu)
317 320
318 def _openItem(self): 321 def _openItem(self):
319 """ 322 """
320 Protected slot to handle the open popup menu entry. 323 Protected slot to handle the open popup menu entry.
321 """ 324 """
388 " the project?"), 391 " the project?"),
389 files) 392 files)
390 393
391 if dlg.exec_() == QDialog.Accepted: 394 if dlg.exec_() == QDialog.Accepted:
392 for fn2, fn in zip(fullNames, files): 395 for fn2, fn in zip(fullNames, files):
393 self.emit(SIGNAL('closeSourceWindow'), fn2) 396 self.closeSourceWindow.emit(fn2)
394 self.project.deleteFile(fn) 397 self.project.deleteFile(fn)
395 398
396 ############################################################################ 399 ############################################################################
397 ## Methods to handle the various compile commands 400 ## Methods to handle the various compile commands
398 ############################################################################ 401 ############################################################################
409 self.compileProc.setReadChannel(QProcess.StandardOutput) 412 self.compileProc.setReadChannel(QProcess.StandardOutput)
410 while self.compileProc and self.compileProc.canReadLine(): 413 while self.compileProc and self.compileProc.canReadLine():
411 s = 'omniidl: ' 414 s = 'omniidl: '
412 output = str(self.compileProc.readLine(), ioEncoding, 'replace') 415 output = str(self.compileProc.readLine(), ioEncoding, 'replace')
413 s += output 416 s += output
414 self.emit(SIGNAL('appendStdout'), s) 417 self.appendStdout.emit(s)
415 418
416 def __readStderr(self): 419 def __readStderr(self):
417 """ 420 """
418 Private slot to handle the readyReadStandardError signal of the omniidl process. 421 Private slot to handle the readyReadStandardError signal of the omniidl process.
419 """ 422 """
425 self.compileProc.setReadChannel(QProcess.StandardError) 428 self.compileProc.setReadChannel(QProcess.StandardError)
426 while self.compileProc and self.compileProc.canReadLine(): 429 while self.compileProc and self.compileProc.canReadLine():
427 s = 'omniidl: ' 430 s = 'omniidl: '
428 error = str(self.compileProc.readLine(), ioEncoding, 'replace') 431 error = str(self.compileProc.readLine(), ioEncoding, 'replace')
429 s += error 432 s += error
430 self.emit(SIGNAL('appendStderr'), s) 433 self.appendStderr.emit(s)
431 434
432 def __compileIDLDone(self, exitCode, exitStatus): 435 def __compileIDLDone(self, exitCode, exitStatus):
433 """ 436 """
434 Private slot to handle the finished signal of the omniidl process. 437 Private slot to handle the finished signal of the omniidl process.
435 438

eric ide

mercurial