Beispiel #1
0
 def showPopup(self):
     """
     Shows the popup for this button.
     """
     as_dialog = QApplication.keyboardModifiers()
     
     anchor = self.defaultAnchor()
     if anchor:
         self.popupWidget().setAnchor(anchor)
     else:
         anchor = self.popupWidget().anchor()
     
     if ( anchor & (XPopupWidget.Anchor.BottomLeft |
                    XPopupWidget.Anchor.BottomCenter |
                    XPopupWidget.Anchor.BottomRight) ):
         pos = QPoint(self.width() / 2, 0)
     else:
         pos = QPoint(self.width() / 2, self.height())
     
     pos = self.mapToGlobal(pos)
     
     if not self.signalsBlocked():
         self.popupAboutToShow.emit()
     self._popupWidget.popup(pos)
     
     if as_dialog:
         self._popupWidget.setCurrentMode(XPopupWidget.Mode.Dialog)
 def handleActionTrigger(self, action):
     """
     Handles when an action has been triggered.  If the inputed action is a 
     XViewProfileAction, then the currentProfileChanged signal will emit.
     
     :param      action | <QAction>
     """
     # trigger a particular profile
     if isinstance(action, XViewProfileAction):
         # if the user CTRL+Clicks on the action, then attempt
         # to load it in a new window
         if QApplication.keyboardModifiers() == Qt.ControlModifier:
             self.newWindowProfileRequested.emit(action.profile())
             self.setCurrentProfile(self.currentProfile())
             return
         else:
             self.setCurrentProfile(action.profile())
Beispiel #3
0
 def handleActionTrigger(self, action):
     """
     Handles when an action has been triggered.  If the inputed action is a 
     XViewProfileAction, then the currentProfileChanged signal will emit.
     
     :param      action | <QAction>
     """
     # trigger a particular profile
     if isinstance(action, XViewProfileAction):
         # if the user CTRL+Clicks on the action, then attempt
         # to load it in a new window
         if QApplication.keyboardModifiers() == Qt.ControlModifier:
             self.newWindowProfileRequested.emit(action.profile())
             self.setCurrentProfile(self.currentProfile())
             return
         else:
             self.setCurrentProfile(action.profile())
Beispiel #4
0
    def gotoUrl(self, url):
        try:
            urlstr = url.toString()
        except:
            urlstr = nativestring(url)

        if not urlstr.endswith('.html'):
            self.gotoItem(urlstr)
            return

        if not QApplication.keyboardModifiers() == Qt.ControlModifier:
            widget = self.currentContentsWidget(autoadd=True)
        else:
            widget = self.addContentsWidget()

        index = self.uiContentsTAB.indexOf(widget)
        self.uiContentsTAB.setCurrentIndex(index)
        widget.setUrl(QUrl(url))