当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QStackedLayout类代码示例

本文整理汇总了Python中PyQt4.QtGui.QStackedLayout的典型用法代码示例。如果您正苦于以下问题:Python QStackedLayout类的具体用法?Python QStackedLayout怎么用?Python QStackedLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QStackedLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setGeometry

 def setGeometry(self, rect):
     QStackedLayout.setGeometry(self, rect)
     for i in range(self.count()):
         w = self.widget(i)
         hint = w.sizeHint()
         geom = QRect(rect)
         size = clipMinMax(rect.size(), w.minimumSize(), w.maximumSize())
         size = fixSizePolicy(size, hint, w.sizePolicy())
         geom.setSize(size)
         if geom != w.geometry():
             w.setGeometry(geom)
开发者ID:AutumnLight,项目名称:orange,代码行数:11,代码来源:stackedwidget.py

示例2: __init__

    def __init__(self, original=False):
        super(ComboEditor, self).__init__()
        self.__original = original
        self._symbols_index = []
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)

        self.bar = ActionBar()
        vbox.addWidget(self.bar)

        self.stacked = QStackedLayout()
        vbox.addLayout(self.stacked)

        self._main_container = IDE.get_service('main_container')

        self.connect(self.bar, SIGNAL("changeCurrent(PyQt_PyObject)"),
            self.set_current)
        self.connect(self.bar, SIGNAL("runFile(QString)"),
            self._run_file)
        self.connect(self.bar, SIGNAL("addToProject(QString)"),
            self._add_to_project)
        self.connect(self.bar, SIGNAL("goToSymbol(int)"),
            self._go_to_symbol)
        self.connect(self.bar, SIGNAL("reopenTab(QString)"),
            lambda path: self._main_container.open_file(path))
        self.connect(self.bar, SIGNAL("recentTabsModified()"),
            lambda: self._main_container.recent_files_changed())
        self.connect(self.bar.code_navigator.btnPrevious, SIGNAL("clicked()"),
            lambda: self._navigate_code(False))
        self.connect(self.bar.code_navigator.btnNext, SIGNAL("clicked()"),
            lambda: self._navigate_code(True))
开发者ID:Zekom,项目名称:ninja-ide,代码行数:32,代码来源:combo_editor.py

示例3: __init__

    def __init__(self, parent=None):
        super(_MainContainer, self).__init__(parent)
        self._parent = parent
        self.stack = QStackedLayout(self)
        self.stack.setStackingMode(QStackedLayout.StackAll)

        self.splitter = dynamic_splitter.DynamicSplitter()
        self.setAcceptDrops(True)
        self.tabs_handler = tabs_handler.TabsHandler(self)

        #documentation browser
        self.docPage = None
        #Code Navigation
        self._locator = locator.GoToDefinition()
        self.__codeBack = []
        self.__codeForward = []
        self.__bookmarksFile = ''
        self.__bookmarksPos = -1
        self.__breakpointsFile = ''
        self.__breakpointsPos = -1
        self.__operations = {
            0: self._navigate_code_jumps,
            1: self._navigate_bookmarks,
            2: self._navigate_breakpoints}

        self.connect(self, SIGNAL("locateFunction(QString, QString, bool)"),
            self.locate_function)

        IDE.register_service('main_container', self)

        #Register signals connections
        connections = (
            {'target': 'menu_file',
            'signal_name': 'openFile(QString)',
            'slot': self.open_file},
            {'target': 'explorer_container',
            'signal_name': 'goToDefinition(int)',
            'slot': self.editor_go_to_line},
            {'target': 'explorer_container',
            'signal_name': 'pep8Activated(bool)',
            'slot': self.reset_pep8_warnings},
            {'target': 'explorer_container',
            'signal_name': 'lintActivated(bool)',
            'slot': self.reset_lint_warnings},
            )

        IDE.register_signals('main_container', connections)

        self.selector = main_selector.MainSelector(self)
        self.add_widget(self.selector)

        if settings.SHOW_START_PAGE:
            self.show_start_page()

        self.connect(self.selector, SIGNAL("changeCurrent(int)"),
            self._change_current_stack)
        self.connect(self.selector, SIGNAL("ready()"),
            self._selector_ready)
开发者ID:nelsam,项目名称:ninja-ide,代码行数:58,代码来源:main_container.py

示例4: ComboTabs

class ComboTabs(QWidget):

    def __init__(self):
        super(ComboTabs, self).__init__()
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)

        self.bar = ActionBar()
        vbox.addWidget(self.bar)

        self.stacked = QStackedLayout()
        self.editable = neditable.NEditable('')
        self.editor_widget = editor.create_editor(self.editable)
        self.stacked.addWidget(self.editor_widget)
        vbox.addLayout(self.stacked)

    def currentWidget(self):
        return self.editor_widget
开发者ID:jsargiot,项目名称:ninja-ide,代码行数:18,代码来源:combo_tabs.py

示例5: sizeHint

 def sizeHint(self):
     current = self.currentWidget()
     if current:
         hint = current.sizeHint()
         # Clip the hint with min/max sizes.
         hint = clipMinMax(hint, current.minimumSize(),
                           current.maximumSize())
         return hint
     else:
         return QStackedLayout.sizeHint(self)
开发者ID:AutumnLight,项目名称:orange,代码行数:10,代码来源:stackedwidget.py

示例6: ComboEditor

class ComboEditor(QWidget):

    def __init__(self, original=False):
        super(ComboEditor, self).__init__()
        self.__original = original
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)

        self.bar = ActionBar()
        self.connect(self.bar, SIGNAL("changeCurrent(PyQt_PyObject)"),
            self.set_current)
        vbox.addWidget(self.bar)

        self.stacked = QStackedLayout()
        vbox.addLayout(self.stacked)

    def currentWidget(self):
        return self.stacked.currentWidget()

    def add_editor(self, neditable):
        """Add Editor Widget to the UI area."""
        if neditable.editor:
            self.stacked.addWidget(neditable.editor)
            self.bar.add_item(neditable.display_name, neditable)

            # Editor Signals
            self.connect(neditable.editor, SIGNAL("cursorPositionChanged()"),
                self._update_cursor_position)

            # Connect file system signals only in the original
            if self.__original:
                pass

    def set_current(self, neditable):
        self.stacked.setCurrentWidget(neditable.editor)
        self._update_cursor_position(ignore_sender=True)
        neditable.editor.setFocus()

    def widget(self, index):
        return self.stacked.widget(index)

    def count(self):
        """Return the number of editors opened."""
        return self.stacked.count()

    def _update_cursor_position(self, ignore_sender=False):
        obj = self.sender()
        editor = self.stacked.currentWidget()
        # Check if it's current to avoid signals from other splits.
        if ignore_sender or editor == obj:
            line = editor.textCursor().blockNumber() + 1
            col = editor.textCursor().columnNumber()
            self.bar.update_line_col(line, col)
开发者ID:pdorrell,项目名称:ninja-ide,代码行数:53,代码来源:combo_editor.py

示例7: __init__

    def __init__(self):
        QMainWindow.__init__(self)
        layout = QGridLayout(self)
        layout.setMargin(2)
        btnFiles = QPushButton(u'Файлы', self)
        btnVideo = QPushButton(u'Видео', self)
        btnPlay = QPushButton(u'Play/Pause', self)
        btnStop = QPushButton(u'Stop', self)
        btnMute = QPushButton(u'Mute', self)
        btnMute.setCheckable(True)
        btnMainMenu = QPushButton(u'Main', self)
        self.sldVolume = QSlider(Qt.Vertical, self)
        self.sldPosition = QSlider(Qt.Horizontal, self)
        self.layMain = QStackedLayout()
        
        btnFiles.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        btnVideo.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        btnPlay.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        btnStop.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        btnMute.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        btnMainMenu.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.sldVolume.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
        self.sldPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        layout.addWidget(btnFiles, 0, 0)
        layout.addWidget(btnVideo, 0, 1)
        layout.addWidget(btnPlay, 0, 3)
        layout.addWidget(btnStop, 0, 4)
        layout.addWidget(btnMute, 0, 5)
        layout.addWidget(btnMainMenu, 2, 5)
        layout.addWidget(self.sldVolume, 1, 5)
        layout.addWidget(self.sldPosition, 2, 0, 1, 5)
        layout.addLayout(self.layMain, 1, 0, 1, 5)
        
        fileBrowser = CFileBrowser(self)
        self.videoWidget = QWidget(self)
        self.exitMenu = CExitMenu(self)
        self.mplayer = MPlayerControl(self, self.videoWidget)
        
        fileBrowser.chosen.connect(self.startPlay)
        btnFiles.clicked.connect(lambda: self.selectMode(0))
        btnVideo.clicked.connect(lambda: self.selectMode(1))
        btnMainMenu.clicked.connect(lambda: self.selectMode(2))
        self.sldPosition.valueChanged.connect(self.mplayer.seek)
        self.sldVolume.valueChanged.connect(self.mplayer.setvol)
        btnMute.clicked.connect(lambda: self.mplayer.mute(btnMute.isChecked()))
        btnPlay.clicked.connect(self.mplayer.play)
        btnStop.clicked.connect(self.mplayer.stop)
        self.sldVolume.setValue(QtGui.qApp.settings['volume'])
        self.mplayer.percent_position.connect(self.on_mplayer_position)
        
        self.layMain.addWidget(fileBrowser)
        self.layMain.addWidget(self.videoWidget)
        self.layMain.addWidget(self.exitMenu)
开发者ID:Viruzzz-kun,项目名称:v-media-center,代码行数:54,代码来源:vmc.py

示例8: __init__

 def __init__(self, config, network, storage, app):
     QDialog.__init__(self)
     self.app = app
     self.config = config
     self.network = network
     self.storage = storage
     self.setMinimumSize(575, 400)
     self.setMaximumSize(575, 400)
     self.setWindowTitle('Electrum-VCN' + '  -  ' + _('Install Wizard'))
     self.connect(self, QtCore.SIGNAL('accept'), self.accept)
     self.stack = QStackedLayout()
     self.setLayout(self.stack)
开发者ID:gjhiggins,项目名称:electrum,代码行数:12,代码来源:installwizard.py

示例9: setupUi

    def setupUi(self, option):
        option.setWindowTitle(QApplication.translate("option", "Option"))
        main_layout = QGridLayout(option)
        main_layout.setSpacing(5)
        main_layout.setContentsMargins(10, 10, 10, 10)
        main_layout.setColumnStretch(1, 1)

        self.list_option = self.createListOption()
        main_layout.addWidget(self.list_option, 0, 0)

        self.page_container = QStackedLayout()
        self.page_container.setContentsMargins(0, 0, 0, 0)
        main_layout.addLayout(self.page_container, 0, 1)
        self.populatePages()

        main_layout.addWidget(self.createLine(), 1, 0, 1, 2)
        close_layout = QHBoxLayout()
        close_layout.setContentsMargins(0, 0, 5, 0)
        close_layout.setSpacing(5)

        close_option = QPushButton()
        close_option.setText(QApplication.translate("option", "Close"))
        option.connect(close_option, QtCore.SIGNAL("clicked()"), option.accept)
        close_layout.addWidget(close_option)
        main_layout.addLayout(close_layout, 2, 1, 1, 2, Qt.AlignRight)

        self.list_option.setCurrentRow(0)
        self.page_container.setCurrentIndex(0)

        option.setTabOrder(self.list_option, self.list_conn)
        option.setTabOrder(self.list_conn, self.name_conn)
        option.setTabOrder(self.name_conn, self.host_conn)
        option.setTabOrder(self.host_conn, self.port_conn)
        option.setTabOrder(self.port_conn, self.save_conn)
        option.setTabOrder(self.save_conn, self.delete_conn)
        option.setTabOrder(self.delete_conn, self.list_conn_account)
        option.setTabOrder(self.list_conn_account, self.list_account)
        option.setTabOrder(self.list_account, self.delete_account)
        option.setTabOrder(self.delete_account, self.list_conn_alias)
        option.setTabOrder(self.list_conn_alias, self.list_alias)
        option.setTabOrder(self.list_alias, self.label_alias)
        option.setTabOrder(self.label_alias, self.body_alias)
        option.setTabOrder(self.body_alias, self.save_alias)
        option.setTabOrder(self.save_alias, self.delete_alias)
        option.setTabOrder(self.delete_alias, self.list_conn_macro)
        option.setTabOrder(self.list_conn_macro, self.list_macro)
        option.setTabOrder(self.list_macro, self.register_macro)
        option.setTabOrder(self.register_macro, self.keys_macro)
        option.setTabOrder(self.keys_macro, self.command_macro)
        option.setTabOrder(self.command_macro, self.save_macro)
        option.setTabOrder(self.save_macro, self.delete_macro)
        option.setTabOrder(self.delete_macro, self.echo_color_button)
        option.setTabOrder(self.echo_color_button, self.save_log)
开发者ID:develersrl,项目名称:devclient,代码行数:53,代码来源:gui_option.py

示例10: __init__

    def __init__(self, parent=None):
        super(_MainContainer, self).__init__(parent)
        self._parent = parent
        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.setAcceptDrops(True)
        self._files_handler = files_handler.FilesHandler(self)
        self._add_file_folder = add_file_folder.AddFileFolderWidget(self)

        # documentation browser
        self.docPage = None
        # Code Navigation
        self._locator = locator.GoToDefinition()
        self.__codeBack = []
        self.__codeForward = []
        self.__bookmarksFile = ""
        self.__bookmarksPos = -1
        self.__breakpointsFile = ""
        self.__breakpointsPos = -1
        self.__operations = {0: self._navigate_code_jumps, 1: self._navigate_bookmarks, 2: self._navigate_breakpoints}

        self.connect(self, SIGNAL("locateFunction(QString, QString, bool)"), self.locate_function)

        IDE.register_service("main_container", self)

        # Register signals connections
        connections = (
            {"target": "menu_file", "signal_name": "openFile(QString)", "slot": self.open_file},
            {"target": "explorer_container", "signal_name": "goToDefinition(int)", "slot": self.editor_go_to_line},
            {"target": "explorer_container", "signal_name": "pep8Activated(bool)", "slot": self.reset_pep8_warnings},
            {"target": "explorer_container", "signal_name": "lintActivated(bool)", "slot": self.reset_lint_warnings},
        )

        IDE.register_signals("main_container", connections)

        self.selector = main_selector.MainSelector(self)
        self._opening_dialog = False
        self.add_widget(self.selector)

        if settings.SHOW_START_PAGE:
            self.show_start_page()

        self.connect(self.selector, SIGNAL("changeCurrent(int)"), self._change_current_stack)
        self.connect(self.selector, SIGNAL("removeWidget(int)"), self._remove_item_from_stack)
        self.connect(self.selector, SIGNAL("ready()"), self._selector_ready)
        self.connect(self.selector, SIGNAL("animationCompleted()"), self._selector_animation_completed)
        self.connect(self, SIGNAL("closeDialog(PyQt_PyObject)"), self.remove_widget)
开发者ID:perrito666,项目名称:ninja-ide,代码行数:53,代码来源:main_container.py

示例11: __init__

    def __init__(self, original=False):
        super(ComboEditor, self).__init__()
        self.__original = original
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)

        self.bar = ActionBar()
        self.connect(self.bar, SIGNAL("changeCurrent(PyQt_PyObject)"),
            self.set_current)
        vbox.addWidget(self.bar)

        self.stacked = QStackedLayout()
        vbox.addLayout(self.stacked)
开发者ID:pdorrell,项目名称:ninja-ide,代码行数:13,代码来源:combo_editor.py

示例12: __init__

    def __init__(self, editor):
        super(CodeCompletionWidget, self).__init__(
            None, Qt.FramelessWindowHint | Qt.ToolTip)
        self._editor = editor
        self._revision = 0
        self._block = 0
        self.stack_layout = QStackedLayout(self)
        self.stack_layout.setContentsMargins(0, 0, 0, 0)
        self.stack_layout.setSpacing(0)
        self.completion_list = QListWidget()
        self.completion_list.setMinimumHeight(200)
        self.completion_list.setAlternatingRowColors(True)
        self._list_index = self.stack_layout.addWidget(self.completion_list)

        self._icons = {'a': resources.IMAGES['attribute'],
            'f': resources.IMAGES['function'],
            'c': resources.IMAGES['class'],
            'm': resources.IMAGES['module']}

        self.cc = code_completion.CodeCompletion()
        self._completion_results = {}
        self._prefix = u''
        self.setVisible(False)
        self.source = ''
        self._key_operations = {
            Qt.Key_Up: self._select_previous_row,
            Qt.Key_Down: self._select_next_row,
            Qt.Key_PageUp: (lambda: self._select_previous_row(6)),
            Qt.Key_PageDown: (lambda: self._select_next_row(6)),
            Qt.Key_Right: lambda: None,
            Qt.Key_Left: lambda: None,
            Qt.Key_Enter: self.pre_key_insert_completion,
            Qt.Key_Return: self.pre_key_insert_completion,
            Qt.Key_Tab: self.pre_key_insert_completion,
            Qt.Key_Space: self.hide_completer,
            Qt.Key_Escape: self.hide_completer,
            Qt.Key_Backtab: self.hide_completer,
            Qt.NoModifier: self.hide_completer,
            Qt.ShiftModifier: self.hide_completer,
        }

        desktop = QApplication.instance().desktop()
        self._desktop_geometry = desktop.availableGeometry()

        self.connect(self.completion_list,
            SIGNAL("itemClicked(QListWidgetItem*)"),
            self.pre_key_insert_completion)
        self.connect(self._editor.document(),
            SIGNAL("cursorPositionChanged(QTextCursor)"),
            self.update_metadata)
开发者ID:cjdp25,项目名称:ninja-ide,代码行数:50,代码来源:completer_widget.py

示例13: __init__

 def __init__(self, parent=None):
     super(CenterView, self).__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())
开发者ID:jfisteus,项目名称:eyegrade,代码行数:14,代码来源:gui.py

示例14: __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.connect(self._main_container, SIGNAL("fileOpened(QString)"),
                         self._file_opened_by_main)

        self.connect(self.bar.combo, SIGNAL("showComboSelector()"),
                     lambda: self._main_container.change_tab())
        self.connect(self.bar, SIGNAL("changeCurrent(PyQt_PyObject, int)"),
                     self._set_current)
        self.connect(self.bar, SIGNAL("splitEditor(bool)"), self.split_editor)
        self.connect(self.bar, SIGNAL("runFile(QString)"),
                     self._run_file)
        self.connect(self.bar, SIGNAL("closeSplit()"),
                     lambda: self.emit(
                         SIGNAL("closeSplit(PyQt_PyObject)"), self))
        self.connect(self.bar, SIGNAL("addToProject(QString)"),
                     self._add_to_project)
        self.connect(self.bar, SIGNAL("showFileInExplorer(QString)"),
                     self._show_file_in_explorer)
        self.connect(self.bar, SIGNAL("goToSymbol(int)"),
                     self._go_to_symbol)
        self.connect(self.bar, SIGNAL("undockEditor()"),
                     self.undock_editor)
        self.connect(self.bar, SIGNAL("reopenTab(QString)"),
                     lambda path: self._main_container.open_file(path))
        self.connect(self.bar, SIGNAL("recentTabsModified()"),
                     lambda: self._main_container.recent_files_changed())
        self.connect(self.bar.code_navigator.btnPrevious, SIGNAL("clicked()"),
                     lambda: self._navigate_code(False))
        self.connect(self.bar.code_navigator.btnNext, SIGNAL("clicked()"),
                     lambda: self._navigate_code(True))
开发者ID:MictlanHades,项目名称:ninja-ide,代码行数:47,代码来源:combo_editor.py

示例15: __init__

    def __init__(self, editor):
        super(CodeCompletionWidget, self).__init__(None, Qt.FramelessWindowHint | Qt.ToolTip)
        self._editor = editor
        self.stack_layout = QStackedLayout(self)
        self.stack_layout.setContentsMargins(0, 0, 0, 0)
        self.stack_layout.setSpacing(0)
        self.completion_list = QListWidget()
        self.completion_list.setMinimumHeight(200)
        self.completion_list.setAlternatingRowColors(True)
        self._list_index = self.stack_layout.addWidget(self.completion_list)

        self._icons = {
            "a": resources.IMAGES["attribute"],
            "f": resources.IMAGES["function"],
            "c": resources.IMAGES["class"],
        }

        self.cc = code_completion.CodeCompletion()
        self._completion_results = []
        self._prefix = u""
        self.setVisible(False)
        self.source = ""
        self._key_operations = {
            Qt.Key_Up: self._select_previous_row,
            Qt.Key_Down: self._select_next_row,
            Qt.Key_PageUp: (lambda: self._select_previous_row(6)),
            Qt.Key_PageDown: (lambda: self._select_next_row(6)),
            Qt.Key_Right: lambda: None,
            Qt.Key_Left: lambda: None,
            Qt.Key_Enter: self.pre_key_insert_completion,
            Qt.Key_Return: self.pre_key_insert_completion,
            Qt.Key_Tab: self.pre_key_insert_completion,
            Qt.Key_Space: self.hide_completer,
            Qt.Key_Escape: self.hide_completer,
            Qt.Key_Backtab: self.hide_completer,
            Qt.NoModifier: self.hide_completer,
            Qt.ShiftModifier: self.hide_completer,
        }

        desktop = QApplication.instance().desktop()
        self._desktop_geometry = desktop.availableGeometry()

        self.connect(self._editor.document(), SIGNAL("blockCountChanged(int)"), self.update_metadata)
开发者ID:beefsack,项目名称:ninja-ide,代码行数:43,代码来源:completer_widget.py


注:本文中的PyQt4.QtGui.QStackedLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。