def __init__(self, context_model=None, parent=None): super(BrowsePackagePane, self).__init__(parent) ContextViewMixin.__init__(self, context_model) self.browse = BrowsePackageWidget(self.context_model) self.settings = ContextSettingsWidget(self.context_model, attributes=("packages_path",)) icon = get_icon("package", as_qicon=True) self.addTab(self.browse, icon, "packages") icon = get_icon("cog", as_qicon=True) self.addTab(self.settings, icon, "settings")
def __init__(self, icon_name, tooltip=None, parent=None): super(IconButton, self).__init__(parent) icon = get_icon(icon_name) self.setPixmap(icon) self.setCursor(QtCore.Qt.PointingHandCursor) if tooltip: self.setToolTip(tooltip)
def __init__(self, context_model=None, versions_tab=False, parent=None): super(PackageTabWidget, self).__init__(parent) ContextViewMixin.__init__(self, context_model) self.variant = None self.tabs = {} self.summary_widget = VariantSummaryWidget() self.tools_widget = VariantToolsList(self.context_model) self.variants_widget = VariantsList() self.changelog_edit = VariantChangelogEdit() self.details_widget = VariantDetailsWidget(self.context_model) self.help_widget = VariantHelpWidget(self.context_model) if versions_tab: self.versions_widget = VariantVersionsWidget(self.context_model) else: self.versions_widget = None n = 0 icon = get_icon("package", as_qicon=True) self.addTab(self.summary_widget, icon, "package summary") self.tabs["summary"] = dict(index=n, lazy=False) n += 1 if self.versions_widget: icon = get_icon("versions", as_qicon=True) self.addTab(self.versions_widget, icon, "versions") self.tabs["versions"] = dict(index=n, lazy=True) n += 1 icon = get_icon("variant", as_qicon=True) self.addTab(self.variants_widget, icon, "variants") self.tabs["variants"] = dict(index=n, lazy=False) n += 1 icon = get_icon("tools", as_qicon=True) self.addTab(self.tools_widget, icon, "tools") self.tabs["tools"] = dict(index=n, lazy=False) n += 1 icon = get_icon("changelog", as_qicon=True) self.addTab(self.changelog_edit, icon, "changelog") self.tabs["changelog"] = dict(index=n, lazy=True) n += 1 icon = get_icon("help", as_qicon=True) self.addTab(self.help_widget, icon, "help") self.tabs["help"] = dict(index=n, lazy=True) n += 1 icon = get_icon("info", as_qicon=True) self.addTab(self.details_widget, icon, "details") self.tabs["info"] = dict(index=n, lazy=False) self.currentChanged.connect(self._tabChanged) self.setEnabled(False)
def __init__(self, context_model=None, parent=None): super(ContextToolsWidget, self).__init__(parent) ContextViewMixin.__init__(self, context_model) self.tool_widgets = {} self.package_icon = get_icon("package", as_qicon=True) h = self.header() h.stretchLastSection() h.setResizeMode(QtGui.QHeaderView.Fixed) h.setVisible(False) self.setColumnCount(2) self.setFocusPolicy(QtCore.Qt.NoFocus) app.process_tracker.instanceCountChanged.connect(self._instanceCountChanged) self.refresh()
def __init__(self, context_model=None, parent=None): super(ContextToolsWidget, self).__init__(parent) ContextViewMixin.__init__(self, context_model) self.tool_widgets = {} self.package_icon = get_icon("package", as_qicon=True) h = self.header() h.stretchLastSection() h.setResizeMode(QtWidgets.QHeaderView.Fixed) h.setVisible(False) self.setColumnCount(2) self.setFocusPolicy(QtCore.Qt.NoFocus) #app.process_tracker.instanceCountChanged.connect(self._instanceCountChanged) self.refresh()
def _contextChanged(self, flags=0): stale = self.context_model.is_stale() context = self.context() is_context = bool(context) self.diff_action.setEnabled(not stale) self.diff_tbtn.setEnabled(not stale) self.undiff_tbtn.setEnabled(not stale) self.shell_tbtn.setEnabled(not stale) self.lock_tbtn.setEnabled(is_context) self.find_tbtn.setEnabled(is_context) self.tab.setTabEnabled(2, is_context) self.tab.setTabEnabled(3, is_context) tab_text = "context*" if stale else "context" self.tab.setTabText(0, tab_text) context_changed = (flags & ContextModel.CONTEXT_CHANGED) if context_changed: if is_context and context.requested_timestamp: t = time.localtime(context.requested_timestamp) t_str = time.strftime("%a %b %d %H:%M:%S %Y", t) txt = "packages released after %s were ignored" % t_str self.time_lock_tbtn.setToolTip(txt) self.time_lock_tbtn_action.setVisible(True) else: self.time_lock_tbtn_action.setVisible(False) settings_modified = ((flags & ContextModel.PACKAGES_PATH_CHANGED) and not context_changed) label = "settings*" if settings_modified else "settings" self.tab.setTabText(1, label) if flags & (ContextModel.LOCKS_CHANGED | ContextModel.CONTEXT_CHANGED): lock_type = self.context_model.default_patch_lock icon = get_icon(lock_type.name, as_qicon=True) self.lock_tbtn.setIcon(icon)
def __init__(self, parent=None): super(AboutDialog, self).__init__(parent) self.setWindowTitle("About Rez") version = Version(__version__) public_version = version.trim(2) label = QtGui.QLabel( "<font size='+2'><b>Rez version %s</b></font><br><br>" "Build version %s." % (str(public_version), str(version))) close_btn = QtGui.QPushButton("Close") github_btn = QtGui.QPushButton("Github") github_icon = get_icon("github_32", as_qicon=True) github_btn.setIcon(github_icon) btn_pane = create_pane([None, github_btn, close_btn], True, compact=True) create_pane([label, None, btn_pane], False, parent_widget=self) github_btn.clicked.connect(self._goto_github) close_btn.clicked.connect(self.close) close_btn.setFocus()
def __init__(self, context_model=None, parent=None): super(ContextManagerWidget, self).__init__(parent) ContextViewMixin.__init__(self, context_model) # widgets self.popup = None self.context_table = ContextTableWidget(self.context_model) self.show_effective_request_checkbox = QtGui.QCheckBox( "show effective request") resolve_time_label = ContextResolveTimeLabel(self.context_model) self.time_lock_tbtn = QtGui.QToolButton() icon = get_icon("time_lock", as_qicon=True) self.time_lock_tbtn.setIcon(icon) self.find_tbtn = QtGui.QToolButton() self.find_tbtn.setToolTip("find resolved package") icon = get_icon("find", as_qicon=True) self.find_tbtn.setIcon(icon) self.shell_tbtn = QtGui.QToolButton() self.shell_tbtn.setToolTip("open shell") icon = get_icon("terminal", as_qicon=True) self.shell_tbtn.setIcon(icon) self.diff_tbtn = QtGui.QToolButton() self.diff_tbtn.setToolTip("enter diff mode") self.diff_tbtn.setPopupMode(QtGui.QToolButton.MenuButtonPopup) self.diff_menu = QtGui.QMenu() self.diff_action = add_menu_action(self.diff_menu, "Diff Against Current", self._diff_with_last_resolve, "diff") self.diff_to_disk_action = add_menu_action(self.diff_menu, "Diff Against Disk", self._diff_with_disk, "diff_to_disk") self.diff_to_other_action = add_menu_action(self.diff_menu, "Diff Against Other...", self._diff_with_other, "diff_to_other") self.diff_tbtn.setMenu(self.diff_menu) self.diff_tbtn.setDefaultAction(self.diff_action) self.undiff_tbtn = QtGui.QToolButton() self.undiff_tbtn.setToolTip("leave diff mode") icon = get_icon("diff", as_qicon=True) self.undiff_tbtn.setIcon(icon) self.undiff_tbtn.setCheckable(True) self.lock_tbtn = QtGui.QToolButton() self.lock_tbtn.setToolTip("locking") icon = get_icon("no_lock", as_qicon=True) self.lock_tbtn.setIcon(icon) self.lock_tbtn.setPopupMode(QtGui.QToolButton.InstantPopup) menu = QtGui.QMenu() for lock_type in PatchLock: fn = partial(self._set_lock_type, lock_type) add_menu_action(menu, lock_type.description, fn, lock_type.name) menu.addSeparator() add_menu_action(menu, "Remove Explicit Locks", self._removeExplicitLocks) self.lock_tbtn.setMenu(menu) self.revert_tbtn = QtGui.QToolButton() self.revert_tbtn.setToolTip("revert") icon = get_icon("revert", as_qicon=True) self.revert_tbtn.setIcon(icon) self.revert_tbtn.setPopupMode(QtGui.QToolButton.InstantPopup) self.revert_menu = QtGui.QMenu() self.revert_action = add_menu_action(self.revert_menu, "Revert To Last Resolve...", self._revert_to_last_resolve, "revert") self.revert_diff_action = add_menu_action(self.revert_menu, "Revert To Reference...", self._revert_to_diff, "revert_to_diff") self.revert_disk_action = add_menu_action(self.revert_menu, "Revert To Disk...", self._revert_to_disk, "revert_to_disk") self.revert_tbtn.setMenu(self.revert_menu) resolve_tbtn = QtGui.QToolButton() resolve_tbtn.setPopupMode(QtGui.QToolButton.MenuButtonPopup) menu = QtGui.QMenu() default_resolve_action = add_menu_action(menu, "Resolve", self._resolve, "resolve") add_menu_action(menu, "Advanced Resolve...", partial(self._resolve, advanced=True), "advanced_resolve") resolve_tbtn.setDefaultAction(default_resolve_action) resolve_tbtn.setMenu(menu) toolbar = QtGui.QToolBar() toolbar.addWidget(resolve_time_label) self.time_lock_tbtn_action = toolbar.addWidget(self.time_lock_tbtn) toolbar.addSeparator() toolbar.addWidget(self.find_tbtn) toolbar.addWidget(self.shell_tbtn) self.diff_tbtn_action = toolbar.addWidget(self.diff_tbtn) self.undiff_tbtn_action = toolbar.addWidget(self.undiff_tbtn) toolbar.addWidget(self.lock_tbtn) toolbar.addWidget(self.revert_tbtn) toolbar.addWidget(resolve_tbtn) self.time_lock_tbtn_action.setVisible(False) self.undiff_tbtn_action.setVisible(False) self.time_lock_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.find_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.shell_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.diff_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.lock_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.revert_tbtn.setCursor(QtCore.Qt.PointingHandCursor) resolve_tbtn.setCursor(QtCore.Qt.PointingHandCursor) btn_pane = create_pane( [self.show_effective_request_checkbox, None, toolbar], True, compact=True, compact_spacing=0) context_pane = create_pane([btn_pane, self.context_table], False, compact=True, compact_spacing=0) self.package_tab = PackageTabWidget(self.context_model, versions_tab=True) context_splitter = ConfiguredSplitter(app.config, "layout/splitter/main") context_splitter.setOrientation(QtCore.Qt.Vertical) context_splitter.addWidget(context_pane) context_splitter.addWidget(self.package_tab) if not context_splitter.apply_saved_layout(): context_splitter.setStretchFactor(0, 2) context_splitter.setStretchFactor(1, 1) self.settings = ContextSettingsWidget(self.context_model) self.tools_list = ContextToolsWidget(self.context_model) self.resolve_details = ContextDetailsWidget(self.context_model) self.tab = QtGui.QTabWidget() icon = get_icon("context", as_qicon=True) self.tab.addTab(context_splitter, icon, "context") icon = get_icon("context_settings", as_qicon=True) self.tab.addTab(self.settings, icon, "settings") icon = get_icon("tools", as_qicon=True) self.tab.addTab(self.tools_list, icon, "tools") icon = get_icon("info", as_qicon=True) self.tab.addTab(self.resolve_details, icon, "resolve details") self.tab.setTabEnabled(2, False) self.tab.setTabEnabled(3, False) # layout layout = QtGui.QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.tab) self.setLayout(layout) # shortcuts find_shortcut = QtGui.QShortcut(QtGui.QKeySequence("Ctrl+F"), self) find_shortcut.activated.connect(self._search) # widget signals self.context_table.variantSelected.connect(self._variantSelected) self.find_tbtn.clicked.connect(self._search_variant) self.shell_tbtn.clicked.connect(self._open_shell) self.undiff_tbtn.clicked.connect(self._leave_diff_mode) self.time_lock_tbtn.clicked.connect(self._timelockClicked) self.tools_list.toolsChanged.connect(self._updateToolsCount) self.diff_menu.aboutToShow.connect(self._aboutToShowDiffMenu) self.revert_menu.aboutToShow.connect(self._aboutToShowRevertMenu) self.show_effective_request_checkbox.stateChanged.connect( self._effectiveRequestStateChanged) self.refresh() self._updateToolsCount()
def __init__(self, context_model=None, parent=None): super(ContextManagerWidget, self).__init__(parent) ContextViewMixin.__init__(self, context_model) # widgets self.popup = None self.context_table = ContextTableWidget(self.context_model) self.show_effective_request_checkbox = QtGui.QCheckBox("show effective request") resolve_time_label = ContextResolveTimeLabel(self.context_model) self.time_lock_tbtn = QtGui.QToolButton() icon = get_icon("time_lock", as_qicon=True) self.time_lock_tbtn.setIcon(icon) self.find_tbtn = QtGui.QToolButton() self.find_tbtn.setToolTip("find resolved package") icon = get_icon("find", as_qicon=True) self.find_tbtn.setIcon(icon) self.shell_tbtn = QtGui.QToolButton() self.shell_tbtn.setToolTip("open shell") icon = get_icon("terminal", as_qicon=True) self.shell_tbtn.setIcon(icon) self.diff_tbtn = QtGui.QToolButton() self.diff_tbtn.setToolTip("enter diff mode") self.diff_tbtn.setPopupMode(QtGui.QToolButton.MenuButtonPopup) self.diff_menu = QtGui.QMenu() self.diff_action = add_menu_action( self.diff_menu, "Diff Against Current", self._diff_with_last_resolve, "diff") self.diff_to_disk_action = add_menu_action( self.diff_menu, "Diff Against Disk", self._diff_with_disk, "diff_to_disk") self.diff_to_other_action = add_menu_action( self.diff_menu, "Diff Against Other...", self._diff_with_other, "diff_to_other") self.diff_tbtn.setMenu(self.diff_menu) self.diff_tbtn.setDefaultAction(self.diff_action) self.undiff_tbtn = QtGui.QToolButton() self.undiff_tbtn.setToolTip("leave diff mode") icon = get_icon("diff", as_qicon=True) self.undiff_tbtn.setIcon(icon) self.undiff_tbtn.setCheckable(True) self.lock_tbtn = QtGui.QToolButton() self.lock_tbtn.setToolTip("locking") icon = get_icon("no_lock", as_qicon=True) self.lock_tbtn.setIcon(icon) self.lock_tbtn.setPopupMode(QtGui.QToolButton.InstantPopup) menu = QtGui.QMenu() for lock_type in PatchLock: fn = partial(self._set_lock_type, lock_type) add_menu_action(menu, lock_type.description, fn, lock_type.name) menu.addSeparator() add_menu_action(menu, "Remove Explicit Locks", self._removeExplicitLocks) self.lock_tbtn.setMenu(menu) self.revert_tbtn = QtGui.QToolButton() self.revert_tbtn.setToolTip("revert") icon = get_icon("revert", as_qicon=True) self.revert_tbtn.setIcon(icon) self.revert_tbtn.setPopupMode(QtGui.QToolButton.InstantPopup) self.revert_menu = QtGui.QMenu() self.revert_action = add_menu_action( self.revert_menu, "Revert To Last Resolve...", self._revert_to_last_resolve, "revert") self.revert_diff_action = add_menu_action( self.revert_menu, "Revert To Reference...", self._revert_to_diff, "revert_to_diff") self.revert_disk_action = add_menu_action( self.revert_menu, "Revert To Disk...", self._revert_to_disk, "revert_to_disk") self.revert_tbtn.setMenu(self.revert_menu) resolve_tbtn = QtGui.QToolButton() resolve_tbtn.setPopupMode(QtGui.QToolButton.MenuButtonPopup) menu = QtGui.QMenu() default_resolve_action = add_menu_action(menu, "Resolve", self._resolve, "resolve") add_menu_action(menu, "Advanced Resolve...", partial(self._resolve, advanced=True), "advanced_resolve") resolve_tbtn.setDefaultAction(default_resolve_action) resolve_tbtn.setMenu(menu) toolbar = QtGui.QToolBar() toolbar.addWidget(resolve_time_label) self.time_lock_tbtn_action = toolbar.addWidget(self.time_lock_tbtn) toolbar.addSeparator() toolbar.addWidget(self.find_tbtn) toolbar.addWidget(self.shell_tbtn) self.diff_tbtn_action = toolbar.addWidget(self.diff_tbtn) self.undiff_tbtn_action = toolbar.addWidget(self.undiff_tbtn) toolbar.addWidget(self.lock_tbtn) toolbar.addWidget(self.revert_tbtn) toolbar.addWidget(resolve_tbtn) self.time_lock_tbtn_action.setVisible(False) self.undiff_tbtn_action.setVisible(False) self.time_lock_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.find_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.shell_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.diff_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.lock_tbtn.setCursor(QtCore.Qt.PointingHandCursor) self.revert_tbtn.setCursor(QtCore.Qt.PointingHandCursor) resolve_tbtn.setCursor(QtCore.Qt.PointingHandCursor) btn_pane = create_pane([self.show_effective_request_checkbox, None, toolbar], True, compact=True, compact_spacing=0) context_pane = create_pane([btn_pane, self.context_table], False, compact=True, compact_spacing=0) self.package_tab = PackageTabWidget( self.context_model, versions_tab=True) context_splitter = ConfiguredSplitter(app.config, "layout/splitter/main") context_splitter.setOrientation(QtCore.Qt.Vertical) context_splitter.addWidget(context_pane) context_splitter.addWidget(self.package_tab) if not context_splitter.apply_saved_layout(): context_splitter.setStretchFactor(0, 2) context_splitter.setStretchFactor(1, 1) self.settings = ContextSettingsWidget(self.context_model) self.tools_list = ContextToolsWidget(self.context_model) self.resolve_details = ContextDetailsWidget(self.context_model) self.tab = QtGui.QTabWidget() icon = get_icon("context", as_qicon=True) self.tab.addTab(context_splitter, icon, "context") icon = get_icon("context_settings", as_qicon=True) self.tab.addTab(self.settings, icon, "settings") icon = get_icon("tools", as_qicon=True) self.tab.addTab(self.tools_list, icon, "tools") icon = get_icon("info", as_qicon=True) self.tab.addTab(self.resolve_details, icon, "resolve details") self.tab.setTabEnabled(2, False) self.tab.setTabEnabled(3, False) # layout layout = QtGui.QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.tab) self.setLayout(layout) # shortcuts find_shortcut = QtGui.QShortcut(QtGui.QKeySequence("Ctrl+F"), self) find_shortcut.activated.connect(self._search) # widget signals self.context_table.variantSelected.connect(self._variantSelected) self.find_tbtn.clicked.connect(self._search_variant) self.shell_tbtn.clicked.connect(self._open_shell) self.undiff_tbtn.clicked.connect(self._leave_diff_mode) self.time_lock_tbtn.clicked.connect(self._timelockClicked) self.tools_list.toolsChanged.connect(self._updateToolsCount) self.diff_menu.aboutToShow.connect(self._aboutToShowDiffMenu) self.revert_menu.aboutToShow.connect(self._aboutToShowRevertMenu) self.show_effective_request_checkbox.stateChanged.connect( self._effectiveRequestStateChanged) self.refresh() self._updateToolsCount()