예제 #1
0
    def __init__(self, parent):
        super(DetailModule, self).__init__(parent)
        self.asset = self._is_loading = self._load_queue = False
        toolbar_layout = QHBoxLayout()

        fdata = []
        for id_folder in sorted(config["folders"].keys()):
            fdata.append({
                "value": id_folder,
                "alias": config["folders"][id_folder]["title"],
                "role": "option",
            })

        self.folder_select = FireflySelect(self, data=fdata)
        for i, fd in enumerate(fdata):
            self.folder_select.setItemIcon(
                i, QIcon(pixlib["folder_" + str(fd["value"])]))
        self.folder_select.currentIndexChanged.connect(self.on_folder_changed)
        self.folder_select.setEnabled(False)
        toolbar_layout.addWidget(self.folder_select, 0)

        self.duration = FireflyTimecode(self)
        toolbar_layout.addWidget(self.duration, 0)

        self.toolbar = detail_toolbar(self)
        toolbar_layout.addWidget(self.toolbar)
        self.detail_tabs = DetailTabs(self)
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addLayout(toolbar_layout, 1)
        layout.addWidget(self.detail_tabs)
        self.setLayout(layout)
예제 #2
0
    def __init__(self, parent):
        super(JobsModule, self).__init__(parent)

        self.view = FireflyJobsView(self)

        toolbar = QToolBar()

        btn_active = QPushButton("ACTIVE")
        btn_active.setCheckable(True)
        btn_active.setChecked(True)
        btn_active.setAutoExclusive(True)
        btn_active.clicked.connect(functools.partial(self.set_view, "active"))
        toolbar.addWidget(btn_active)

        btn_finished = QPushButton("FINISHED")
        btn_finished.setCheckable(True)
        btn_finished.setAutoExclusive(True)
        btn_finished.clicked.connect(
            functools.partial(self.set_view, "finished"))
        toolbar.addWidget(btn_finished)

        btn_failed = QPushButton("FAILED")
        btn_failed.setCheckable(True)
        btn_failed.setAutoExclusive(True)
        btn_failed.clicked.connect(functools.partial(self.set_view, "failed"))
        toolbar.addWidget(btn_failed)

        toolbar.addWidget(ToolBarStretcher(self))

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(toolbar, 0)
        layout.addWidget(self.view, 1)
        self.setLayout(layout)
        self.set_view("active")
예제 #3
0
    def __init__(self, parent, **kwargs):
        super(BrowserTab, self).__init__(parent)
        self._parent = parent
        self.loading = False
        self.title = False

        # Search query

        self.search_query = {
            "id_view": kwargs.get("id_view", min(config["views"])),
            "fulltext": kwargs.get("fulltext", ""),
            "order": kwargs.get("order", "ctime desc"),
            "conds": kwargs.get("conds", []),
        }

        # Layout

        self.search_box = SearchWidget(self)
        if self.search_query.get("fulltext"):
            self.search_box.setText(self.search_query["fulltext"])

        self.first_load = True
        self.view = FireflyBrowserView(self)
        self.view.horizontalHeader().sectionResized.connect(self.on_section_resize)
        self.view.horizontalHeader().sortIndicatorChanged.connect(
            self.on_section_resize
        )

        action_clear = QAction(QIcon(pixlib["cancel"]), "&Clear search query", parent)
        action_clear.triggered.connect(self.on_clear)

        self.action_search = QMenu("Views")
        self.action_search.setStyleSheet(app_skin)
        self.action_search.menuAction().setIcon(QIcon(pixlib["search"]))
        self.action_search.menuAction().triggered.connect(self.load)
        self.load_view_menu()

        action_copy = QAction("Copy result", self)
        action_copy.setShortcut("CTRL+SHIFT+C")
        action_copy.triggered.connect(self.on_copy_result)
        self.addAction(action_copy)

        toolbar = QToolBar(self)
        toolbar.addAction(action_clear)
        toolbar.addAction(self.action_search.menuAction())

        search_layout = QHBoxLayout()
        search_layout.setContentsMargins(0, 0, 0, 0)
        search_layout.addWidget(self.search_box)
        search_layout.addWidget(toolbar)

        self.pager = Pager(self)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addLayout(search_layout, 0)
        layout.addWidget(self.view, 1)
        layout.addWidget(self.pager, 0)
        self.setLayout(layout)
예제 #4
0
    def __init__(self, parent):
        super(SchedulerModule, self).__init__(parent)
        toolbar = scheduler_toolbar(self)
        self.calendar = SchedulerCalendar(self)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(2)
        layout.addWidget(toolbar, 0)
        layout.addWidget(self.calendar, 1)

        self.setLayout(layout)
예제 #5
0
    def __init__(self, parent):
        super(RundownModule, self).__init__(parent)
        self.start_time = 0
        self.current_item = False
        self.cued_item = False
        self.last_search = ""
        self.first_load = True

        self.edit_wanted = self.app_state.get("edit_enabled", True)
        self.edit_enabled = False

        self.toolbar = rundown_toolbar(self)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(2)
        layout.addWidget(self.toolbar, 0)

        self.view = RundownView(self)

        self.mcr = self.plugins = False

        if has_right("mcr", anyval=True):
            self.mcr = MCR(self)
            self.plugins = PlayoutPlugins(self)
            if self.app_state.get("show_mcr", False):
                self.mcr.show()
            else:
                self.mcr.hide()

            if self.app_state.get("show_plugins", False):
                self.plugins.show()
            else:
                self.plugins.hide()
            layout.addWidget(self.mcr)
            layout.addWidget(self.plugins)

        layout.addWidget(self.view, 1)
        self.setLayout(layout)
예제 #6
0
class BrowserModule(BaseModule):
    def __init__(self, parent):
        super(BrowserModule, self).__init__(parent)
        self.tabs = QTabWidget(self)
        self.tabs.setTabsClosable(True)
        self.tabs.tabCloseRequested.connect(self.close_tab)
        self.tabs.currentChanged.connect(self.on_tab_switch)

        self.layout = QVBoxLayout(self)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.addWidget(self.tabs)

        self.setLayout(self.layout)

        tabscfg = self.app_state.get("browser_tabs", [])
        created_tabs = 0
        current_index = 0
        for tabcfg in tabscfg:
            try:
                if tabcfg["id_view"] not in config["views"]:
                    continue
                if tabcfg.get("active"):
                    current_index = self.tabs.count()
                try:
                    del tabcfg["active"]
                except KeyError:
                    pass
                title = False
                if tabcfg.get("title"):
                    title = tabcfg.get("title")
                try:
                    del tabcfg["title"]
                except KeyError:
                    pass

                self.new_tab(title, **tabcfg)
                created_tabs += 1
            except Exception:
                log_traceback()
                logging.warning("Unable to restore tab")
        if not created_tabs:
            self.new_tab()

        self.tabs.setCurrentIndex(current_index)

    def new_tab(self, title=False, **kwargs):
        if "id_view" not in kwargs:
            try:
                id_view = self.tabs.currentWidget().id_view
            except AttributeError:
                pass
            else:
                kwargs["id_view"] = id_view
        tab = BrowserTab(self, **kwargs)
        self.tabs.addTab(tab, "New tab")
        self.tabs.setCurrentIndex(self.tabs.indexOf(tab))
        tab.title = title
        tab.load()
        return tab

    @property
    def browsers(self):
        r = []
        for i in range(0, self.tabs.count()):
            r.append(self.tabs.widget(i))
        return r

    def close_tab(self, idx=False):
        if self.tabs.count() == 1:
            return
        if not idx:
            idx = self.tabs.currentIndex()
        w = self.tabs.widget(idx)
        w.deleteLater()
        self.tabs.removeTab(idx)
        self.redraw_tabs()

    def prev_tab(self):
        cur = self.tabs.currentIndex()
        if cur == 0:
            n = self.tabs.count() - 1
        else:
            n = cur - 1
        self.tabs.setCurrentIndex(n)

    def next_tab(self):
        cur = self.tabs.currentIndex()
        if cur == self.tabs.count() - 1:
            n = 0
        else:
            n = cur + 1
        self.tabs.setCurrentIndex(n)

    def on_tab_switch(self):
        browser = self.browsers[self.tabs.currentIndex()]
        sel = browser.view.selected_objects
        if sel:
            self.main_window.focus(sel[0])
        browser.search_box.setFocus()
        self.redraw_tabs()

    def load(self):
        for b in self.browsers:
            b.load()

    def redraw_tabs(self, *args, **kwargs):
        QApplication.processEvents()
        views = []
        for i, b in enumerate(self.browsers):
            id_view = b.id_view
            self.tabs.setTabText(i, b.title or config["views"][id_view]["title"])
            sq = copy.copy(b.search_query)
            if self.tabs.currentIndex() == i:
                sq["active"] = True
            if b.title:
                sq["title"] = b.title
            views.append(sq)
        self.app_state["browser_tabs"] = views

    def seismic_handler(self, message):
        for b in self.browsers:
            b.seismic_handler(message)

    def refresh_assets(self, *objects, request_data=False):
        for b in self.browsers:
            b.refresh_assets(*objects, request_data=request_data)