Example #1
0
class DisplayContainer(QWidget, DisplayContainerGeneric):

    def __init__(self, main):
        QWidget.__init__(self)
        DisplayContainerGeneric.__init__(self)
        self._main = main
        vbox = QVBoxLayout(self)
        self.stack = StackedWidget()
        
        vbox.addWidget(self.stack)
        self._console = ConsoleWidget()
        self.stack.addWidget(self._console)

        self.runWidget = RunWidget()
        self.stack.addWidget(self.runWidget)

        self.web = WebRender()
        self.stack.addWidget(self.web)

        self.combo = QComboBox()
        self.combo.addItem(QIcon(resources.images['console']), '')
        self.combo.addItem(QIcon(resources.images['play']), '')
        self.combo.addItem(QIcon(resources.images['web']), '')
        self.connect(self.combo, SIGNAL("currentIndexChanged(int)"), self._item_changed)

    def gain_focus(self):
        self._console.setFocus()

    @pyqtSignature('int')
    def _item_changed(self, val):
        if not self.isVisible():
            self._main.containerIsVisible = True
            self.show()
        self.stack.show_display(val)

    def load_toolbar(self, toolbar):
        toolbar.addSeparator()
        toolbar.addWidget(self.combo)

    def run_application(self, fileName):
        self.combo.setCurrentIndex(1)
        self.runWidget.start_process(fileName)

    def kill_application(self):
        self.runWidget.kill_process()

    def render_web_page(self, url):
        self.combo.setCurrentIndex(2)
        self.web.render_page(url)

    def add_to_stack(self, widget, icon):
        self.stack.addWidget(widget)
        self.combo.addItem(QIcon(icon), '')
Example #2
0
    def __init__(self, main):
        QWidget.__init__(self)
        DisplayContainerGeneric.__init__(self)
        self._main = main
        vbox = QVBoxLayout(self)
        self.stack = StackedWidget()
        
        vbox.addWidget(self.stack)
        self._console = ConsoleWidget()
        self.stack.addWidget(self._console)

        self.runWidget = RunWidget()
        self.stack.addWidget(self.runWidget)

        self.web = WebRender()
        self.stack.addWidget(self.web)

        self.combo = QComboBox()
        self.combo.addItem(QIcon(resources.images['console']), '')
        self.combo.addItem(QIcon(resources.images['play']), '')
        self.combo.addItem(QIcon(resources.images['web']), '')
        self.connect(self.combo, SIGNAL("currentIndexChanged(int)"), self._item_changed)