本文整理汇总了Python中PyQt5.QtWidgets.QStackedLayout类的典型用法代码示例。如果您正苦于以下问题:Python QStackedLayout类的具体用法?Python QStackedLayout怎么用?Python QStackedLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QStackedLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, **kwargs):
super(SplitManager, self).__init__(**kwargs)
self.root = self.SplitterClass(orientation=Qt.Horizontal)
layout = QStackedLayout()
self.setLayout(layout)
layout.addWidget(self.root)
self.optimizeTimer = QTimer()
self.optimizeTimer.setInterval(0)
self.optimizeTimer.setSingleShot(True)
self.optimizeTimer.timeout.connect(self._optimize)
self.addCategory('splitmanager')
示例2: __init__
def __init__(self, parent=None):
super(ProjectTreeColumn, self).__init__(parent,
Qt.WindowStaysOnTopHint)
vbox = QVBoxLayout(self)
vbox.setSizeConstraint(QVBoxLayout.SetDefaultConstraint)
vbox.setContentsMargins(0, 0, 0, 0)
self._buttons = []
self._combo_project = QComboBox()
self._combo_project.setMinimumHeight(30)
self._combo_project.setContextMenuPolicy(Qt.CustomContextMenu)
vbox.addWidget(self._combo_project)
self._projects_area = QStackedLayout()
logger.debug("This is the projects area")
logger.debug(self._projects_area)
vbox.addLayout(self._projects_area)
self.projects = []
self._combo_project.currentIndexChanged[int].connect(self._change_current_project)
self._combo_project.customContextMenuRequested['const QPoint &'].connect(self.context_menu_for_root)
connections = (
{'target': 'main_container',
'signal_name': 'addToProject',#(QString)
'slot': self._add_file_to_project},
{'target': 'main_container',
'signal_name': 'showFileInExplorer',#(QString)
'slot': self._show_file_in_explorer},
)
IDE.register_service('projects_explorer', self)
IDE.register_signals('projects_explorer', connections)
ExplorerContainer.register_tab(translations.TR_TAB_PROJECTS, self)
示例3: __init__
def __init__(self, win_id, parent=None):
super().__init__(parent)
objreg.register('statusbar', self, scope='window', window=win_id)
self.setObjectName(self.__class__.__name__)
self.setAttribute(Qt.WA_StyledBackground)
style.set_register_stylesheet(self)
self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed)
self._win_id = win_id
self._option = None
self._hbox = QHBoxLayout(self)
self.set_hbox_padding()
objreg.get('config').changed.connect(self.set_hbox_padding)
self._hbox.setSpacing(5)
self._stack = QStackedLayout()
self._hbox.addLayout(self._stack)
self._stack.setContentsMargins(0, 0, 0, 0)
self.cmd = command.Command(win_id)
self._stack.addWidget(self.cmd)
objreg.register('status-command', self.cmd, scope='window',
window=win_id)
self.txt = textwidget.Text()
self._stack.addWidget(self.txt)
self.prompt = prompt.Prompt(win_id)
self._stack.addWidget(self.prompt)
self.cmd.show_cmd.connect(self._show_cmd_widget)
self.cmd.hide_cmd.connect(self._hide_cmd_widget)
self._hide_cmd_widget()
prompter = objreg.get('prompter', scope='window', window=self._win_id)
prompter.show_prompt.connect(self._show_prompt_widget)
prompter.hide_prompt.connect(self._hide_prompt_widget)
self._hide_prompt_widget()
self.keystring = keystring.KeyString()
self._hbox.addWidget(self.keystring)
self.url = url.UrlText()
self._hbox.addWidget(self.url)
self.percentage = percentage.Percentage()
self._hbox.addWidget(self.percentage)
self.tabindex = tabindex.TabIndex()
self._hbox.addWidget(self.tabindex)
# We add a parent to Progress here because it calls self.show() based
# on some signals, and if that happens before it's added to the layout,
# it will quickly blink up as independent window.
self.prog = progress.Progress(self)
self._hbox.addWidget(self.prog)
objreg.get('config').changed.connect(self.maybe_hide)
QTimer.singleShot(0, self.maybe_hide)
示例4: __init__
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.actionAuswahl = QComboBox()
self.actionAuswahl.addItem("Einen Sportler bearbeiten")
self.actionAuswahl.addItem("Liste aller Sportler anzeigen")
self.actionAuswahl.addItem("Eine Ergebnissliste bearbeiten")
self.actionAuswahl.addItem("Ergebnisse & Urkunden drucken")
self.actionAuswahl.addItem("Ergebnissvorlagen drucken")
self.actionAuswahl.setEditable(False)
self.actionAuswahl.activated.connect(self.setAction)
self.actionSportlerEdit = SportlerEdit()
self.actionSportlerShow = SportlerShow()
self.actionErgebnissListe = ErgebnissListe()
self.actionErgebnisseDrucken = ErgebnisseDrucken()
self.actionErgebnissVorlage = ErgebnissVorlage()
self.actionLayout = QStackedLayout()
self.actionLayout.addWidget(self.actionSportlerEdit)
self.actionLayout.addWidget(self.actionSportlerShow)
self.actionLayout.addWidget(self.actionErgebnissListe)
self.actionLayout.addWidget(self.actionErgebnisseDrucken)
self.actionLayout.addWidget(self.actionErgebnissVorlage)
self.mainLayout = QVBoxLayout()
self.mainLayout.addWidget(self.actionAuswahl)
self.mainLayout.addStretch(0)
self.mainLayout.addLayout(self.actionLayout)
self.mainLayout.addStretch(0)
self.setLayout(self.mainLayout)
self.show()
示例5: __init__
def __init__(self, original=False):
super(ComboEditor, self).__init__(None, Qt.WindowStaysOnTopHint)
self.__original = original
self.__undocked = []
self._symbols_index = []
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.bar = ActionBar(main_combo=original)
vbox.addWidget(self.bar)
self.stacked = QStackedLayout()
vbox.addLayout(self.stacked)
self._main_container = IDE.get_service('main_container')
if not self.__original:
self._main_container.fileOpened.connect(self._file_opened_by_main)
self.bar.combo.showComboSelector.connect(self._main_container.change_tab)
self.bar.changeCurrent.connect(self._set_current)
self.bar.editorSplited.connect(self.split_editor)
self.bar.runFile[str].connect(self._run_file)
self.bar.closeFile.connect(lambda: self.closeSplit.emit(self))
self.bar.addToProject[str].connect(self._add_to_project)
self.bar.showFileInExplorer.connect(self._show_file_in_explorer)
self.bar.goToSymbol.connect(self._go_to_symbol)
self.bar.undockEditor.connect(self.undock_editor)
self.bar.reopenTab[str].connect(self._main_container.open_file)
self.bar.recentTabsModified.connect(self._main_container.recent_files_changed)
self.bar.code_navigator.btnPrevious.clicked['bool'].connect(lambda: self._navigate_code(self.NAVIGATE.prev))
self.bar.code_navigator.btnNext.clicked['bool'].connect(lambda: self._navigate_code(self.NAVIGATE.prev))
示例6: initUI
def initUI(self):
main_layout = QVBoxLayout(self)
sub_layout = QHBoxLayout()
# Left Panel
left_panel = QListWidget()
left_panel.setViewMode(left_panel.ListMode)
#left_panel.setIconSize(QSize(40,40))
left_panel.setTextElideMode(Qt.ElideRight)
left_panel.setMaximumWidth(200)
left_panel.itemClicked.connect(self.change)
#web.setText('Web')
self.application = QListWidgetItem()
self.application.setText('Application')
self.web = QListWidgetItem()
self.web.setText('Web')
self.visual = QListWidgetItem()
self.visual.setText('Visual')
self.advanced = QListWidgetItem()
self.advanced.setText('Advanced')
self.about = QListWidgetItem()
self.about.setText('About')
#main.setIcon(QIcon(os.path.join(app_constants.static_dir, 'plus2.png')))
left_panel.addItem(self.application)
left_panel.addItem(self.web)
left_panel.addItem(self.visual)
left_panel.addItem(self.advanced)
left_panel.addItem(self.about)
left_panel.setMaximumWidth(100)
# right panel
self.right_panel = QStackedLayout()
self.init_right_panel()
# bottom
bottom_layout = QHBoxLayout()
ok_btn = QPushButton('Ok')
ok_btn.clicked.connect(self.accept)
cancel_btn = QPushButton('Cancel')
cancel_btn.clicked.connect(self.close)
info_lbl = QLabel()
info_lbl.setText('<a href="https://github.com/Pewpews/happypanda">'+
'Visit GitHub Repo</a> | Options marked with * requires application restart.')
info_lbl.setTextFormat(Qt.RichText)
info_lbl.setTextInteractionFlags(Qt.TextBrowserInteraction)
info_lbl.setOpenExternalLinks(True)
self.spacer = QWidget()
self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
bottom_layout.addWidget(info_lbl, 0, Qt.AlignLeft)
bottom_layout.addWidget(self.spacer)
bottom_layout.addWidget(ok_btn, 0, Qt.AlignRight)
bottom_layout.addWidget(cancel_btn, 0, Qt.AlignRight)
sub_layout.addWidget(left_panel)
sub_layout.addLayout(self.right_panel)
main_layout.addLayout(sub_layout)
main_layout.addLayout(bottom_layout)
self.restore_options()
示例7: __init__
def __init__(self, main_window, items):
"""
Widget contains items with inputs.
"""
super().__init__(main_window)
stacked_layout = QStackedLayout()
main_window.communication.item_selected.connect(stacked_layout.setCurrentIndex)
self.setLayout(stacked_layout)
self.showEvent = self._get_show_event(main_window)
for item in items:
frame = AttributesFrame(main_window=main_window, item=item)
stacked_layout.addWidget(frame)
示例8: __init__
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName(self.__class__.__name__)
self.setAttribute(Qt.WA_StyledBackground)
style.set_register_stylesheet(self)
self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed)
self._option = None
self._last_text_time = None
self._hbox = QHBoxLayout(self)
self._hbox.setContentsMargins(0, 0, 0, 0)
self._hbox.setSpacing(5)
self._stack = QStackedLayout()
self._hbox.addLayout(self._stack)
self._stack.setContentsMargins(0, 0, 0, 0)
self._cmd = command.Command()
objreg.register('status-command', self._cmd)
self._stack.addWidget(self._cmd)
self.txt = textwidget.Text()
self._stack.addWidget(self.txt)
self._timer_was_active = False
self._text_queue = collections.deque()
self._text_pop_timer = usertypes.Timer(self, 'statusbar_text_pop')
self._text_pop_timer.timeout.connect(self._pop_text)
self.set_pop_timer_interval()
config.on_change(self.set_pop_timer_interval, 'ui', 'message-timeout')
self.prompt = prompt.Prompt()
self._stack.addWidget(self.prompt)
self._previous_widget = PreviousWidget.none
self._cmd.show_cmd.connect(self._show_cmd_widget)
self._cmd.hide_cmd.connect(self._hide_cmd_widget)
self._hide_cmd_widget()
prompter = objreg.get('prompter')
prompter.show_prompt.connect(self._show_prompt_widget)
prompter.hide_prompt.connect(self._hide_prompt_widget)
self._hide_prompt_widget()
self.keystring = keystring.KeyString()
self._hbox.addWidget(self.keystring)
self.url = url.UrlText()
self._hbox.addWidget(self.url)
self.percentage = percentage.Percentage()
self._hbox.addWidget(self.percentage)
# We add a parent to Progress here because it calls self.show() based
# on some signals, and if that happens before it's added to the layout,
# it will quickly blink up as independent window.
self.prog = progress.Progress(self)
self._hbox.addWidget(self.prog)
示例9: __init__
def __init__(self, parent=None):
super().__init__(parent)
self.setAcceptDrops(True)
self._vbox = QVBoxLayout(self)
self._vbox.setContentsMargins(0, 0, 0, 0)
self._vbox.setSpacing(0)
self.stack = QStackedLayout()
self.stack.setStackingMode(QStackedLayout.StackAll)
self._vbox.addLayout(self.stack)
self.splitter = dynamic_splitter.DynamicSplitter()
self._files_handler = files_handler.FilesHandler(self)
# Code Navigation
self.__code_back = []
self.__code_forward = []
self.__operations = {
0: self._navigate_code_jumps,
1: self._navigate_bookmarks
}
# Recent files list
self.__last_opened_files = []
# QML UI
self._add_file_folder = add_file_folder.AddFileFolderWidget(self)
if settings.SHOW_START_PAGE:
self.show_start_page()
IDE.register_service("main_container", self)
# Register signals connections
connections = (
# {
# "target": "main_container",
# "signal_name": "updateLocator",
# "slot": self._explore_code
# },
{
"target": "filesystem",
"signal_name": "projectOpened",
"slot": self._explore_code
},
# {
# "target": "projects_explore",
# "signal_name": "updateLocator",
# "slot": self._explore_code
# }
{
"target": "filesystem",
"signal_name": "projectClosed",
"slot": self._explore_code
}
)
IDE.register_signals("main_container", connections)
fhandler_short = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Tab), self)
fhandler_short.activated.connect(self.show_files_handler)
示例10: __init__
def __init__(self, parent=None):
super(ProjectTreeColumn, self).__init__(parent)
vbox = QVBoxLayout(self)
vbox.setSizeConstraint(QVBoxLayout.SetDefaultConstraint)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self._buttons = []
frame = QFrame()
frame.setObjectName("actionbar")
box = QVBoxLayout(frame)
box.setContentsMargins(1, 1, 1, 1)
box.setSpacing(0)
self._combo_project = QComboBox()
self._combo_project.setSizePolicy(
QSizePolicy.Expanding, QSizePolicy.Fixed)
self._combo_project.setSizeAdjustPolicy(
QComboBox.AdjustToMinimumContentsLengthWithIcon)
self._combo_project.setObjectName("combo_projects")
box.addWidget(self._combo_project)
vbox.addWidget(frame)
self._combo_project.setContextMenuPolicy(Qt.CustomContextMenu)
self._projects_area = QStackedLayout()
logger.debug("This is the projects area")
vbox.addLayout(self._projects_area)
# Empty widget
self._empty_proj = QLabel(translations.TR_NO_PROJECTS)
self._empty_proj.setAlignment(Qt.AlignCenter)
self._empty_proj.setAutoFillBackground(True)
self._empty_proj.setBackgroundRole(QPalette.Base)
self._projects_area.addWidget(self._empty_proj)
self._projects_area.setCurrentWidget(self._empty_proj)
self.projects = []
self._combo_project.activated.connect(
self._change_current_project)
self._combo_project.customContextMenuRequested[
'const QPoint&'].connect(self.context_menu_for_root)
connections = (
{
"target": "main_container",
"signal_name": "addToProject",
"slot": self._add_file_to_project
},
{
"target": "main_container",
"signal_name": "showFileInExplorer",
"slot": self._show_file_in_explorer
},
)
IDE.register_service('projects_explorer', self)
IDE.register_signals('projects_explorer', connections)
ExplorerContainer.register_tab(translations.TR_TAB_PROJECTS, self)
示例11: __init__
def __init__(self, main_window, items):
super().__init__()
self.items = items
self.visible_items = []
self.layout = QStackedLayout()
self.menu_layout = QVBoxLayout()
self.templates_layout = QStackedLayout()
self.showEvent = self._get_show_event(main_window)
self.menu_wrapper = QVBoxLayout()
try:
self.ACTION_BTN_ICON
except AttributeError:
self.ACTION_BTN_ICON = ""
self.setLayout(self.layout)
self.layout.addWidget(self._get_static_widgets())
示例12: initUI
def initUI(self):
self.center = QWidget()
self.display = QStackedLayout()
self.center.setLayout(self.display)
# init the manga view variables
self.manga_display()
log_d("Create manga display: OK")
# init the chapter view variables
# self.chapter_display()
self.m_l_view_index = self.display.addWidget(self.manga_list_main)
self.m_t_view_index = self.display.addWidget(self.manga_table_view)
# init toolbar
self.init_toolbar()
log_d("Create toolbar: OK")
# init status bar
self.init_stat_bar()
log_d("Create statusbar: OK")
self.system_tray = misc.SystemTray(QIcon(gui_constants.APP_ICO_PATH), self)
gui_constants.SYSTEM_TRAY = self.system_tray
tray_menu = QMenu(self)
self.system_tray.setContextMenu(tray_menu)
self.system_tray.setToolTip("Happypanda {}".format(gui_constants.vs))
tray_quit = QAction("Quit", tray_menu)
tray_menu.addAction(tray_quit)
tray_quit.triggered.connect(self.close)
self.system_tray.show()
log_d("Create system tray: OK")
# self.display.addWidget(self.chapter_main)
self.setCentralWidget(self.center)
self.setWindowTitle("Happypanda")
self.setWindowIcon(QIcon(gui_constants.APP_ICO_PATH))
props = settings.win_read(self, "AppWindow")
if props.resize:
x, y = props.resize
self.resize(x, y)
else:
self.resize(gui_constants.MAIN_W, gui_constants.MAIN_H)
posx, posy = props.pos
self.move(posx, posy)
self.show()
log_d("Show window: OK")
self.notification_bar = misc.NotificationOverlay(self)
p = self.toolbar.pos()
self.notification_bar.move(p.x(), p.y() + self.toolbar.height())
self.notification_bar.resize(self.width())
gui_constants.NOTIF_BAR = self.notification_bar
log_d("Create notificationbar: OK")
log_d("Window Create: OK")
示例13: __init__
def __init__(self, main_window, items):
super().__init__()
self.items = items
self.layout = QStackedLayout()
self._switch_user = self._get_switch_user_func(main_window)
self.setLayout(self.layout)
self._hide_action_button = lambda: main_window.communication.action_button_toggle.emit(False, '', None)
self._create_layout(main_window)
示例14: __init__
def __init__(self, parent=None):
super().__init__(parent)
layout = QVBoxLayout()
self.setLayout(layout)
self.center = QStackedLayout()
self.camview = widgets.CamView((640, 480), self, draw_logo=True)
self.label_up = QLabel()
self.label_down = QLabel()
self.center.addWidget(self.camview)
layout.addLayout(self.center)
layout.addWidget(self.label_up)
layout.addWidget(self.label_down)
self.adjustSize()
self.setFixedSize(self.sizeHint())
示例15: __init__
def __init__(self, parent=None):
super().__init__(parent, Qt.Dialog)
self.setWindowTitle(translations.TR_PREFERENCES_TITLE)
self.setMinimumSize(900, 650)
box = QVBoxLayout(self)
box.setContentsMargins(3, 3, 3, 3)
self.setAutoFillBackground(True)
# Header
self._header_label = QLabel("")
header_font = self._header_label.font()
header_font.setBold(True)
header_font.setPointSize(header_font.pointSize() + 4)
self._header_label.setFont(header_font)
hbox = QHBoxLayout()
hbox.setContentsMargins(0, 0, 0, 0)
self.tree = QTreeWidget()
self.tree.header().setHidden(True)
self.tree.setSelectionMode(QTreeWidget.SingleSelection)
self.tree.setAnimated(True)
self.tree.header().setSectionResizeMode(
0, QHeaderView.ResizeToContents)
self.tree.setFixedWidth(200)
hbox.addWidget(self.tree)
self.stacked = QStackedLayout()
header_layout = QVBoxLayout()
header_layout.setContentsMargins(0, 0, 0, 0)
header_layout.addWidget(self._header_label)
header_layout.addLayout(self.stacked)
hbox.addLayout(header_layout)
box.addLayout(hbox)
# Footer buttons
button_box = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
box.addWidget(button_box)
# Connections
button_box.rejected.connect(self.close)
button_box.accepted.connect(self._save_preferences)
self.tree.selectionModel().currentRowChanged.connect(
self._change_current)
self.load_ui()