예제 #1
0
 def __apply_results(self, call=None, request=None):
         # QToolTip.hideText()
         self.__thread_counter -= 1
         if call:
             # create a formatted calltip (current index appear in bold)
             calltip = "<nobr>{0}.{1}(".format(
                 call.module.name, call.call_name)
             for i, param in enumerate(call.params):
                 if i != 0:
                     calltip += ", "
                 if i == call.index:
                     calltip += "<b>"
                 calltip += unicode(param.token_list[0])
                 if i == call.index:
                     calltip += "</b>"
             calltip += ')</nobr>'
             # set tool tip position at the start of the bracket
             charWidth = self.editor.codeEdit.fm.width('A')
             w_offset = (request.col - call.bracket_start[1]) * charWidth
             position = QPoint(
                 self.editor.codeEdit.cursorRect().x() - w_offset,
                 self.editor.codeEdit.cursorRect().y())
             position = self.editor.codeEdit.mapToGlobal(position)
             # show tooltip
             QToolTip.showText(position, calltip, self.editor.codeEdit)
         else:
             QToolTip.hideText()
예제 #2
0
    def eventFilter(self, obj, event):
        """
        :type obj: PySide.QtGui.QTableWidget
        :type event: PySide.QtCore.QEvent
        """

        # TRACK MOUSE AND DISPLAY TOOLTIP WITH LOCAL AND GLOBAL TEXT
        if event.type() is QEvent.MouseMove:
            item = self.parent().nonVisTable.itemAt(event.pos())

            # if no item on mouse position, ignore event
            if item:
                row = item.row()
                column = item.column()
                # get object id on mouse position
                object_id, frame = self.parent().annotation.nonvis_table_records[row][column]

                # show tooltip if there is an object a the object has at least global or local text
                if object_id is not None:
                    an_object = self.parent().annotation.nonvis_objects_in_frame_range[object_id][0]
                    text_global, text_local = an_object.get_text(frame)
                    if text_global or text_local:
                        QToolTip.showText(event.globalPos(), text_global + '\n' + text_local)

        # TRACK LEFT_MOUSE RELEASE EVENT
        elif event.type() is QEvent.MouseButtonRelease and event.button() is Qt.LeftButton:
            self.LMouseRelease.emit()

        return QObject.eventFilter(self, obj, event)
예제 #3
0
    def eventFilter(self, obj, event):
        """
        :type obj: PySide.QtGui.QTableWidget
        :type event: PySide.QtCore.QEvent
        """

        # TRACK MOUSE AND DISPLAY TOOLTIP WITH LOCAL AND GLOBAL TEXT
        if event.type() is QEvent.MouseMove:
            item = self.parent().nonVisTable.itemAt(event.pos())

            # if no item on mouse position, ignore event
            if item:
                row = item.row()
                column = item.column()
                # get object id on mouse position
                object_id, frame = self.parent(
                ).annotation.nonvis_table_records[row][column]

                # show tooltip if there is an object a the object has at least global or local text
                if object_id is not None:
                    an_object = self.parent(
                    ).annotation.nonvis_objects_in_frame_range[object_id][0]
                    text_global, text_local = an_object.get_text(frame)
                    if text_global or text_local:
                        QToolTip.showText(event.globalPos(),
                                          text_global + '\n' + text_local)

        # TRACK LEFT_MOUSE RELEASE EVENT
        elif event.type() is QEvent.MouseButtonRelease and event.button(
        ) is Qt.LeftButton:
            self.LMouseRelease.emit()

        return QObject.eventFilter(self, obj, event)
예제 #4
0
 def __init__(self):
     """ Constructor Function
     """
     QWidget.__init__(self)
     self.setWindowTitle("Icon Sample")
     self.setGeometry(300, 300, 200, 150)
     QToolTip.setFont(QFont("Decorative", 8, QFont.Bold))
     self.setToolTip('Our Main Window')
예제 #5
0
 def mouseMoveEvent(self, event):
     assert isinstance(event, QMouseEvent)
     c = self.cursorForPosition(event.pos())
     for sel in self.__selections:
         if sel.containsCursor(c) and sel.tooltip:
             QToolTip.showText(self.mapToGlobal(event.pos()), sel.tooltip, self)
             break
     QPlainTextEdit.mouseMoveEvent(self, event)
예제 #6
0
파일: _Window.py 프로젝트: ra2003/xindex
 def menuHovered(self, action):
     settings = QSettings()
     if bool(
             int(
                 settings.value(Gopt.Key.ShowMenuToolTips,
                                Gopt.Default.ShowMenuToolTips))):
         tip = action.toolTip()
         if tip:
             QToolTip.showText(QCursor.pos(), tip, self)
예제 #7
0
파일: view.py 프로젝트: socek/bluebaker
 def update_form(self):
     for name, fields in self.form.fields.items():
         for index, field in enumerate(fields):
             self._set_field_value(name, field.value, index)
             if field.error:
                 edit = self._inputs[name][index]
                 tooltip_point = edit.widget.mapToGlobal(QPoint())
                 tooltip_point -= QPoint(-10, 15)
                 QToolTip.showText(tooltip_point, field.message)
예제 #8
0
파일: gui.py 프로젝트: mrf345/chrome-cut
 def SelfIinit(self, icon):
     self.setWindowTitle('chrome-cut ' + self.version)
     self.setGeometry(300, 300, 200, 150)
     self.setMinimumWidth(600)
     self.setMaximumWidth(600)
     self.setMinimumHeight(500)
     self.setMaximumHeight(500)
     # Setting Icon
     self.setWindowIcon(icon)
     QToolTip.setFont(self.sf)
예제 #9
0
파일: __init__.py 프로젝트: Firelinux/FQM
 def SelfIinit(self, icon):
     self.setWindowTitle('Free Queue Manager ' + version)
     self.setGeometry(300, 300, 200, 150)
     self.setMinimumWidth(500)
     self.setMaximumWidth(500)
     self.setMinimumHeight(400)
     self.setMaximumHeight(400)
     # Setting Icon
     self.setWindowIcon(icon)
     QToolTip.setFont(self.Arials)
예제 #10
0
 def __init__(self):
     # type: () -> object
     QWidget.__init__(self)
     self.setWindowTitle("Icon Sample")
     self.setGeometry(200, 300, 400, 150)
     QToolTip.setFont(QFont("Decorative", 8, QFont.Bold))
     self.setToolTip('Our Main WIndow')
     self.setMinimumHeight(100)
     self.setMinimumWidth(250)
     self.setMaximumHeight(300)
     self.setMaximumWidth(800)
 def __init__(self):
    """ Constructor Function
    """
    # QWidget.__init__(self)
    # self.setWindowTitle("Icon Sample")
    # self.setGeometry(300, 300, 200, 150)
    QWidget.__init__(self)
    self.setWindowTitle("Icon Sample")
    self.setGeometry(300, 300, 200, 150)
    QToolTip.setFont(QFont("Decorative", 8, QFont.Bold))
    self.setToolTip('Our Main Window')
    self.icon='C:\Users\Hamed\Documents\soheil sites image\imageedit__9411602959.gif'
예제 #12
0
 def __init__(self):
     """ Constructor Function
 """
     # QWidget.__init__(self)
     # self.setWindowTitle("Icon Sample")
     # self.setGeometry(300, 300, 200, 150)
     QWidget.__init__(self)
     self.setWindowTitle("Icon Sample")
     self.setGeometry(300, 300, 200, 150)
     QToolTip.setFont(QFont("Decorative", 8, QFont.Bold))
     self.setToolTip('Our Main Window')
     self.icon = 'C:\Users\Hamed\Documents\soheil sites image\imageedit__9411602959.gif'
예제 #13
0
    def mouseMoveEvent(self, event):
        pos = self.mapFromGlobal(event.globalPos())
        code = ((pos.y() // self.squareSize) * COLUMNS +
                pos.x() // self.squareSize)
        name = "unnamed"
        try:
            name = unicodedata.name(chr(code)).capitalize()
        except ValueError:
            pass
        text = """<p><span style="font-size: 18pt;">{0:c}</span></p>
<p><span style="font-size: 13pt;">U+{0:04X}<br>{1}</span></p>""".format(
            code, name)
        QToolTip.showText(event.globalPos(), text, self)
예제 #14
0
    def __init__(self, parent=None):
        '''Mandatory initialisation of a class.'''
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.setWindowTitle('GPL licence')

        QToolTip.setFont(QFont('SansSerif', 10))
        self.showButton.clicked.connect(self.fileRead)
        self.showButton.setToolTip('Click to see the licence')

        self.actionE_xit.setShortcut('Ctrl+Q')
        self.actionE_xit.setStatusTip('Exit Application')
        self.actionE_xit.triggered.connect(self.close)
예제 #15
0
파일: cc.py 프로젝트: hofoen/pcef-core
 def _displayHighlightedTooltip(self, txt):
     """
     Shows/hides current suggestion tooltip next to the completer popup
     :param txt:
     :return:
     """
     if not self.displayTooltips or not txt in self.__tooltips:
         QToolTip.hideText()
         return
     tooltip = self.__tooltips[txt]
     charWidth = self.editor.codeEdit.fm.width('A')
     # show tooltip
     pos = self.__completer.popup().pos()
     pos.setX(pos.x() + 400)
     pos.setY(pos.y() - 15)
     QToolTip.showText(pos, tooltip, self.editor.codeEdit)
 def __init__(self,fileName=None):
    """ Constructor Function
    """
    # QWidget.__init__(self)
    # self.setWindowTitle("Icon Sample")
    # self.setGeometry(300, 300, 200, 150)
    QMainWindow.__init__(self)
    self.setWindowTitle("Icon Sample")
    self.setGeometry(300, 300, 200, 150)
    QToolTip.setFont(QFont("Decorative", 8, QFont.Bold))
    self.setToolTip('Our Main Window')
    self.icon='C:\Users\Hamed\Documents\soheil sites image\imageedit__9411602959.gif'
    self.textEdit = QTextEdit()
    self.setCentralWidget(self.textEdit)
    self.fileName = None
    self.filters = "Text files (*.txt)"

    openFile = QAction(QIcon('open.png'), 'Open', self)
    openFile.setShortcut('Ctrl+O')
    openFile.setStatusTip('Open new File')
    openFile.triggered.connect(self.showDialog)
    menubar = self.menuBar()
    # fileMenu = menubar.addMenu('&File')
    # fileMenu.addAction(openFile)
    self.setGeometry(300, 300, 350, 300)
    self.setWindowTitle('Example - File Dialog')

    # self.myNameLE = QLineEdit(self)
    # self.myAgeLE = QLineEdit(self)
    # self.myChoiceLE = QLineEdit(self)

    self.statusLabel = QLabel('Showing Progress')
    self.progressBar = QProgressBar()
    self.progressBar.setMinimum(0)
    self.progressBar.setMaximum(100)
##################@@@@@@@@@@@@@@2
    self.threads = []

    self.addWorker(MyWorkerThread(1))
    self.addWorker(MyWorkerThread(2))
#######################@@@@@@@@@@@@@
    self.show()
예제 #17
0
 def __onKeyReleased(self, event):
     if event.key() == Qt.Key_ParenLeft or \
             event.key() == Qt.Key_Comma or \
             event.key() == Qt.Key_Space:
         if self.__thread_counter >= 1:
             return
         self.__thread_counter += 1
         tc = self.editor.codeEdit.textCursor()
         line = tc.blockNumber() + 1
         col = tc.columnNumber()
         fn = self.editor.codeEdit.tagFilename
         encoding = self.editor.codeEdit.tagEncoding
         source = self.editor.codeEdit.toPlainText()
         runnable = RunnableCalltip(
             CalltipRequest(source_code=source, line=line, col=col,
                            filename=fn, encoding=encoding))
         runnable.failedEvent.signal.connect(self.__apply_results)
         runnable.resultsAvailable.signal.connect(self.__apply_results)
         self.__threadPool.start(runnable)
     else:
         QToolTip.hideText()
예제 #18
0
    def __init__(self):
        # ====================
        # Constructor Function
        # ====================

        QMainWindow.__init__(self)
        self.setWindowTitle("Virtua Text Editor")
        self.setGeometry(300, 300, 1024, 768)

        QToolTip.setFont(QFont("Ubuntu", 10, QFont.Normal))
        self.setToolTip('Application Window')

        # ================================
        # Function to setup menus, etc etc
        # ================================
        self.textEdit = QTextEdit()
        self.textEdit.setFont(QFont("Ubuntu", 12, QFont.Normal))
        self.setCentralWidget(self.textEdit)
        self.create_menus()
        self.create_actions()

        self.fileMenu.addAction(self.newAction)
        self.fileMenu.addAction(self.openAction)
        self.fileMenu.addAction(self.saveAction)
        self.fileMenu.addAction(self.saveasAction)
        self.fileMenu.addSeparator()
        self.fileMenu.addAction(self.printAction)
        self.fileMenu.addSeparator()
        self.fileMenu.addAction(self.exitAction)

        self.editMenu.addAction(self.undoAction)
        self.editMenu.addAction(self.redoAction)
        self.editMenu.addAction(self.cutAction)
        self.editMenu.addAction(self.copyAction)
        self.editMenu.addAction(self.pasteAction)
        self.editMenu.addSeparator()
        self.editMenu.addAction(self.selectallAction)
        self.editMenu.addAction(self.deselectallAction)
        self.editMenu.addSeparator()
        self.editMenu.addAction(self.findAction)
        self.editMenu.addAction(self.findReplaceAction)

        self.helpMenu.addAction(self.aboutAction)

        self.app_status_bar = QStatusBar()
        self.app_status_bar.showMessage('Ready, v0.2', 10000)
        self.setStatusBar(self.app_status_bar)

        self.create_toolbar()
        self.toolbar.addAction(self.newAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.cutAction)
        self.toolbar.addAction(self.copyAction)
        self.toolbar.addAction(self.pasteAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.printAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.undoAction)
        self.toolbar.addAction(self.redoAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.findAction)
        self.toolbar.addAction(self.findReplaceAction)
예제 #19
0
 def _set_tooltip ( self, tooltip ):
     self.control.setToolTip( tooltip )
     if tooltip == '':
         QToolTip.hideText()
예제 #20
0
파일: cc.py 프로젝트: hofoen/pcef-core
 def _hideCompletions(self):
     """
     Hides the completion popup
     """
     self.__completer.popup().hide()
     QToolTip.hideText()
    def __init__(self, parent=None, filePath=''):
        """Default class constructor."""
        super(MDISubWindow_TextEdit, self).__init__(parent)

        print(filePath)
        self.filePath = filePath
        self.fileName = os.path.basename(os.path.abspath(filePath))
        self.fileExt = os.path.splitext(self.fileName)[1]

        if not filePath:
            self.setWindowTitle('Untitled[*]')
            parent.setWindowIcon(QIcon(gIconDir + os.sep + 'new.png'))
        else:
            f = open(filePath, 'r')
            txt = f.read()
            f.close()
            self.setText(txt)

            self.setWindowTitle('%s[*]' % self.fileName)

            # TODO: This is changing all the subwindows icons. We want individual icons based on filetype...?
            if self.fileExt in ('.py', '.pyw'):
                parent.setWindowIcon(QIcon(gIconDir + os.sep + 'pyscript.png'))
            else:
                parent.setWindowIcon(QIcon(gIconDir + os.sep + 'new.png'))

        monoFont = QFont('Courier New')
        monoFont.setFixedPitch(True)
        self.setFont(monoFont)
        self.setWordWrapMode(QTextOption.NoWrap)
        ## self.setTextBackgroundColor(QColor('#000000'))
        ## self.setTextColor(QColor('#FFFFFF'))
        self.setCursorWidth(2)
        self.CreateActions()

        self.zoomLevel = 0

        gMainWin.action_Edit_Cut.setEnabled(False)
        gMainWin.action_Edit_Copy.setEnabled(False)
        self.copyAvailable.connect(gMainWin.action_Edit_Cut.setEnabled)
        self.copyAvailable.connect(gMainWin.action_Edit_Copy.setEnabled)
        # Handle the Context Menu Entries Also.
        self.action_Edit_Undo.setEnabled(False)
        self.action_Edit_Redo.setEnabled(False)
        self.action_Edit_Cut.setEnabled(False)
        self.action_Edit_Copy.setEnabled(False)
        self.undoAvailable.connect(self.action_Edit_Undo.setEnabled)
        self.redoAvailable.connect(self.action_Edit_Redo.setEnabled)
        self.copyAvailable.connect(self.action_Edit_Cut.setEnabled)
        self.copyAvailable.connect(self.action_Edit_Copy.setEnabled)

        self.document().contentsChanged.connect(self.TheDocumentWasModified)

        # self.show()
        # self.showMaximized()
        # self.setFocusPolicy(Qt.WheelFocus)
        ##### self.setFocus() # This makes the MDIArea go into SubWindowView...?

        self.gCornerWidget = QToolButton(self)
        # self.gCornerWidgetToolTip = QToolTip()
        QToolTip.setFont(QFont('SansSerif', 10))
        br = QBrush(QPixmap(gImgDir + os.sep + 'texture-spirals.png'))
        pal = QPalette()
        # pal.setBrush(QPalette.Active, QPalette.Base, br)
        # pal.setColor(QPalette.Background, QColor('#FF8000'))
        pal.setColor(QPalette.ColorGroup.Inactive,
                     QPalette.ColorRole.ToolTipBase,
                     QColor(EMBROIDERBLUE2))
        QToolTip.setPalette(QPalette(pal))
        self.action_Edit_SelectAll.setToolTip('This is a <b>QWidget</b> widget')

        self.gCornerWidget.setDefaultAction(self.action_Edit_SelectAll)
        self.setCornerWidget(self.gCornerWidget)
        # We want to show the corner widget no matter what so...
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
예제 #22
0
    def initUI(self):
        QToolTip.setFont(QFont('SansSerif', 10))
        self.setGeometry(300, 200, 810, 430)
        self.setWindowTitle('Transformation on Human Face')

        #Method choose combobox
        self.comboAffineLabel = QLabel(self)
        self.comboAffineLabel.setText('Transformation Method:')
        self.comboAffineLabel.setGeometry(60, 270, 230, 30)

        self.comboAffine = QComboBox(self)
        self.comboAffine.addItem("Local Affine Transformation")
        self.comboAffine.addItem("Moving Least Squares")
        self.comboAffine.addItem("Morphing")
        self.comboAffine.setGeometry(22, 290, 225, 30)
        self.comboAffine.activated[str].connect(self.affineChoiceChange)

        #The button to choose the original figure
        self.oriBtn = QPushButton('Choose Original Picture', self)
        self.oriBtn.setToolTip('Choose Original Picture')
        self.oriBtn.setGeometry(20, 330, 230, 30)
        self.oriBtn.clicked.connect(self.showOriDialog)

        #The button to choose the proto figure
        self.protoBtn = QPushButton('Choose Proto Picture', self)
        self.protoBtn.setToolTip('Choose Proto Picture')
        self.protoBtn.setGeometry(20, 365, 230, 30)
        self.protoBtn.clicked.connect(self.showProtoDialog)

        #The distance function choose combobox
        self.comboLabel = QLabel(self)
        self.comboLabel.setText('Distance Fun:')
        self.comboLabel.setGeometry(310, 280, 200, 30)

        self.comboDis = QComboBox(self)
        self.comboDis.addItem("L2")
        self.comboDis.addItem("L1")
        self.comboDis.setGeometry(410, 280, 80, 30)

        self.comboDis.activated[str].connect(self.distanceChoiceChange)

        #E choose slider

        self.eLabel = QLabel(self)
        self.eLabel.setText('E Value:0.00')
        self.eLabel.setGeometry(310, 320, 200, 30)
        self.eSld = QSlider(Qt.Horizontal, self)
        self.eSld.setRange(0, 10**5)
        self.eSld.setFocusPolicy(Qt.NoFocus)
        self.eSld.setGeometry(390, 320, 120, 30)
        self.eSld.valueChanged[int].connect(self.changeEValue)

        #alpha choose slider
        self.aLabel = QLabel(self)
        self.aLabel.setText('Alpha Value:0.00')
        self.aLabel.setGeometry(310, 360, 200, 30)
        self.aSld = QSlider(Qt.Horizontal, self)
        self.aSld.setRange(0, 10**5)
        self.aSld.setFocusPolicy(Qt.NoFocus)
        self.aSld.setGeometry(410, 360, 100, 30)
        self.aSld.valueChanged[int].connect(self.changeAlphaValue)

        # Picture show
        self.oriTextLabel = QLabel(self)
        self.protoTextLabel = QLabel(self)
        self.transTextLabel = QLabel(self)
        self.oriTextLabel.setText('The Orginal Picture')
        self.protoTextLabel.setText('The Proto Picture')
        self.transTextLabel.setText('The Picture after Transformation')

        self.oriTextLabel.move(70, 5)
        self.protoTextLabel.move(350, 5)
        self.transTextLabel.move(580, 5)

        self.oriLabel = QLabel(self)
        self.protoLabel = QLabel(self)
        self.transLabel = QLabel(self)

        pixmap = QPixmap(self.oriPath)
        pixmap2 = QPixmap(self.protoPath)
        self.oriLabel.setPixmap(pixmap)
        self.protoLabel.setPixmap(pixmap2)
        self.transLabel.setPixmap(pixmap)

        #Position setting
        self.oriLabel.setGeometry(20, 20, 230, 230)
        self.protoLabel.setGeometry(290, 20, 230, 230)
        self.transLabel.setGeometry(560, 20, 230, 230)
        self.oriLabel.setScaledContents(True)
        self.protoLabel.setScaledContents(True)
        self.transLabel.setScaledContents(True)
        #Load button
        self.loadOriBtn = QPushButton('Load Ori Points', self)
        self.loadOriBtn.setToolTip('Load Control Points From Txt File')
        self.loadOriBtn.setGeometry(550, 280, 130, 30)
        self.loadOriBtn.clicked.connect(self.showLoadOriDialog)

        self.loadProtoBtn = QPushButton('Load Proto Points', self)
        self.loadProtoBtn.setToolTip('Load Control Points From Txt File')
        self.loadProtoBtn.setGeometry(680, 280, 130, 30)
        self.loadProtoBtn.clicked.connect(self.showLoadProtoDialog)
        #Face ++ button
        self.faceBtn = QPushButton('Face++ Keypoint', self)
        self.faceBtn.setToolTip('Save the Face++ Keypoints')
        self.faceBtn.setGeometry(550, 315, 130, 30)
        self.faceBtn.clicked.connect(self.detectKeyPoints)
        #Load region Button
        self.loadRegionBtn = QPushButton('Load Regions', self)
        self.loadRegionBtn.setToolTip('Load Regions From Txt File')
        self.loadRegionBtn.setGeometry(680, 315, 130, 30)
        self.loadRegionBtn.clicked.connect(self.showLoadRegionDialog)

        #Save Button setting
        self.saveBtn = QPushButton('Save', self)
        self.saveBtn.setToolTip(
            'Transform this picture to the shape of Baboon')
        self.saveBtn.setGeometry(560, 350, 110, 40)
        self.saveBtn.clicked.connect(self.saveImg)

        #Transform action button
        self.confirmBtn = QPushButton('Generate', self)
        self.confirmBtn.setToolTip('Generate')
        self.confirmBtn.setGeometry(680, 350, 110, 40)
        self.confirmBtn.clicked.connect(self.transformAction)

        self.show()
예제 #23
0
파일: marker.py 프로젝트: hofoen/pcef-core
 def displayTooltip(self):
     """ Display the tooltip """
     QToolTip.showText(self.mapToGlobal(self._tooltipPos),
                       self._tooltip,
                       self)
 def initUI(self):
     #Set Window
     QToolTip.setFont(QFont('Serif', 10))
     self.setGeometry(280, 210, 800, 450)
     self.setWindowTitle('Image Registration Based on Control Points')
     #Set Algorithm
     self.comboAffineLabel = QLabel(self)
     self.comboAffineLabel.setText('Algorithm:')
     self.comboAffineLabel.setGeometry(60, 270, 230, 30)
     self.comboAffine = QComboBox(self)
     self.comboAffine.addItem("Morphing")
     self.comboAffine.addItem("Local Affine Transformation")
     self.comboAffine.addItem("Moving Least Squares")
     self.comboAffine.setGeometry(22, 290, 225, 30)
     self.comboAffine.activated[str].connect(self.affineChoiceChange)
     #Choose Human Face Image
     self.oriBtn = QPushButton('Human Face Image', self)
     self.oriBtn.setToolTip('Human Face Image')
     self.oriBtn.setGeometry(20, 330, 230, 30)
     self.oriBtn.clicked.connect(self.showOriDialog)
     #Choose Ape or another Human image
     self.protoBtn = QPushButton('Ape or Human image', self)
     self.protoBtn.setToolTip('Ape or Human image')
     self.protoBtn.setGeometry(310, 330, 230, 30)
     self.protoBtn.clicked.connect(self.showProtoDialog)
     #parameter e
     self.eLabel = QLabel(self)
     self.eLabel.setText('E Value:0.00')
     self.eLabel.setGeometry(550, 300, 200, 30)
     self.eSld = QSlider(Qt.Horizontal, self)
     self.eSld.setRange(0, 10**5)
     self.eSld.setFocusPolicy(Qt.NoFocus)
     self.eSld.setGeometry(550, 330, 120, 30)
     self.eSld.valueChanged[int].connect(self.changeEValue)
     #parameter alpha
     self.aLabel = QLabel(self)
     self.aLabel.setText('Alpha Value:0.00')
     self.aLabel.setGeometry(680, 300, 200, 30)
     self.aSld = QSlider(Qt.Horizontal, self)
     self.aSld.setRange(0, 10**5)
     self.aSld.setFocusPolicy(Qt.NoFocus)
     self.aSld.setGeometry(680, 330, 100, 30)
     self.aSld.valueChanged[int].connect(self.changeAlphaValue)
     # The Image
     self.oriTextLabel = QLabel(self)
     self.protoTextLabel = QLabel(self)
     self.transTextLabel = QLabel(self)
     self.oriTextLabel.setText('The Human Image')
     self.protoTextLabel.setText('The Ape or another Human Image')
     self.transTextLabel.setText('Deformation Image')
     self.oriTextLabel.move(70, 5)
     self.protoTextLabel.move(350, 5)
     self.transTextLabel.move(580, 5)
     self.oriLabel = QLabel(self)
     self.protoLabel = QLabel(self)
     self.transLabel = QLabel(self)
     pixmap = QPixmap(self.oriPath)
     pixmap2 = QPixmap(self.protoPath)
     self.oriLabel.setPixmap(pixmap)
     self.protoLabel.setPixmap(pixmap2)
     self.transLabel.setPixmap(pixmap)
     #Set Position
     self.oriLabel.setGeometry(20, 20, 230, 230)
     self.protoLabel.setGeometry(290, 20, 230, 230)
     self.transLabel.setGeometry(560, 20, 230, 230)
     self.oriLabel.setScaledContents(True)
     self.protoLabel.setScaledContents(True)
     self.transLabel.setScaledContents(True)
     #import points
     self.loadOriBtn = QPushButton('Deformed Points', self)
     self.loadOriBtn.setToolTip('Load Control Points From Txt File')
     self.loadOriBtn.setGeometry(20, 365, 230, 30)
     self.loadOriBtn.clicked.connect(self.showLoadOriDialog)
     self.loadProtoBtn = QPushButton('Control Points', self)
     self.loadProtoBtn.setToolTip('Load Control Points From Txt File')
     self.loadProtoBtn.setGeometry(310, 365, 230, 30)
     self.loadProtoBtn.clicked.connect(self.showLoadProtoDialog)
     #Deformed
     self.confirmBtn = QPushButton('Deformed', self)
     self.confirmBtn.setToolTip('Deformed')
     self.confirmBtn.setGeometry(580, 365, 150, 30)
     self.confirmBtn.clicked.connect(self.transformAction)
     self.show()
    def __init__(self, parent=None, filePath=''):
        """Default class constructor."""
        super(MDISubWindow_TextEdit, self).__init__(parent)

        print(filePath)
        self.filePath = filePath
        self.fileName = os.path.basename(os.path.abspath(filePath))
        self.fileExt = os.path.splitext(self.fileName)[1]

        if not filePath:
            self.setWindowTitle('Untitled[*]')
            parent.setWindowIcon(QIcon(gIconDir + os.sep + 'new.png'))
        else:
            f = open(filePath, 'r')
            txt = f.read()
            f.close()
            self.setText(txt)

            self.setWindowTitle('%s[*]' % self.fileName)

            # TODO: This is changing all the subwindows icons. We want individual icons based on filetype...?
            if self.fileExt in ('.py', '.pyw'):
                parent.setWindowIcon(QIcon(gIconDir + os.sep + 'pyscript.png'))
            else:
                parent.setWindowIcon(QIcon(gIconDir + os.sep + 'new.png'))

        monoFont = QFont('Courier New')
        monoFont.setFixedPitch(True)
        self.setFont(monoFont)
        self.setWordWrapMode(QTextOption.NoWrap)
        ## self.setTextBackgroundColor(QColor('#000000'))
        ## self.setTextColor(QColor('#FFFFFF'))
        self.setCursorWidth(2)
        self.CreateActions()

        self.zoomLevel = 0

        gMainWin.action_Edit_Cut.setEnabled(False)
        gMainWin.action_Edit_Copy.setEnabled(False)
        self.copyAvailable.connect(gMainWin.action_Edit_Cut.setEnabled)
        self.copyAvailable.connect(gMainWin.action_Edit_Copy.setEnabled)
        # Handle the Context Menu Entries Also.
        self.action_Edit_Undo.setEnabled(False)
        self.action_Edit_Redo.setEnabled(False)
        self.action_Edit_Cut.setEnabled(False)
        self.action_Edit_Copy.setEnabled(False)
        self.undoAvailable.connect(self.action_Edit_Undo.setEnabled)
        self.redoAvailable.connect(self.action_Edit_Redo.setEnabled)
        self.copyAvailable.connect(self.action_Edit_Cut.setEnabled)
        self.copyAvailable.connect(self.action_Edit_Copy.setEnabled)

        self.document().contentsChanged.connect(self.TheDocumentWasModified)

        # self.show()
        # self.showMaximized()
        # self.setFocusPolicy(Qt.WheelFocus)
        ##### self.setFocus() # This makes the MDIArea go into SubWindowView...?

        self.gCornerWidget = QToolButton(self)
        # self.gCornerWidgetToolTip = QToolTip()
        QToolTip.setFont(QFont('SansSerif', 10))
        br = QBrush(QPixmap(gImgDir + os.sep + 'texture-spirals.png'))
        pal = QPalette()
        # pal.setBrush(QPalette.Active, QPalette.Base, br)
        # pal.setColor(QPalette.Background, QColor('#FF8000'))
        pal.setColor(QPalette.ColorGroup.Inactive,
                     QPalette.ColorRole.ToolTipBase, QColor(EMBROIDERBLUE2))
        QToolTip.setPalette(QPalette(pal))
        self.action_Edit_SelectAll.setToolTip(
            'This is a <b>QWidget</b> widget')

        self.gCornerWidget.setDefaultAction(self.action_Edit_SelectAll)
        self.setCornerWidget(self.gCornerWidget)
        # We want to show the corner widget no matter what so...
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)