本文整理汇总了Python中rezgui.mixins.ContextViewMixin.ContextViewMixin类的典型用法代码示例。如果您正苦于以下问题:Python ContextViewMixin类的具体用法?Python ContextViewMixin怎么用?Python ContextViewMixin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContextViewMixin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, context_model=None, parent=None):
"""Create a context table."""
super(ContextTableWidget, self).__init__(self.default_row_count,
2, parent)
ContextViewMixin.__init__(self, context_model)
self.diff_mode = False
self.diff_context_model = None
self.diff_from_source = False
self._show_effective_request = False
self._current_variant = None
self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
hh = self.horizontalHeader()
hh.setDefaultSectionSize(12 * self.fontMetrics().height())
vh = self.verticalHeader()
vh.setResizeMode(QtGui.QHeaderView.ResizeToContents)
vh.setVisible(False)
self.delegate = CellDelegate(self)
self.setItemDelegate(self.delegate)
self.setShowGrid(False)
self.currentCellChanged.connect(self._currentCellChanged)
self.itemSelectionChanged.connect(self._itemSelectionChanged)
self.refresh()
示例2: __init__
def __init__(self, context_model=None, parent=None, lock_package=False,
package_selectable_callback=None):
super(BrowsePackageWidget, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.edit = PackageLineEdit(context_model, family_only=True)
if lock_package:
self.edit.hide()
self.versions_table = PackageVersionsTable(context_model,
callback=package_selectable_callback)
self.package_tab = PackageTabWidget(versions_tab=False)
splitter = ConfiguredSplitter(app.config, "layout/splitter/browse_package")
splitter.setOrientation(QtCore.Qt.Vertical)
splitter.addWidget(self.versions_table)
splitter.addWidget(self.package_tab)
if not splitter.apply_saved_layout():
splitter.setStretchFactor(0, 2)
splitter.setStretchFactor(1, 1)
layout = QtGui.QVBoxLayout()
layout.addWidget(self.edit)
layout.addWidget(splitter)
self.setLayout(layout)
self.edit.focusOutViaKeyPress.connect(self._set_package_name)
self.versions_table.itemSelectionChanged.connect(self._set_package)
示例3: __init__
def __init__(self, context_model=None, parent=None, family_only=False,
read_only=False):
super(PackageLineEdit, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.read_only = read_only
self.family_only = family_only
self.default_style = None
pal = self.palette()
self.normal_font = self.font()
self.placeholder_font = self.font()
self.placeholder_font.setItalic(True)
self.normal_text_color = pal.color(QtGui.QPalette.Text)
self.placeholder_text_color = pal.color(QtGui.QPalette.Disabled,
QtGui.QPalette.Text)
if not self.read_only:
self.setPlaceholderText("enter package")
self._update_font()
self.completer = QtGui.QCompleter(self)
self.completer.setCompletionMode(QtGui.QCompleter.PopupCompletion)
self.completions = QtGui.QStringListModel(self.completer)
self.completer.setModel(self.completions)
self.setCompleter(self.completer)
self.textEdited.connect(self._textEdited)
self.textChanged.connect(self._textChanged)
示例4: __init__
def __init__(self, context_model, variant, reference_variant=None,
hide_locks=False, read_only=False, parent=None):
super(VariantCellWidget, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.variant = variant
self.reference_variant = reference_variant
self.stale = False
self.lock_status = None
self.lock_icon = None
self.hide_locks = hide_locks
self.read_only = read_only
self.icons = [] # 3-tuples: widget, name, tooltip
qname = self.variant.qualified_package_name
self.label = QtGui.QLabel(qname)
desc = "%[email protected]%s" % (qname, self.variant.wrapped.location)
self.label.setToolTip(desc)
self.depends_icon = get_icon_widget("depends", "dependent package")
self.depends_icon.hide()
create_pane([self.label, self.depends_icon, None],
True, compact=True, parent_widget=self)
self.refresh()
示例5: __init__
def __init__(self, context_model=None, parent=None):
super(ContextResolveTimeLabel, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.timer = QtCore.QTimer(self)
self.timer.setInterval(60 * 1000)
self.timer.timeout.connect(self.refresh)
self.refresh()
示例6: __init__
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)
示例7: __init__
def __init__(self, context=None, parent=None):
super(ContextSubWindow, self).__init__(parent)
context_model = ContextModel(context)
ContextViewMixin.__init__(self, context_model)
config_key = "layout/window/context_manager"
StoreSizeMixin.__init__(self, app.config, config_key)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
widget = ContextManagerWidget(context_model)
widget.diffModeChanged.connect(self._diffModeChanged)
self.setWidget(widget)
self._update_window_title()
示例8: __init__
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")
示例9: __init__
def __init__(self, context_model=None, parent=None):
super(VariantDetailsWidget, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.variant = None
self.edit = StreamableTextEdit()
self.edit.setStyleSheet("font: 9pt 'Courier'")
self.view_graph_btn = ViewGraphButton(context_model)
self._update_graph_btn_visibility()
btn_pane = create_pane([None, self.view_graph_btn], True, compact=True)
create_pane([self.edit, btn_pane], False, compact=True, parent_widget=self)
self.clear()
示例10: __init__
def __init__(self, context_model=None, reference_variant=None,
in_window=False, parent=None):
"""
Args:
reference_variant (`Variant`): Used to show the difference between
two variants.
in_window (bool): If True, the 'view changelogs' option turns
into a checkbox, dropping the 'View in window' option.
"""
super(VariantVersionsWidget, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.in_window = in_window
self.variant = None
self.reference_variant = reference_variant
self.pending_changelog_packages = None
self.label = QtGui.QLabel()
self.changelog_edit = ChangelogEdit()
self.table = VariantVersionsTable(self.context_model,
reference_variant=reference_variant)
self.tab = QtGui.QTabWidget()
self.tab.addTab(self.table, "list view")
self.tab.addTab(self.changelog_edit, "changelogs")
self.tab.currentChanged.connect(self._tabIndexChanged)
buttons = [None]
if self.in_window:
close_btn = QtGui.QPushButton("Close")
buttons.append(close_btn)
close_btn.clicked.connect(self._close_window)
else:
browse_versions_btn = QtGui.QPushButton("Browse Versions...")
browse_versions_btn.clicked.connect(self._browseVersions)
buttons.append(browse_versions_btn)
window_btn = QtGui.QPushButton("View In Window...")
window_btn.clicked.connect(self._view_changelogs_window)
buttons.append(window_btn)
btn_pane = create_pane(buttons, True, compact=not self.in_window)
pane = create_pane([self.label, self.tab, btn_pane], False, compact=True)
self.set_main_widget(pane)
self.set_loader_swap_delay(300)
self.clear()
示例11: __init__
def __init__(self, context_model=None, parent=None):
super(ViewGraphButton, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
# If not None, prunes the graph to this package
self.package_name = None
menu = QtGui.QMenu()
self.action_1 = add_menu_action(menu, "View Resolve Graph...", self._view_resolve_graph, "graph")
self.action_2 = add_menu_action(menu, "View Dependency Graph...", self._view_dependency_graph)
self.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.setDefaultAction(self.action_1)
self.setMenu(menu)
self.refresh()
示例12: __init__
def __init__(self, context_model=None, parent=None):
super(VariantToolsList, self).__init__(0, 1, parent)
ContextViewMixin.__init__(self, context_model)
self.variant = None
self.tool_widgets = {}
self.setGridStyle(QtCore.Qt.DotLine)
self.setFocusPolicy(QtCore.Qt.NoFocus)
self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
hh = self.horizontalHeader()
hh.setStretchLastSection(True)
hh.setVisible(False)
vh = self.verticalHeader()
vh.setVisible(False)
示例13: __init__
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()
示例14: __init__
def __init__(self, context_model=None, read_only=False, parent=None):
super(PackageSelectWidget, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.edit = PackageLineEdit(self.context_model, read_only=read_only, parent=self)
self.edit.setStyleSheet("QLineEdit { border : 0px;}")
self.btn = IconButton("package", "browse packages")
self.btn.hide()
create_pane([(self.edit, 1), self.btn, 2], True, compact=True, compact_spacing=0, parent_widget=self)
if read_only:
self.edit.setReadOnly(True)
update_font(self.edit, italic=True)
else:
self.edit.focusIn.connect(self._focusIn)
self.edit.focusOut.connect(self._focusOut)
self.edit.focusOutViaKeyPress.connect(self._focusOutViaKeyPress)
self.edit.textChanged.connect(self._textChanged)
self.btn.clicked.connect(self._browse_package)
示例15: __init__
def __init__(self, context_model=None, parent=None):
super(VariantHelpWidget, self).__init__(parent)
ContextViewMixin.__init__(self, context_model)
self.variant = None
self.help_1 = None
self.help_2 = None
self.table_1 = self._create_table()
self.table_2 = self._create_table()
self.tab = QtGui.QTabWidget()
self.tab.addTab(self.table_1, "latest help")
self.tab.addTab(self.table_2, "help")
self.no_help_label = QtGui.QLabel("No help found.")
self.no_help_label.setAlignment(QtCore.Qt.AlignCenter)
pane = create_pane([self.no_help_label, self.tab], False, compact=True)
self.set_main_widget(pane)
self.set_loader_swap_delay(300)
self.clear()