Ejemplo n.º 1
0
    def draw_menu_variable(self, data):

        self.context_menu.addAction(
            SCR_GetIcon("c4c9e8e0c5587117224d03e1b36d2e25d9d096bb"), "Delete",
            partial(self.act_variable.delete, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("e7cec978fe0a220b390f534bc8060904b5a09293"), "Rename",
            partial(self.act_variable.rename, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("85d95f3e36517321283568bf441922f4cfe53ec1"), "Move Up",
            partial(self.act_variable.moveup, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("8cb8f5436aebe089cb7a9fe81a909675847e0c81"),
            "Move Down",
            partial(self.act_variable.movedown, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("ffc3fb09c5db2b34f971c0ec4979b73de4f14be5"),
            "Find Usage",
            partial(self.act_variable.find_usage, self.tree_item, data))
Ejemplo n.º 2
0
    def draw_gui(self):

        self.setWindowTitle(self.title)
        self.setWindowIcon(SCR_GetIcon('08e0c30ab7f9c6d43c70165c4ae42460d460c0aa'))
        self.resize(400,40)
        self.setFixedSize(400,40)
        self.setStyleSheet("background-color: #ffffff")
        self.setText(self.txt)
        self.setWindowModality(Qt.ApplicationModal)

        if self.msgtype == "question":
            self.setIcon(QMessageBox.Question)
            self.setStandardButtons(QMessageBox.Ok|QMessageBox.Cancel)
        else:
            if self.msgtype == "information":
                self.setIcon(QMessageBox.Information)
            else:
                if self.msgtype == "warning":
                    self.setIcon(QMessageBox.Warning)
                else:
                    if self.msgtype == "critical":
                        self.setIcon(QMessageBox.Critical)
                    else:
                        self.setIcon(QMessageBox.NoIcon)

        self.setStandardButtons(QMessageBox.Ok)
Ejemplo n.º 3
0
    def draw_gui(self):

        self.setWindowTitle("Robot Framework Scrib")
        self.setMinimumSize(1300, 800)
        self.setMinimumHeight(800)
        self.setWindowIcon(
            SCR_GetIcon("08e0c30ab7f9c6d43c70165c4ae42460d460c0aa"))
        self.setStyleSheet("background-color: %s; border: 0px;" %
                           (self.config.get_theme_background()))

        self.wdg_central = QWidget()

        self.ly = QVBoxLayout()
        self.ly_h = QHBoxLayout()

        self.draw_toolbar()
        self.draw_test_tree()
        self.draw_test_tab()
        self.draw_main_menu()
        self.draw_action_bar()
        self.draw_status_bar()

        self.ly_h.addWidget(self.wdg_test_tab)

        self.ly.addWidget(self.wdg_toolbar)
        self.ly.addLayout(self.ly_h)
        self.ly.addWidget(self.action_bar)
        self.ly.setAlignment(Qt.AlignTop)

        self.wdg_central.setLayout(self.ly)

        self.setCentralWidget(self.wdg_central)
        self.activateWindow()
Ejemplo n.º 4
0
    def draw_menu(self, point):

        self.tree_item = self.indexAt(point)

        if self.tree_item:

            _user_data = self.get_user_data(self.tree_item)

            if _user_data != None:

                self.context_menu = QMenu()

                if _user_data["type"] == SCR_Tree_Types.TESTFOLDER:

                    self.draw_menu_testfolder(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.TESTSUITE:

                    self.draw_menu_testsuite(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.TESTCASE:

                    self.draw_menu_testcase(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.KEYWORD:

                    self.draw_menu_keyword(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.VARIABLE:

                    self.draw_menu_variable(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.RESOURCE:

                    self.draw_menu_resource(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.LIBRARY:

                    self.draw_menu_library(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.EXTRESOURCES:

                    self.draw_menu_ext_resources(_user_data["data"])

                elif _user_data["type"] == SCR_Tree_Types.EXTLIBRARIES:

                    self.draw_menu_ext_libraries(_user_data["data"])

                self.context_menu.exec_(self.mapToGlobal(point))

            else:
                self.context_menu = QMenu()

                self.context_menu.addAction(
                    SCR_GetIcon("f12404a4b24f4ee746b13893bb7d7e9e67dafd97"),
                    "Search in Test Tree", self.scrib.wdg_test_tree_find.show)

                self.context_menu.exec_(self.mapToGlobal(point))
Ejemplo n.º 5
0
    def draw_menu_resource(self, data):

        self.context_menu.addAction(
            SCR_GetIcon("14b802564477e8b8f64dc869c92a4b983edc1001"),
            "New Keyword",
            partial(self.act_resource.new_keyword, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("de99afcb2a785eea0974463ae9e7e063a5482b4a"),
            "New Scalar Variable",
            partial(self.act_resource.new_var_scalar, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("000cc208d4e675301e21ed009db52ff361a35a9f"),
            "New List Variable",
            partial(self.act_resource.new_var_list, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("490daab16fc73f3decf083a5cfb04b47708c8b22"),
            "New Dictionary Variable",
            partial(self.act_resource.new_var_dict, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("c4c9e8e0c5587117224d03e1b36d2e25d9d096bb"), "Delete",
            partial(self.act_resource.delete, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("e7cec978fe0a220b390f534bc8060904b5a09293"), "Rename",
            partial(self.act_resource.rename, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("b28971455cf45af0e2e37a9c33ca8ca01d5a660f"),
            "Open Folder", partial(self.act_resource.open, self.tree_item,
                                   data))

        self.context_menu.addAction(
            SCR_GetIcon("f12404a4b24f4ee746b13893bb7d7e9e67dafd97"),
            "Search in Resource",
            partial(self.act_resource.search, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("ffc3fb09c5db2b34f971c0ec4979b73de4f14be5"),
            "Find Usage",
            partial(self.act_resource.find_usage, self.tree_item, data))
Ejemplo n.º 6
0
    def data(self, index, role):

        _data = None

        if index.isValid():
            if role == Qt.DisplayRole:

                _item = index.internalPointer()
                _data = _item.data(index.column())
            else:
                if role == Qt.DecorationRole:
                    _item = index.internalPointer()
                    if _item.icon != None:
                        if type(_item.icon) != list:
                            if index.column() == 0:
                                _data = SCR_GetIcon(_item.icon,size="small")
                        else:
                            if _item.icon[index.column()] != None:
                                _data = SCR_GetIcon(_item.icon[index.column()],size="small")
                            else:
                                _data = None
                    else:
                        _data = None
                else:
                    if role == Qt.ToolTipRole:
                        if index.column() == 0:
                            _item = index.internalPointer()
                            _data = _item.tooltip
                    else:
                        if role == Qt.UserRole:
                            _item = index.internalPointer()
                            _data = _item.userdata
                        else:
                            if role == Qt.BackgroundRole:
                                _item = index.internalPointer()
                                _data = _item.background_color
                            else:
                                _data = None
        else:
            _data = None

        return _data
Ejemplo n.º 7
0
    def draw_menu_testcase(self, data):

        self.context_menu.addAction(
            SCR_GetIcon("c4c9e8e0c5587117224d03e1b36d2e25d9d096bb"), "Delete",
            partial(self.act_testcase.delete, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("e7cec978fe0a220b390f534bc8060904b5a09293"), "Rename",
            partial(self.act_testcase.rename, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("85d95f3e36517321283568bf441922f4cfe53ec1"), "Move Up",
            partial(self.act_testcase.moveup, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("8cb8f5436aebe089cb7a9fe81a909675847e0c81"),
            "Move Down",
            partial(self.act_testcase.movedown, self.tree_item, data))
Ejemplo n.º 8
0
    def add_action(self, parent, text, icon, shortcut, callback):

        _action = QAction(parent)
        _action.setText(text)
        _action.setIcon(SCR_GetIcon(icon))

        if shortcut != None:
            _action.setShortcut(shortcut)

        _action.triggered.connect(callback)
        parent.addAction(_action)
Ejemplo n.º 9
0
    def draw_menu_library(self, data):

        self.context_menu.addAction(
            SCR_GetIcon("c4c9e8e0c5587117224d03e1b36d2e25d9d096bb"), "Delete",
            partial(self.act_library.delete, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("e7cec978fe0a220b390f534bc8060904b5a09293"), "Rename",
            partial(self.act_library.rename, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("b28971455cf45af0e2e37a9c33ca8ca01d5a660f"),
            "Open Folder", partial(self.act_library.open, self.tree_item,
                                   data))

        self.context_menu.addAction(
            SCR_GetIcon("ffc3fb09c5db2b34f971c0ec4979b73de4f14be5"),
            "Find Usage",
            partial(self.act_library.find_usage, self.tree_item, data))
Ejemplo n.º 10
0
    def __init__(self,config,icon_normal,icon_hover,tooltip,callback):

        QPushButton.__init__(self)

        self.icon_size = 25

        self.config = config

        _css  = """
            border: 0px solid gray;
            background-color: %s;
        """  % (self.config.get_theme_background(),)

        self.setStyleSheet(_css)

        self.setIcon(SCR_GetIcon(icon_normal))
        self.setIconSize(QSize(self.icon_size,self.icon_size))

        self.icon_normal = icon_normal
        self.icon_hover  = icon_hover

        self.clicked.connect(callback)

        self.setToolTip(tooltip)
Ejemplo n.º 11
0
    def leaveEvent(self,event):

        self.setIcon(SCR_GetIcon(self.icon_normal)) 
        self.setIconSize(QSize(self.icon_size,self.icon_size))
Ejemplo n.º 12
0
    def enterEvent(self,event):

        self.setIcon(SCR_GetIcon(self.icon_hover))
        self.setIconSize(QSize(self.icon_size,self.icon_size))
Ejemplo n.º 13
0
    def __init__(self, config, tree):

        QWidget.__init__(self, tree)

        self.config = config

        self._items = []
        self._item_idx = 0
        self._text_changed = False
        self.tree = tree
        self.selection_type = "all"

        #write line
        self.line = QLineEdit()
        self.line.setContextMenuPolicy(Qt.NoContextMenu)
        self.line.setStyleSheet('border: 1px solid gray;')
        self.line.returnPressed.connect(self._find_next)
        self.line.textEdited.connect(self._textedited)

        #find previous button
        self._find_prev_button = QToolButton()
        self._find_prev_button.setStyleSheet(
            "background: transparent; border-radius: 0px")
        self._find_prev_button.setIcon(
            SCR_GetIcon('85905e29412dc4ee1bca3b78beeca05a0ea1d14b'))
        self._find_prev_button.setToolTip("Find Previous Item")
        self._find_prev_button.clicked.connect(self._find_prev)

        #find next button
        self._find_next_button = QToolButton()
        self._find_next_button.setStyleSheet(
            "background: transparent; border-radius: 0px")
        self._find_next_button.setIcon(
            SCR_GetIcon('47d97a19678ecbc93257bfc890b71cc62f4ae908'))
        self._find_prev_button.setToolTip("Find Next Item")
        self._find_next_button.clicked.connect(self._find_next)

        #close button
        self._close_button = QToolButton()
        self._close_button.setStyleSheet(
            "background: transparent; border-radius: 0px")
        self._close_button.setIcon(
            SCR_GetIcon('779d79bcda4833c45d97b063d0041af2e47265e4'))
        self._find_prev_button.setToolTip("Close Test Tree Search Bar")
        self._close_button.clicked.connect(self.hide)

        #type selection
        self._selection = SCR_WDG_Selection(self.config)
        self._selection.setFixedWidth(80)
        self._selection.setStyleSheet('border: 1px solid gray;')
        self._selection.currentIndexChanged.connect(self.selection_change)

        _data = [
            {
                "All": "all"
            },
            {
                "Test Suite": SCR_Tree_Types.TESTSUITE
            },
            {
                "Test Case": SCR_Tree_Types.TESTCASE
            },
            {
                "Keyword": SCR_Tree_Types.KEYWORD
            },
            {
                "Variable": SCR_Tree_Types.VARIABLE
            },
            {
                "Folder": SCR_Tree_Types.TESTFOLDER
            },
            {
                "Resource": SCR_Tree_Types.RESOURCE
            },
            {
                "Library": SCR_Tree_Types.LIBRARY
            },
        ]

        self._selection.populate(_data)

        box = QHBoxLayout(self)
        box.addWidget(self.line)
        box.addWidget(self._selection)
        box.addWidget(self._find_next_button)
        box.addWidget(self._find_prev_button)
        box.addWidget(self._close_button)
        box.setSizeConstraint(3)
        box.setContentsMargins(8, 8, 5, 5)
        self.setLayout(box)
Ejemplo n.º 14
0
    def draw_menu_ext_libraries(self, data):

        self.context_menu.addAction(
            SCR_GetIcon("f12404a4b24f4ee746b13893bb7d7e9e67dafd97"),
            "Search in External Libraries",
            partial(self.act_ext_libraries.search, self.tree_item, data))
Ejemplo n.º 15
0
    def draw_menu_testsuite(self, data):

        self.context_menu.addAction(
            SCR_GetIcon("ca211c47afa3b991350a6c183d8aaf3f33db15a0"),
            "New Test Case",
            partial(self.act_testsuite.new_testcase, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("14b802564477e8b8f64dc869c92a4b983edc1001"),
            "New Keyword",
            partial(self.act_testsuite.new_keyword, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("de99afcb2a785eea0974463ae9e7e063a5482b4a"),
            "New Scalar Variable",
            partial(self.act_testsuite.new_var_scalar, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("000cc208d4e675301e21ed009db52ff361a35a9f"),
            "New List Variable",
            partial(self.act_testsuite.new_var_list, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("490daab16fc73f3decf083a5cfb04b47708c8b22"),
            "New Dictionary Variable",
            partial(self.act_testsuite.new_var_dict, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("836b4d076077202c00f2fbd10c605023bb2bbfe5"),
            "Select All Test Cases",
            partial(self.act_testsuite.sel_all, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("98e83543511ae234092459c5450e0d0dee23337d"),
            "Select All Failed Test Cases",
            partial(self.act_testsuite.sel_all_failed, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("a37bb6398d3f69a8f2914f3cdcb209fbf2e2cfc7"),
            "Select All Passed Test Cases",
            partial(self.act_testsuite.sel_all_passed, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("b49bc191b2a8c689d3d25431dde459e769349b8f"),
            "Deselect All Test Cases",
            partial(self.act_testsuite.desel_all, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("a2588e1c2a378b9710d5a1b74299060ca2271413"),
            "Deselect All Failed Test Cases",
            partial(self.act_testsuite.desel_all_failed, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("8bd133d5a6e9b47ba80a6d774149085b20483fb0"),
            "Deselect All Passed Test Cases",
            partial(self.act_testsuite.desel_all_passed, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("c4c9e8e0c5587117224d03e1b36d2e25d9d096bb"), "Delete",
            partial(self.act_testsuite.delete, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("e7cec978fe0a220b390f534bc8060904b5a09293"), "Rename",
            partial(self.act_testsuite.rename, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("b28971455cf45af0e2e37a9c33ca8ca01d5a660f"),
            "Open Folder",
            partial(self.act_testsuite.open, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("f12404a4b24f4ee746b13893bb7d7e9e67dafd97"),
            "Search in Test Suite",
            partial(self.act_testsuite.search, self.tree_item, data))
Ejemplo n.º 16
0
    def draw_menu_testfolder(self, data):

        self.context_menu.addAction(
            SCR_GetIcon("8e205a227046baee2a67b75fb12c95813784c484"),
            "New Test Suite",
            partial(self.act_testfolder.new_test_suite, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("26b41084d7c558d94b50f5e1c40cdfd362f05478"),
            "New Resource",
            partial(self.act_testfolder.new_resource, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("66a73259d66004e2b9c7180030bc347836ddcb82"),
            "New Library",
            partial(self.act_testfolder.new_library, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("585ba3e6f845cb67ef8a6098bed724e247278a5b"),
            "New Folder",
            partial(self.act_testfolder.new_folder, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("c4c9e8e0c5587117224d03e1b36d2e25d9d096bb"), "Delete",
            partial(self.act_testfolder.delete, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("e7cec978fe0a220b390f534bc8060904b5a09293"), "Rename",
            partial(self.act_testfolder.rename, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("836b4d076077202c00f2fbd10c605023bb2bbfe5"),
            "Select All Test Cases",
            partial(self.act_testfolder.sel_all, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("98e83543511ae234092459c5450e0d0dee23337d"),
            "Select All Failed Test Cases",
            partial(self.act_testfolder.sel_all_failed, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("a37bb6398d3f69a8f2914f3cdcb209fbf2e2cfc7"),
            "Select All Passed Test Cases",
            partial(self.act_testfolder.sel_all_passed, self.tree_item, data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("b49bc191b2a8c689d3d25431dde459e769349b8f"),
            "Deselect All Test Cases",
            partial(self.act_testfolder.desel_all, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("a2588e1c2a378b9710d5a1b74299060ca2271413"),
            "Deselect All Failed Test Cases",
            partial(self.act_testfolder.desel_all_failed, self.tree_item,
                    data))

        self.context_menu.addAction(
            SCR_GetIcon("8bd133d5a6e9b47ba80a6d774149085b20483fb0"),
            "Deselect All Passed Test Cases",
            partial(self.act_testfolder.desel_all_passed, self.tree_item,
                    data))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("8c4ee08746e9d4d8b64596c87ac3fab1"), "Expand",
            partial(self.expandChildren, self.tree_item))

        self.context_menu.addAction(
            SCR_GetIcon("1022c7267f54abc54bd42a8b279d9180"), "Collapse",
            partial(self.collapseChildren, self.tree_item))

        self.context_menu.addSeparator()

        self.context_menu.addAction(
            SCR_GetIcon("b28971455cf45af0e2e37a9c33ca8ca01d5a660f"),
            "Open Folder",
            partial(self.act_testfolder.open, self.tree_item, data))

        self.context_menu.addAction(
            SCR_GetIcon("f12404a4b24f4ee746b13893bb7d7e9e67dafd97"),
            "Search in Folder",
            partial(self.act_testfolder.search, self.tree_item, data))