eric6/QScintilla/Editor.py

branch
maintenance
changeset 8400
b3eefd7e58d1
parent 8273
698ae46f40a4
parent 8298
83ddb87b3bc1
child 8576
fe1957c69854
equal deleted inserted replaced
8274:197414ba11cc 8400:b3eefd7e58d1
2721 ): 2721 ):
2722 # get the selection 2722 # get the selection
2723 fromLine, fromIndex, toLine, toIndex = self.getSelection() 2723 fromLine, fromIndex, toLine, toIndex = self.getSelection()
2724 if toIndex == 0: 2724 if toIndex == 0:
2725 toLine -= 1 2725 toLine -= 1
2726 # Qscintilla seems to print one line more than told 2726 # QScintilla seems to print one line more than told
2727 res = printer.printRange(self, fromLine, toLine - 1) 2727 res = printer.printRange(self, fromLine, toLine - 1)
2728 else: 2728 else:
2729 res = printer.printRange(self) 2729 res = printer.printRange(self)
2730 if res: 2730 if res:
2731 sb.showMessage(self.tr('Printing completed'), 2000) 2731 sb.showMessage(self.tr('Printing completed'), 2000)
7554 7554
7555 def __showClassDiagram(self): 7555 def __showClassDiagram(self):
7556 """ 7556 """
7557 Private method to handle the Class Diagram context menu action. 7557 Private method to handle the Class Diagram context menu action.
7558 """ 7558 """
7559 from Graphics.UMLDialog import UMLDialog 7559 from Graphics.UMLDialog import UMLDialog, UMLDialogType
7560 if not self.checkDirty(): 7560 if not self.checkDirty():
7561 return 7561 return
7562 7562
7563 self.classDiagram = UMLDialog( 7563 self.classDiagram = UMLDialog(
7564 UMLDialog.ClassDiagram, self.project, self.fileName, 7564 UMLDialogType.CLASS_DIAGRAM, self.project, self.fileName,
7565 self, noAttrs=False) 7565 self, noAttrs=False)
7566 self.classDiagram.show() 7566 self.classDiagram.show()
7567 7567
7568 def __showPackageDiagram(self): 7568 def __showPackageDiagram(self):
7569 """ 7569 """
7570 Private method to handle the Package Diagram context menu action. 7570 Private method to handle the Package Diagram context menu action.
7571 """ 7571 """
7572 from Graphics.UMLDialog import UMLDialog 7572 from Graphics.UMLDialog import UMLDialog, UMLDialogType
7573 if not self.checkDirty(): 7573 if not self.checkDirty():
7574 return 7574 return
7575 7575
7576 package = ( 7576 package = (
7577 os.path.isdir(self.fileName) and 7577 os.path.isdir(self.fileName) and
7581 self, 7581 self,
7582 self.tr("Package Diagram"), 7582 self.tr("Package Diagram"),
7583 self.tr("""Include class attributes?"""), 7583 self.tr("""Include class attributes?"""),
7584 yesDefault=True) 7584 yesDefault=True)
7585 self.packageDiagram = UMLDialog( 7585 self.packageDiagram = UMLDialog(
7586 UMLDialog.PackageDiagram, self.project, package, 7586 UMLDialogType.PACKAGE_DIAGRAM, self.project, package,
7587 self, noAttrs=not res) 7587 self, noAttrs=not res)
7588 self.packageDiagram.show() 7588 self.packageDiagram.show()
7589 7589
7590 def __showImportsDiagram(self): 7590 def __showImportsDiagram(self):
7591 """ 7591 """
7592 Private method to handle the Imports Diagram context menu action. 7592 Private method to handle the Imports Diagram context menu action.
7593 """ 7593 """
7594 from Graphics.UMLDialog import UMLDialog 7594 from Graphics.UMLDialog import UMLDialog, UMLDialogType
7595 if not self.checkDirty(): 7595 if not self.checkDirty():
7596 return 7596 return
7597 7597
7598 package = ( 7598 package = os.path.dirname(self.fileName)
7599 os.path.isdir(self.fileName) and
7600 self.fileName or os.path.dirname(self.fileName)
7601 )
7602 res = E5MessageBox.yesNo( 7599 res = E5MessageBox.yesNo(
7603 self, 7600 self,
7604 self.tr("Imports Diagram"), 7601 self.tr("Imports Diagram"),
7605 self.tr("""Include imports from external modules?""")) 7602 self.tr("""Include imports from external modules?"""))
7606 self.importsDiagram = UMLDialog( 7603 self.importsDiagram = UMLDialog(
7607 UMLDialog.ImportsDiagram, self.project, package, 7604 UMLDialogType.IMPORTS_DIAGRAM, self.project, package,
7608 self, showExternalImports=res) 7605 self, showExternalImports=res)
7609 self.importsDiagram.show() 7606 self.importsDiagram.show()
7610 7607
7611 def __showApplicationDiagram(self): 7608 def __showApplicationDiagram(self):
7612 """ 7609 """
7613 Private method to handle the Imports Diagram context menu action. 7610 Private method to handle the Imports Diagram context menu action.
7614 """ 7611 """
7615 from Graphics.UMLDialog import UMLDialog 7612 from Graphics.UMLDialog import UMLDialog, UMLDialogType
7616 res = E5MessageBox.yesNo( 7613 res = E5MessageBox.yesNo(
7617 self, 7614 self,
7618 self.tr("Application Diagram"), 7615 self.tr("Application Diagram"),
7619 self.tr("""Include module names?"""), 7616 self.tr("""Include module names?"""),
7620 yesDefault=True) 7617 yesDefault=True)
7621 self.applicationDiagram = UMLDialog( 7618 self.applicationDiagram = UMLDialog(
7622 UMLDialog.ApplicationDiagram, self.project, 7619 UMLDialogType.APPLICATION_DIAGRAM, self.project,
7623 self, noModules=not res) 7620 self, noModules=not res)
7624 self.applicationDiagram.show() 7621 self.applicationDiagram.show()
7625 7622
7626 def __loadDiagram(self): 7623 def __loadDiagram(self):
7627 """ 7624 """
7628 Private slot to load a diagram from file. 7625 Private slot to load a diagram from file.
7629 """ 7626 """
7630 from Graphics.UMLDialog import UMLDialog 7627 from Graphics.UMLDialog import UMLDialog, UMLDialogType
7631 self.loadedDiagram = UMLDialog( 7628 self.loadedDiagram = UMLDialog(
7632 UMLDialog.NoDiagram, self.project, parent=self) 7629 UMLDialogType.NO_DIAGRAM, self.project, parent=self)
7633 if self.loadedDiagram.load(): 7630 if self.loadedDiagram.load():
7634 self.loadedDiagram.show(fromFile=True) 7631 self.loadedDiagram.show(fromFile=True)
7635 else: 7632 else:
7636 self.loadedDiagram = None 7633 self.loadedDiagram = None
7637 7634

eric ide

mercurial