Exemplo n.º 1
0
    def _main(self):
        self.main = QtWidgets.QVBoxLayout()
        self.main.setObjectName("main")

        self.form = QtWidgets.QFormLayout()
        self.form.setContentsMargins(10, 15, 10, 5)
        self.form.setObjectName("form")

        self.label_username = QtWidgets.QLabel("Username:"******"main", "e.g. John Smith"))

        self.label_password = QtWidgets.QLabel("Password:"******"main", "e.g. ********"))

        self.error_label = QtWidgets.QLabel("")
        self.error_label.setFont(self.font)
        self.error_label.setStyleSheet('color: #FC6000')
        self.error_label.setWordWrap(True)
        self.error_label.hide()

        self.form.addRow(self.label_username, self.input_username)
        self.form.addRow(self.label_password, self.input_password)
        self.form.addRow(self.error_label)

        self.btn_group = QtWidgets.QHBoxLayout()
        self.btn_group.addStretch(1)
        self.btn_group.setObjectName("btn_group")

        self.btn_ok = QtWidgets.QPushButton("Ok")
        self.btn_ok.clicked.connect(self.click_ok)

        self.btn_cancel = QtWidgets.QPushButton("Cancel")
        QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape),
                            self).activated.connect(self.close)
        self.btn_cancel.clicked.connect(self.close)

        self.btn_group.addWidget(self.btn_ok)
        self.btn_group.addWidget(self.btn_cancel)

        self.main.addLayout(self.form)
        self.main.addLayout(self.btn_group)

        return self.main
Exemplo n.º 2
0
    def set_is_logged(self, is_logged):
        self._is_logged = is_logged

        self.user_input.setReadOnly(is_logged)
        self.api_input.setReadOnly(is_logged)
        self.user_input.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
        self.api_input.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))

        self.btn_logout.setVisible(is_logged)

        self.set_advanced_mode(self._in_advance_mode)
Exemplo n.º 3
0
    def __mouseMove(self, widget, event):

        link = self.linkAt(event.line.p0)
        if link:
            self._qtWidget().viewport().setCursor(
                QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        else:
            self._qtWidget().viewport().setCursor(
                QtGui.QCursor(QtCore.Qt.IBeamCursor))

        return False
Exemplo n.º 4
0
 def __init__(self):
     super().__init__()
     self.scene = EditorScene(self)
     self.setDragMode(QtWidgets.QGraphicsView.RubberBandDrag)
     self.setRenderHint(QtGui.QPainter.Antialiasing)
     self.setRenderHint(QtGui.QPainter.TextAntialiasing)
     self.setAcceptDrops(True)
     self.normalCursor     = self.cursor()
     self.inPortCursor     = QtGui.QCursor(QtGui.QPixmap(u":/icons/Spyce_Icons/inport.svg"))
     self.outPortCursor    = QtGui.QCursor(QtGui.QPixmap(u":/icons/Spyce_Icons/outport.svg"))
     self.connectionCursor = QtGui.QCursor(QtGui.QPixmap(u":/icons/Spyce_Icons/node.svg"))
     self.textCursor       = QtGui.QCursor(QtGui.QPixmap(u":/icons/feather/type.svg"))
     self.currentscale = 1.0
     self.mode = 'normal'
Exemplo n.º 5
0
 def on_systray_activated(self, reason):
     # show contextMenu if left click
     if platform.system().lower() == "darwin":
         return
     if reason == QtWidgets.QSystemTrayIcon.Trigger:
         position = QtGui.QCursor().pos()
         self.contextMenu().popup(position)
Exemplo n.º 6
0
    def _main(self):
        main_layout = QtWidgets.QVBoxLayout()

        form_layout = QtWidgets.QFormLayout()
        form_layout.setContentsMargins(10, 15, 10, 5)

        label_username = QtWidgets.QLabel("Username:"******"main", "e.g. John Smith"))

        form_layout.addRow(label_username, input_username)

        btn_save = QtWidgets.QPushButton("Save")
        btn_save.clicked.connect(self.click_save)

        btn_cancel = QtWidgets.QPushButton("Cancel")
        btn_cancel.clicked.connect(self.close)

        btn_group = QtWidgets.QHBoxLayout()
        btn_group.addStretch(1)
        btn_group.addWidget(btn_save)
        btn_group.addWidget(btn_cancel)

        main_layout.addLayout(form_layout)
        main_layout.addLayout(btn_group)

        self.input_username = input_username

        return main_layout
Exemplo n.º 7
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.setWindowTitle("Menus")
        self.resize(250, 200)
        self.setLayout(QtWidgets.QFormLayout())

        static_menu = self.menu_static()

        # BUTTON WITH A SET MENU
        btn_menu = QtWidgets.QPushButton("Static Menu - Button Menu")
        self.layout().addWidget(btn_menu)
        btn_menu.setMenu(static_menu)

        # BUTTON WHICH SPAWNS A STATIC MENU ON CLICK UNDER THE CURSOR
        btn_menu = QtWidgets.QPushButton("Static Menu - Under Cursor")
        self.layout().addWidget(btn_menu)
        btn_menu.clicked.connect(
            lambda x: static_menu.exec_(QtGui.QCursor().pos()))

        # BUTTON WHICH GENERATES A DYNAMIC MENU ON CLICK UNDER THE CURSOR
        btn_menu = QtWidgets.QPushButton("Dynamic Menu - Under Cursor")
        self.layout().addWidget(btn_menu)
        btn_menu.clicked.connect(self.menu_dynamic)

        self.setFixedHeight(self.sizeHint().height())
Exemplo n.º 8
0
    def __init__(self, theTime, theTimeSlider, isEmpty=False):
        super(KeyFrameBtn, self).__init__(None)
        self.checked = False
        if isEmpty:
            self.baseColor = self._colors["blueColor"]
            self.lightColor = self._colors["blueLightColor"]
        else:
            self.baseColor = self._colors["redColor"]
            self.lightColor = self._colors["redLightColor"]

        self.isEmpty = isEmpty
        self.duplicateMode = False

        self.setCursor(QtGui.QCursor(QtCore.Qt.SplitHCursor))
        if theTime == int(theTime): self.theTime = int(theTime)
        else: self.theTime = theTime

        self.theTimeSlider = theTimeSlider
        self.mainWindow = theTimeSlider.mainWindow

        self.setParent(self.theTimeSlider)
        self.resize(6, 40)
        self.setStyleSheet(self.baseColor)

        cmds.evalDeferred(self.updatePosition)
        self.show()
Exemplo n.º 9
0
 def __init__(self, parent=None, size=6.0):
     super(BackdropSizer, self).__init__(parent)
     self.setFlag(self.ItemIsSelectable, True)
     self.setFlag(self.ItemIsMovable, True)
     self.setFlag(self.ItemSendsScenePositionChanges, True)
     self.setCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
     self.setToolTip('double-click auto resize')
     self._size = size
Exemplo n.º 10
0
    def _get_region(self, cursor):
        ret_dir = None
        pt_lu = self.mapToParent(self.rect().topLeft())
        pt_rl = self.mapToParent(self.rect().bottomRight())

        x = cursor.x()
        y = cursor.y()

        #获得鼠标当前所处窗口的边界方向
        if pt_lu.x() + self.PADDING_ >= x and pt_lu.x(
        ) <= x and pt_lu.y() + self.PADDING_ >= y and pt_lu.y() <= y:
            #左上角
            ret_dir = "LEFTUPPER"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
        elif x >= pt_rl.x() - self.PADDING_ and x <= pt_rl.x(
        ) and y >= pt_rl.y() - self.PADDING_ and y <= pt_rl.y():
            #右下角
            ret_dir = "RIGHTLOWER"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))

        elif x <= pt_lu.x() + self.PADDING_ and x >= pt_lu.x(
        ) and y >= pt_rl.y() - self.PADDING_ and y <= pt_rl.y():
            #左下角
            ret_dir = "LEFTLOWER"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeBDiagCursor))
        elif x <= pt_rl.x(
        ) and x >= pt_rl.x() - self.PADDING_ and y >= pt_lu.y(
        ) and y <= pt_lu.y() + self.PADDING_:
            #右上角
            ret_dir = "RIGHTUPPER"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeBDiagCursor))
        elif x <= pt_lu.x() + self.PADDING_ and x >= pt_lu.x():
            #左边
            ret_dir = "LEFT"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor))
        elif x <= pt_rl.x() and x >= pt_rl.x() - self.PADDING_:
            #右边
            ret_dir = "RIGHT"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor))
        elif y >= pt_lu.y() and y <= pt_lu.y() + self.PADDING_:
            #上边
            ret_dir = "UPPER"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor))
        elif y <= pt_rl.y() and y >= pt_rl.y() - self.PADDING_:
            #下边
            ret_dir = "LOWER"
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor))
        else:
            ret_dir = None
            self.setCursor(QtGui.QCursor(QtCore.Qt.SizeAllCursor))
        return ret_dir
Exemplo n.º 11
0
def get_widget_at_mouse():
    """
    Get the widget under the mouse
    :return: variant, QWidget || None
    """

    current_pos = QtGui.QCursor().pos()
    widget = QApplication.widgetAt(current_pos)
    return widget
Exemplo n.º 12
0
 def _show_menu(self):
     menu = QtWidgets.QMenu()
     for item in self._items:
         menu.addAction(item)
     a = menu.exec_(QtGui.QCursor().pos())
     if a is not None:
         value = a.text()
         self._lbl.setText(value)
         self.option_changed.emit(value)
Exemplo n.º 13
0
    def change_color(self):
        dialog = QtWidgets.QColorDialog()
        cursor = QtGui.QCursor()
        dialog.move(cursor.pos())
        dialog.setCurrentColor(self._color)
        newColor = dialog.getColor(self._color)

        if newColor != self._color:
            self.set_color(newColor)
Exemplo n.º 14
0
    def launch(self):
        LOGGING.debug(self.manager.data)
        env.HZ_PROJECT_NAME.set(self.comboBox_project_list.currentText())
        self.setCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
        item = self.software_commands.currentItem()
        exe_path = item.path
        if exe_path.startswith('.'):
            exe_path = os.path.normpath(
                exe_path.replace('.', self.wrappers_dir, 1))
        else:
            exe_path = os.path.expandvars(exe_path)
        if not os.path.exists(exe_path):
            LOGGING.error(traceback.format_exc())
            MessageDisplay(
                NAME, 'Not Find \n%s \nin "software_profile.yaml"' % exe_path,
                MessageDisplay.CRITICAL)

        elif item.name.lower() in self.app_launchers:
            widget = self.software_commands.itemWidget(item)
            profile_name = widget.comboBox.currentText()
            try:
                profile_path = item.profiles[profile_name]
                LOGGING.info('load current profile: %s' % profile_path)
                if os.path.isdir(profile_path):
                    command = '{0} -lp {1}'.format(exe_path, profile_path)
                    LOGGING.info('run launcher: %s' % command)
                    htk.start(command)
            except:
                LOGGING.error(traceback.format_exc())
                MessageDisplay(NAME, traceback.format_exc(),
                               MessageDisplay.CRITICAL)
            finally:
                self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        else:
            command = '{0}'.format(exe_path)
            try:
                LOGGING.info(command)
                htk.start(command)
            except:
                LOGGING.error(traceback.format_exc())
                MessageDisplay(NAME, traceback.format_exc(),
                               MessageDisplay.CRITICAL)
            finally:
                self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
Exemplo n.º 15
0
 def custom_context_menu(self, pos):
     """ 自定义右击菜单
     """
     _menu = QtWidgets.QMenu(self)
     _current_index = self.indexAt(pos)
     _index = _current_index.sibling(_current_index.row(), 0)
     if _index.isValid():
         _menu.addAction(QtGui.QIcon(resource.get("icons", "publish.png")),
                         u"上传文件", self._upload)
     _menu.exec_(QtGui.QCursor().pos())
Exemplo n.º 16
0
    def menu_dynamic(self):
        menu = QtWidgets.QMenu()

        for item in [
                "Dynamic Menu Item 01", "Dynamic Menu Item 02",
                "Dynamic Menu Item 03"
        ]:
            menu.addAction(item, self.action)

        menu.exec_(QtGui.QCursor().pos())
Exemplo n.º 17
0
def node_under_cursor():
	dag_widget = get_DAG_widget()
	dag_center = QtCore.QPoint(*nuke.center())
	cursor_pos = QtGui.QCursor().pos()
	dag_widget_center = QtCore.QPoint((dag_widget.size().width()/ 2), (dag_widget.size().height()/2) )
	cursor_pos_in_dag = dag_widget.mapFromGlobal(cursor_pos)

	new_node_pos = ((cursor_pos_in_dag - dag_widget_center) / nuke.zoom() + dag_center)

	return list(new_node_pos.toTuple())
Exemplo n.º 18
0
    def set_editable(self, value=False):
        """
        Set the edit mode for the text item.

        Args:
            value (bool):  true in edit mode.
        """
        if value:
            self.setTextInteractionFlags(
                QtCore.Qt.TextEditable |
                QtCore.Qt.TextSelectableByMouse |
                QtCore.Qt.TextSelectableByKeyboard
            )
            self.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
        else:
            self.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
            cursor = self.textCursor()
            cursor.clearSelection()
            self.setTextCursor(cursor)
            self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
Exemplo n.º 19
0
    def _main(self):
        self.main = QtWidgets.QVBoxLayout()
        self.main.setObjectName("main")

        self.form = QtWidgets.QFormLayout()
        self.form.setContentsMargins(10, 15, 10, 5)
        self.form.setObjectName("form")

        self.label_api_key = QtWidgets.QLabel("Clockify API key:")
        self.label_api_key.setFont(self.font)
        self.label_api_key.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        self.label_api_key.setTextFormat(QtCore.Qt.RichText)
        self.label_api_key.setObjectName("label_api_key")

        self.input_api_key = QtWidgets.QLineEdit()
        self.input_api_key.setEnabled(True)
        self.input_api_key.setFrame(True)
        self.input_api_key.setObjectName("input_api_key")
        self.input_api_key.setPlaceholderText(
            self._translate("main", "e.g. XX1XxXX2x3x4xXxx")
        )

        self.error_label = QtWidgets.QLabel("")
        self.error_label.setFont(self.font)
        self.error_label.setTextFormat(QtCore.Qt.RichText)
        self.error_label.setObjectName("error_label")
        self.error_label.setWordWrap(True)
        self.error_label.hide()

        self.form.addRow(self.label_api_key, self.input_api_key)
        self.form.addRow(self.error_label)

        self.btn_group = QtWidgets.QHBoxLayout()
        self.btn_group.addStretch(1)
        self.btn_group.setObjectName("btn_group")

        self.btn_ok = QtWidgets.QPushButton("Ok")
        self.btn_ok.setToolTip('Sets Clockify API Key so can Start/Stop timer')
        self.btn_ok.clicked.connect(self.click_ok)

        self.btn_cancel = QtWidgets.QPushButton("Cancel")
        cancel_tooltip = 'Application won\'t start'
        if self.optional:
            cancel_tooltip = 'Close this window'
        self.btn_cancel.setToolTip(cancel_tooltip)
        self.btn_cancel.clicked.connect(self._close_widget)

        self.btn_group.addWidget(self.btn_ok)
        self.btn_group.addWidget(self.btn_cancel)

        self.main.addLayout(self.form)
        self.main.addLayout(self.btn_group)

        return self.main
Exemplo n.º 20
0
    def __setCursor(self, cursor):

        if cursor == self.__cursor:
            return

        if self.__cursor is not None:
            QtWidgets.QApplication.restoreOverrideCursor()

        if cursor is not None:
            QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(cursor))

        self.__cursor = cursor
Exemplo n.º 21
0
 def custom_context_menu(self, pos):
     """ 自定义右击菜单
     """
     _menu = QtWidgets.QMenu(self)
     _index = self.currentIndex()
     _library_id = _index.data().get("LibraryId")
     # _index = _current_index.sibling(_current_index.row(),0)
     if _index.isValid():
         _menu.addSeparator()
         _menu.addAction(QtGui.QIcon(resource.get("icons", "remove.png")),
                         "移出预览", self._remove)
     _menu.exec_(QtGui.QCursor().pos())
Exemplo n.º 22
0
    def press_openMenu(self, list_widget):
        self.listMenu = QtGui.QMenu()
        self.listMenu.setStyleSheet(self.data['script'][TITLE]['style'])
        menu_item = self.listMenu.addAction("Add " + self.wgLoad.lstScene.currentItem().text())
        self.wgLoad.triggered.connect(self.press_menuItemAddFolder)
        menu_item = self.listMenu.addSeparator()
        menu_item = self.listMenu.addAction("ABC")
        self.wgLoad.triggered.connect(lambda: self.press_menuSort(list_widget))
        menu_item = self.listMenu.addAction("CBA")
        self.wgLoad.triggered.connect(lambda: self.press_menuSort(list_widget, True))

        parentPosition = self.wgLoad.lstTask.mapToGlobal(QtCore.QPoint(0, 0))
        self.listMenu.move(QtGui.QCursor().pos())
        self.listMenu.show()
Exemplo n.º 23
0
    def __init__(self, graph_str, filepath, parent=None, prune_to=None):
        super(WriteGraphDialog, self).__init__(parent)
        self.setWindowTitle("Rendering graph...")
        self.writer = Writer(graph_str, filepath, prune_to)
        self.thread = None
        self._finished = False
        self.success = False

        self.busy_cursor = QtGui.QCursor(QtCore.Qt.WaitCursor)
        self.bar = QtWidgets.QProgressBar()
        self.bar.setRange(0, 0)

        self.cancel_btn = QtWidgets.QPushButton("Cancel")
        pane = create_pane([None, self.cancel_btn], True)
        create_pane([self.bar, pane], False, parent_widget=self)

        self.writer.graph_written.connect(self._graph_written)
        self.cancel_btn.clicked.connect(self._cancel)
Exemplo n.º 24
0
    def __init__(self, parent=None):
        super(TransformItem, self).__init__(parent=parent)
        self.setFlag(QtWidgets.QGraphicsWidget.ItemIsMovable)
        self.setFlag(QtWidgets.QGraphicsWidget.ItemIsFocusable)
        self.setFlag(QtWidgets.QGraphicsWidget.ItemIsSelectable)
        self.setFlag(QtWidgets.QGraphicsWidget.ItemSendsGeometryChanges)
        self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
        self.setAcceptHoverEvents(True)
        self.rotationCursor = QtGui.QCursor(
            os.path.dirname(__file__) + "/resources/rotateIcon.png")
        self.pen = QtGui.QPen(QtCore.Qt.white, 2)
        self._manipulationMode = self._MANIP_MODE_NONE

        self.mousePressPose = QtCore.QPointF(0, 0)
        self.mousePos = QtCore.QPointF(0, 0)
        self._lastMousePos = QtCore.QPointF(0, 0)
        self._lastRect = self.boundingRect().center()
        self.angle = 0
        self.setTransformOriginPoint(QtCore.QPoint(50, 50))
Exemplo n.º 25
0
def __pointerChanged() :

	global __cursorOverridden

	pointer = GafferUI.Pointer.getCurrent()
	application = QtWidgets.QApplication.instance()

	if pointer is None :
		if __cursorOverridden :
			application.restoreOverrideCursor()
			__cursorOverridden = False
	else :
		pixmap = GafferUI.Image._qtPixmapFromImagePrimitive( pointer.image() )
		cursor = QtGui.QCursor( pixmap, pointer.hotspot().x, pointer.hotspot().y )
		if __cursorOverridden :
			application.changeOverrideCursor( cursor )
		else :
			application.setOverrideCursor( cursor )
			__cursorOverridden = True
Exemplo n.º 26
0
    def undercursor(self):
        def clamp(val, mi, ma):
            return max(min(val, ma), mi)

        # Get cursor position, and screen dimensions on active screen
        cursor = QtGui.QCursor().pos()
        screen = QtWidgets.QDesktopWidget().screenGeometry(cursor)

        # Get window position so cursor is just over text input
        xpos = cursor.x() - (self.width() / 2)
        ypos = cursor.y() - 13

        # Clamp window location to prevent it going offscreen
        xpos = clamp(xpos, screen.left(), screen.right() - self.width())
        ypos = clamp(ypos, screen.top(),
                     screen.bottom() - (self.height() - 13))

        # Move window
        self.move(xpos, ypos)
Exemplo n.º 27
0
 def enterEvent(self, event):
     """
     """
     if self._is_press:
         return
     if self._area == "top":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor))
     elif self._area == "top_left":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
     elif self._area == "bottom_right":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
     elif self._area == "bottom_left":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeBDiagCursor))
     elif self._area == "top_right":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeBDiagCursor))
     elif self._area == "left":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor))
     elif self._area == "right":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor))
     elif self._area == "bottom":
         self.setCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor))
Exemplo n.º 28
0
    def mouseReleaseEvent(self, evt):
        if evt.button() == QtCore.Qt.RightButton:
            menu = QtWidgets.QMenu()
            menu.addAction('Screen Grab', self.screen_grab)
            menu.addAction('Select File', self.select_file)

            _tmplt_menu = QtWidgets.QMenu('From Template')
            for template in settings.templates:
                _tmplt_menu.addAction(template, self.from_template)
            menu.addMenu(_tmplt_menu)

            menu.exec_(QtGui.QCursor().pos())

            self.thumbnail_updated.emit()
        else:
            if self._movie:
                self._is_scrubbing = False
                self._movie.setPaused(False)
            return super(_ImageWidget, self).mouseReleaseEvent(evt)
Exemplo n.º 29
0
    def load_context(self, filepath):
        context = None
        busy_cursor = QtGui.QCursor(QtCore.Qt.WaitCursor)

        with self.status("Loading %s..." % filepath):
            QtWidgets.QApplication.setOverrideCursor(busy_cursor)
            try:
                context = ResolvedContext.load(filepath)
            except ResolvedContextError as e:
                QtWidgets.QMessageBox.critical(self.main_window,
                                               "Failed to load context",
                                               str(e))
            finally:
                QtWidgets.QApplication.restoreOverrideCursor()

        if context:
            path = os.path.realpath(filepath)
            self.config.prepend_string_list("most_recent_contexts", path,
                                            "max_most_recent_contexts")
        return context
Exemplo n.º 30
0
 def show_tab_menu(self):
     """
     Show a list of tabs and go to the tab clicked.
     """
     menu = QtWidgets.QMenu()
     current_index = self.tabs.currentIndex()
     from functools import partial
     for i in range(self.tabs.count()):
         tab_name = self.tabs.tabText(i)
         if not tab_name.strip():
             continue
         func = partial(self.tabs.setCurrentIndex, i)
         action = menu.addAction(tab_name, func) # TODO: highlight this tab!
         if i == current_index:
             font = action.font()
             font.setBold(True)
             font.setUnderline(True)
             action.setFont(font)
             menu.setActiveAction(action)
     menu.exec_(QtGui.QCursor().pos())