def setUp(self):
     super(ConsoleWidgetTestCase, self).setUp()
     self.patch(console_widget.completer_widget, "CompleterWidget",
                FakeCompleterWidget)
     self.patch(console_widget.ConsoleWidget, "_create_context_menu",
                lambda *arg: None)
     self.console_widget = console_widget.ConsoleWidget()
示例#2
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)

        self.__toolbar = QToolBar()
        vbox.addWidget(self.__toolbar)

        self.stack = StackedWidget()
        vbox.addWidget(self.stack)

        self._console = console_widget.ConsoleWidget()
        self.stack.addWidget(self._console)

        self._runWidget = run_widget.RunWidget()
        self.stack.addWidget(self._runWidget)

        self._web = web_render.WebRender()
        self.stack.addWidget(self._web)

        self._findInFilesWidget = find_in_files.FindInFilesWidget(
            self.parent())
        self.stack.addWidget(self._findInFilesWidget)

        #Last Element in the Stacked widget
        self._results = results.Results(self)
        self.stack.addWidget(self._results)

        self._btnConsole = QPushButton(QIcon(resources.IMAGES['console']), '')
        self._btnConsole.setToolTip(self.tr("Console"))
        self._btnRun = QPushButton(QIcon(resources.IMAGES['play']), '')
        self._btnRun.setToolTip(self.tr("Output"))
        self._btnWeb = QPushButton(QIcon(resources.IMAGES['web']), '')
        self._btnWeb.setToolTip(self.tr("Web Preview"))
        self._btnFind = QPushButton(QIcon(resources.IMAGES['find']), '')
        self._btnFind.setToolTip(self.tr("Find in Files"))
        self.__toolbar.addWidget(self._btnConsole)
        self.__toolbar.addWidget(self._btnRun)
        self.__toolbar.addWidget(self._btnWeb)
        self.__toolbar.addWidget(self._btnFind)

        self.connect(self._btnConsole, SIGNAL("clicked()"),
                     lambda: self._item_changed(0))
        self.connect(self._btnRun, SIGNAL("clicked()"),
                     lambda: self._item_changed(1))
        self.connect(self._btnWeb, SIGNAL("clicked()"),
                     lambda: self._item_changed(2))
        self.connect(self._btnFind, SIGNAL("clicked()"),
                     lambda: self._item_changed(3))
示例#3
0
    def setup_ui(self):
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)

        self.__toolbar = QToolBar()
        self.__toolbar.setObjectName('custom')
        hbox = QHBoxLayout()
        vbox.addLayout(hbox)

        self.stack = StackedWidget()
        vbox.addWidget(self.stack)

        self._console = console_widget.ConsoleWidget()
        self.stack.addWidget(self._console)

        self._runWidget = run_widget.RunWidget()
        self.stack.addWidget(self._runWidget)

        self._web = web_render.WebRender()
        self.stack.addWidget(self._web)

        self._findInFilesWidget = find_in_files.FindInFilesWidget(
            self.parent())
        self.stack.addWidget(self._findInFilesWidget)

        #Last Element in the Stacked widget
        self._results = results.Results(self)
        self.stack.addWidget(self._results)

        self._btnConsole = QPushButton(QIcon(":img/console"), '')
        self._btnConsole.setToolTip(self.tr("Console"))
        self._btnRun = QPushButton(QIcon(":img/play"), '')
        self._btnRun.setToolTip(self.tr("Output"))
        self._btnWeb = QPushButton(QIcon(":img/web"), '')
        self._btnWeb.setToolTip(self.tr("Web Preview"))
        self._btnFind = QPushButton(QIcon(":img/find"), '')
        self._btnFind.setToolTip(self.tr("Find in Files"))
        #Toolbar
        hbox.addWidget(self.__toolbar)
        self.__toolbar.addWidget(self._btnConsole)
        self.__toolbar.addWidget(self._btnRun)
        self.__toolbar.addWidget(self._btnWeb)
        self.__toolbar.addWidget(self._btnFind)
        self.__toolbar.addSeparator()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        btn_close = QPushButton(
            self.style().standardIcon(QStyle.SP_DialogCloseButton), '')
        btn_close.setObjectName('navigation_button')
        btn_close.setToolTip(self.tr('F4: Show/Hide'))
        hbox.addWidget(btn_close)

        # Not Configurable Shortcuts
        shortEscMisc = QShortcut(QKeySequence(Qt.Key_Escape), self)
        self.connect(shortEscMisc, SIGNAL("activated()"), self.hide)

        self.connect(self._btnConsole, SIGNAL("clicked()"),
                     lambda: self._item_changed(0))
        self.connect(self._btnRun, SIGNAL("clicked()"),
                     lambda: self._item_changed(1))
        self.connect(self._btnWeb, SIGNAL("clicked()"),
                     lambda: self._item_changed(2))
        self.connect(self._btnFind, SIGNAL("clicked()"),
                     lambda: self._item_changed(3))
        self.connect(btn_close, SIGNAL('clicked()'), self.hide)
示例#4
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)

        self.__toolbar = QToolBar()
        self.__toolbar.setObjectName('custom')
        hbox = QHBoxLayout()
        vbox.addLayout(hbox)

        self.stack = StackedWidget()
        vbox.addWidget(self.stack)

        self._console = console_widget.ConsoleWidget()
        self.stack.addWidget(self._console)

        self._runWidget = run_widget.RunWidget()
        self.stack.addWidget(self._runWidget)

        self._web = web_render.WebRender()
        self.stack.addWidget(self._web)

        self._findInFilesWidget = find_in_files.FindInFilesWidget(
            self.parent())
        self.stack.addWidget(self._findInFilesWidget)

        #Last Element in the Stacked widget
        self._results = results.Results(self)
        self.stack.addWidget(self._results)

        self._btnConsole = QPushButton(QIcon(resources.IMAGES['console']), '')
        self._btnConsole.setToolTip(self.tr("Console"))
        self._btnRun = QPushButton(QIcon(resources.IMAGES['play']), '')
        self._btnRun.setToolTip(self.tr("Output"))
        self._btnWeb = QPushButton(QIcon(resources.IMAGES['web']), '')
        self._btnWeb.setToolTip(self.tr("Web Preview"))
        self._btnFind = QPushButton(QIcon(resources.IMAGES['find']), '')
        self._btnFind.setToolTip(self.tr("Find in Files"))
        #Toolbar
        hbox.addWidget(self.__toolbar)
        self.__toolbar.addWidget(self._btnConsole)
        self.__toolbar.addWidget(self._btnRun)
        self.__toolbar.addWidget(self._btnWeb)
        self.__toolbar.addWidget(self._btnFind)
        self.__toolbar.addSeparator()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        btn_close = QPushButton(
            self.style().standardIcon(QStyle.SP_DialogCloseButton), '')
        btn_close.setObjectName('navigation_button')
        btn_close.setToolTip(self.tr('F4: Show/Hide'))
        hbox.addWidget(btn_close)

        self.connect(self._btnConsole, SIGNAL("clicked()"),
                     lambda: self._item_changed(0))
        self.connect(self._btnRun, SIGNAL("clicked()"),
                     lambda: self._item_changed(1))
        self.connect(self._btnWeb, SIGNAL("clicked()"),
                     lambda: self._item_changed(2))
        self.connect(self._btnFind, SIGNAL("clicked()"),
                     lambda: self._item_changed(3))
        self.connect(btn_close, SIGNAL('clicked()'), self.hide)