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 update_semi_runs(self):
        print('update')
        self.semi_runs_frame.destroy()

        self.semi_runs_frame = QtWidgets.QFrame()
        self.semi_runs_vbox = QtWidgets.QVBoxLayout()
        self.semi_runs_frame.setLayout(self.semi_runs_vbox)
        self.semi_scroll_area.setWidget(self.semi_runs_frame)

        semi_runs_info = self.db.get_semi_runs_info()

        if len(semi_runs_info) > 0:
            for r_num in range(self.db.get_next_prel_run_number(), self.db.get_next_second_run_number()):
                run = [None, None, None, None, None]
                for info in semi_runs_info:
                    if info[3] == r_num:
                        run[0] = info[2]
                        if info[4] == 1:
                            run[1] = info
                        if info[4] == 2:
                            run[2] = info
                        if info[4] == 3:
                            run[3] = info
                        if info[4] == 4:
                            run[4] = info

                rw = RunWidget(run_num=r_num, run_participants=run, dbhandler=self.db)
                rw.neededit.connect(self.edit_second_run)
                self.semi_runs_vbox.addWidget(rw)
Example #3
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)