def __init__(self, main): QSplitter.__init__(self) CentralGeneric.__init__(self) self._main = main self._tabs = TabCentralWidget() self._tabs2 = TabCentralWidget() self.addWidget(self._tabs) self.addWidget(self._tabs2) self._tabs2.hide() self.setSizes([1, 1]) shortChangeTab = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Tab), self._main) self.connect(shortChangeTab, SIGNAL("activated()"), self.actual_tab().change_tab) self.connect(self._tabs, SIGNAL("currentChanged(int)"), self._main._update_window_name) self.connect(self._tabs2, SIGNAL("currentChanged(int)"), self._main._update_window_name) self.connect(self._tabs, SIGNAL("currentChanged(int)"), self._main._refresh_symbols) self.connect(self._tabs, SIGNAL("currentChanged(int)"), self._exit_follow_mode) self.connect(self._tabs, SIGNAL("changeActualTab(QTabWidget)"), self._change_actual) self.connect(self._tabs2, SIGNAL("changeActualTab(QTabWidget)"), self._change_actual) self.connect(self._tabs, SIGNAL("dropTab(QTabWidget)"), self._move_tab) self.connect(self._tabs2, SIGNAL("dropTab(QTabWidget)"), self._move_tab) self.connect(self._tabs, SIGNAL("emitSaveSignal()"), self._main.save) self.connect(self._tabs2, SIGNAL("emitSaveSignal()"), self._main.save) self.connect(self._tabs, SIGNAL("allTabsClosed()"), self._main.new_editor) self.connect(self._tabs2, SIGNAL("allTabsClosed()"), self.tabs2_without_tabs) self.connect(self._tabs, SIGNAL("editorFontChanged(QString, int)"), self.update_editor_font) self.connect(self._tabs2, SIGNAL("editorFontChanged(QString, int)"), self.update_editor_font) self.connect(self._tabs, SIGNAL("scrollEditor(QWheelEvent, QTabWidget)"), self._scroll_follow_mode) self.connect(self._tabs2, SIGNAL("scrollEditor(QWheelEvent, QTabWidget)"), self._scroll_follow_mode) #refresh file self.connect(self._tabs, SIGNAL("emitReloadSignal()"), self._main.reload_file) self.connect(self._tabs2, SIGNAL("emitReloadSignal()"), self._main.reload_file)
def __init__(self, parent=None): super(ToolWindowManager, self).__init__(parent) self.lastUsedArea = None self.suggestions = [] self.wrappers = [] self.areas = [] self.draggedToolWindows = [] # ---- self.borderSensitivity = 12 testSplitter = QSplitter() self.rubberBandLineWidth = testSplitter.handleWidth() self.dragIndicator = QtGui.QLabel(None, Qt.ToolTip) self.dragIndicator.setAttribute(Qt.WA_ShowWithoutActivating) mainLayout = QtGui.QVBoxLayout(self) mainLayout.setContentsMargins(0, 0, 0, 0) wrapper = ToolWindowManagerWrapper(self) wrapper.setWindowFlags(wrapper.windowFlags() & ~Qt.Tool) mainLayout.addWidget(wrapper) self.dropSuggestionSwitchTimer = QtCore.QTimer(self) self.dropSuggestionSwitchTimer.timeout.connect(self.showNextDropSuggestion) self.dropSuggestionSwitchTimer.setInterval(800) self.dropCurrentSuggestionIndex = 0 palette = QtGui.QPalette() color = QtGui.QColor(Qt.blue) color.setAlpha(80) palette.setBrush(QtGui.QPalette.Highlight, QtGui.QBrush(color)) self.rectRubberBand = QtGui.QRubberBand(QtGui.QRubberBand.Rectangle, self) self.lineRubberBand = QtGui.QRubberBand(QtGui.QRubberBand.Line, self) self.rectRubberBand.setPalette(palette) self.lineRubberBand.setPalette(palette) self.toolWindowList = []
def __init__(self, widget, parent=None, **kw): QSplitter.__init__(self, Qt.Horizontal, parent) self.setFocusPolicy(Qt.StrongFocus) self.mainWidget = widget self.addWidget(self.mainWidget) self.showHide = None self.subsidiaryWidget = MSQtCanvas([], "", flags='spectrum')#, subsidiaryWidget=True) self.subsidiaryWidget.pw.plotItem.toolBar.hide() self.subsidiaryWidget.setContextMenuPolicy(Qt.CustomContextMenu) self.connect(self.subsidiaryWidget, SIGNAL("customContextMenuRequested(const QPoint &)"), self.showContextMenu) self.menu=QMenu(self.subsidiaryWidget) self.menu.addAction("&Hide...") self.connect(self.menu.actions()[0], SIGNAL("triggered()"), self.subsidiaryWidget.hide) self.addWidget(self.subsidiaryWidget) self.subsidiaryWidget.hide() self.barplotdrawn = False self.connect(self.mainWidget, SIGNAL('drawSpectraRequested'), self.drawSpectrum) self.connect(self.mainWidget, SIGNAL('drawSpectra(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)'), self.drawSpectra) self.connect(self.mainWidget, SIGNAL('drawSpectrumByTime'), self.drawSpectrumByTime) self.connect(self.mainWidget, SIGNAL('hideRequested'), self.subsidiaryWidget.hide)
def initGui(self): mc = self.canvas layer = mc.currentLayer() self.grupo = QSplitter() self.action1 = QPushButton(QIcon(":/plugins/gabarito/icon.png"), u"gabarito", self.iface.mainWindow()) self.criarCombo([u"ESCALAS",u"25",u"100",u"50"], u"ESCALAS") self.tamanhos = {} self.tamanhos[u"25mm²"] = {'valor': 25, 'tipo': 'area'} self.tamanhos[u"4mm²"] = {'valor': 4, 'tipo': 'area'} self.tamanhos[u"1x1mm²"] = {'valor': 1, 'tipo': 'area'} self.tamanhos[u"0.8x0.8mm²"] = {'valor': 0.64, 'tipo': 'area'} self.tamanhos[u"0.8mm"] = {'valor': 0.8, 'tipo': 'distancia'} valores=[u"TAMANHOS"]+self.tamanhos.keys() self.criarCombo(valores, u"TAMANHOS") self.criarCombo([u"GABARITOS",u"Hexágono",u"Quadrado"], u"GABARITOS") self.grupo.addWidget(self.action1) QObject.connect(self.action1, SIGNAL("clicked()"), self.run) #self.iface.digitizeToolBar().addWidget(self.grupo) self.iface.addToolBarWidget(self.grupo)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.parent = parent # This variables are used to save the splitter sizes before hide self._splitterMainSizes = None self._splitterAreaSizes = None self.lateralPanel = None hbox = QHBoxLayout(self) hbox.setContentsMargins(0, 0, 0, 0) hbox.setSpacing(0) # Create Splitters to divide the UI in: MainPanel, Explorer, Misc self._splitterArea = QSplitter(Qt.Horizontal) self._splitterMain = QSplitter(Qt.Vertical) # Create scrollbar for follow mode self.scrollBar = QScrollBar(Qt.Vertical, self) self.scrollBar.setFixedWidth(20) self.scrollBar.setToolTip("Follow Mode: Scroll the Editors together") self.scrollBar.hide() self.connect(self.scrollBar, SIGNAL("valueChanged(int)"), self.move_follow_scrolls) # Add to Main Layout hbox.addWidget(self.scrollBar) hbox.addWidget(self._splitterArea)
def g_display(self): self.name = 'timeline ' + QString(self.node.name()) if not self.node.hasChildren(): self.setStateInfo(self.node.absolute() + ' doesn\'t have any children.') else: self.vfs = vfs.vfs() self.vlayout = QVBoxLayout() self.vlayout.setMargin(0) self.vlayout.setSpacing(0) self.hsplitter = QSplitter() self.ploter = PaintArea(self) self.options = OptionsLayout(self) self.hsplitter.addWidget(self.ploter) self.hsplitter.addWidget(self.options) self.vlayout.addWidget(self.hsplitter) self.setLayout(self.vlayout) self.draw = Drawer(self) # CountThread compute node amount self.countThread = CountThread(self, self.countThreadOver) self.populateThread = DataThread(self, self.dataThreadOver) self.maxOccThread = MaxOccThread(self, self.maxOccThreadOver) self.workerThread = WorkerThread(self) #comment it to avoid redraw everytime painter is resized self.connect(self.workerThread, SIGNAL('refresh'), self.reDraw)
def __setupUi(self): layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.toolbox = WidgetToolBox() self.help = QuickHelpWidget(objectName="quick-help") self.__splitter = QSplitter() self.__splitter.setOrientation(Qt.Vertical) self.__splitter.addWidget(self.toolbox) self.__splitter.addWidget(self.help) self.toolbar = DynamicResizeToolBar() self.toolbar.setMovable(False) self.toolbar.setFloatable(False) self.toolbar.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) layout.addWidget(self.__splitter, 10) layout.addWidget(self.toolbar) self.setLayout(layout) self.__splitterResizer = SplitterResizer() self.__splitterResizer.setSplitterAndWidget(self.__splitter, self.help)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.parent = parent #This variables are used to save the splitter sizes before hide self._splitterMainSizes = None self._splitterAreaSizes = None self.lateralPanel = None hbox = QHBoxLayout(self) hbox.setContentsMargins(0, 0, 0, 0) hbox.setSpacing(0) #Create Splitters to divide the UI in: MainPanel, Explorer, Misc self._splitterArea = QSplitter(Qt.Horizontal) self._splitterMain = QSplitter(Qt.Vertical) #Create scrollbar for follow mode self.scrollBar = QScrollBar(Qt.Vertical, self) self.scrollBar.setFixedWidth(20) self.scrollBar.setToolTip('Follow Mode: Scroll the Editors together') self.scrollBar.hide() self.connect(self.scrollBar, SIGNAL("valueChanged(int)"), self.move_follow_scrolls) #Add to Main Layout hbox.addWidget(self.scrollBar) hbox.addWidget(self._splitterArea)
class KuadApplication (KApplication): def __init__(self): super(KApplication, self).__init__() self.mainwin = kparts.KParts.MainWindow(None, Qt.FramelessWindowHint) # No titlebar self.loader = KPluginLoader('libkonsolepart') self.factory = self.loader.factory() width = 2 height = 2 self.splitter = QSplitter(Qt.Vertical) for v in range(width): splitter = QSplitter(Qt.Horizontal) for h in range(height): widget = KonsoleWidget(splitter, self) splitter.insertWidget(h, widget) self.splitter.insertWidget(v,splitter) self.mainwin.setCentralWidget(self.splitter) #QShortcut(QKeySequence('Ctrl+Q'), self.mainwin, self.quit) self.mainwin.showMaximized() def eventFilter(self, object, event): if event.type() == QEvent.KeyPress: print 'eat keypress' return True return False
def __init__(self, parent=None): QSplitter.__init__(self, parent) self._parent = parent self._tabMain = tab_widget.TabWidget(self) self._tabSecondary = tab_widget.TabWidget(self) self.addWidget(self._tabMain) self.addWidget(self._tabSecondary) self.setSizes([1, 1]) self._tabSecondary.hide() self.actualTab = self._tabMain self._followMode = False self.splitted = False highlighter.restyle(resources.CUSTOM_SCHEME) #documentation browser self.docPage = None self.connect(self._tabMain, SIGNAL("currentChanged(int)"), self._current_tab_changed) self.connect(self._tabSecondary, SIGNAL("currentChanged(int)"), self._current_tab_changed) self.connect(self._tabMain, SIGNAL("currentChanged(int)"), self._exit_follow_mode) self.connect(self._tabMain, SIGNAL("changeActualTab(QTabWidget)"), self._change_actual) self.connect(self._tabSecondary, SIGNAL("changeActualTab(QTabWidget)"), self._change_actual) self.connect(self._tabMain, SIGNAL("splitTab(QTabWidget, int, bool)"), self._split_this_tab) self.connect(self._tabSecondary, SIGNAL("splitTab(QTabWidget, int, bool)"), self._split_this_tab) self.connect(self._tabMain, SIGNAL("reopenTab(QTabWidget, QString)"), self._reopen_last_tab) self.connect(self._tabSecondary, SIGNAL("reopenTab(QTabWidget, QString)"), self._reopen_last_tab) self.connect(self._tabMain, SIGNAL("syntaxChanged(QWidget, QString)"), self._specify_syntax) self.connect(self._tabSecondary, SIGNAL("syntaxChanged(QWidget, QString)"), self._specify_syntax) self.connect(self._tabMain, SIGNAL("allTabsClosed()"), self._main_without_tabs) self.connect(self._tabSecondary, SIGNAL("allTabsClosed()"), self._secondary_without_tabs) #reload file self.connect(self._tabMain, SIGNAL("reloadFile(QWidget)"), self.reload_file) self.connect(self._tabSecondary, SIGNAL("reloadFile(QWidget)"), self.reload_file) #for Save on Close operation self.connect(self._tabMain, SIGNAL("saveActualEditor()"), self.save_file) self.connect(self._tabSecondary, SIGNAL("saveActualEditor()"), self.save_file) #Navigate Code self.connect(self._tabMain, SIGNAL("navigateCode(bool, int)"), self._navigate_code) self.connect(self._tabSecondary, SIGNAL("navigateCode(bool, int)"), self._navigate_code)
def createWidget(self): """ Create the widget """ self.diagramScene = QGraphicsScene(self) self.view = QGraphicsView(self.diagramScene) self.view.setRenderHint(QPainter.Antialiasing) # set the main layout layout = QVBoxLayout() self.logEdit = QTextEdit() self.logEdit.setReadOnly(True) hSplitter2 = QSplitter(self) hSplitter2.setOrientation(Qt.Vertical) hSplitter2.addWidget(self.view) hSplitter2.addWidget(self.logEdit) hSplitter2.setStretchFactor(0, 1) layout.addWidget(hSplitter2) self.setLayout(layout)
def __init__(self, widget, parent=None, **kw): QSplitter.__init__(self, Qt.Horizontal, parent) self.setFocusPolicy(Qt.StrongFocus) self.mainWidget = widget self.addWidget(self.mainWidget) self.showHide = None self.subsidiaryWidget = MSQtCanvas( [], "", flags='spectrum') #, subsidiaryWidget=True) self.subsidiaryWidget.pw.plotItem.toolBar.hide() self.subsidiaryWidget.setContextMenuPolicy(Qt.CustomContextMenu) self.connect(self.subsidiaryWidget, SIGNAL("customContextMenuRequested(const QPoint &)"), self.showContextMenu) self.menu = QMenu(self.subsidiaryWidget) self.menu.addAction("&Hide...") self.connect(self.menu.actions()[0], SIGNAL("triggered()"), self.subsidiaryWidget.hide) self.addWidget(self.subsidiaryWidget) self.subsidiaryWidget.hide() self.barplotdrawn = False self.connect(self.mainWidget, SIGNAL('drawSpectraRequested'), self.drawSpectrum) self.connect( self.mainWidget, SIGNAL('drawSpectra(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)'), self.drawSpectra) self.connect(self.mainWidget, SIGNAL('drawSpectrumByTime'), self.drawSpectrumByTime) self.connect(self.mainWidget, SIGNAL('hideRequested'), self.subsidiaryWidget.hide)
def __init__(self, *args): QMainWindow.__init__(self, *args) self.resize(900, 640) self.viewer_3d = KubosViewer(doc_ctrl) self._splitter = QSplitter(Qt.Horizontal) #if appdata.get('mode') == 'script': from _gui.text_edit import TextEdit self.editor = TextEdit() self._splitter.addWidget(self.editor) self._splitter.addWidget(self.viewer_3d) self.setCentralWidget(self._splitter) self.setIconSize(QSize(22, 22)) # if appdata.get('mode') in ['test', 'standard']: self.command_dock_widget = CommandDockWidget() self.addDockWidget(Qt.RightDockWidgetArea, self.command_dock_widget) #if appdata.get('mode') in ['test', 'standard']: self.tool_options_dock = ToolOptionsDock(self) self.addDockWidget(Qt.RightDockWidgetArea, self.tool_options_dock) self.object_details_dock = ObjectDetailsDock(self) self.addDockWidget(Qt.RightDockWidgetArea, self.object_details_dock) self.setWindowIcon(appdata.get('icon'))
def __init__(self, parent, view1, view2, view3, view4 = None): QWidget.__init__(self, parent) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.installEventFilter(self) self.dockableContainer = [] self.layout = QVBoxLayout() self.setLayout(self.layout) self.layout.setContentsMargins(4, 4, 4, 4) self.layout.setSpacing(0) self.splitVertical = QSplitter(Qt.Vertical, self) self.layout.addWidget(self.splitVertical) self.splitHorizontal1 = QSplitter(Qt.Horizontal, self.splitVertical) self.splitHorizontal1.setObjectName("splitter1") self.splitHorizontal2 = QSplitter(Qt.Horizontal, self.splitVertical) self.splitHorizontal2.setObjectName("splitter2") self.splitHorizontal1.splitterMoved.connect(self.horizontalSplitterMoved) self.splitHorizontal2.splitterMoved.connect(self.horizontalSplitterMoved) self.imageView2D_1 = view1 self.imageView2D_2 = view2 self.imageView2D_3 = view3 self.testView4 = ImageView2DDockWidget(view4) self.dock1_ofSplitHorizontal1 = ImageView2DDockWidget(self.imageView2D_1) self.dock1_ofSplitHorizontal1.connectHud() self.dockableContainer.append(self.dock1_ofSplitHorizontal1) self.dock1_ofSplitHorizontal1.onDockButtonClicked.connect(lambda arg=self.dock1_ofSplitHorizontal1 : self.on_dock(arg)) self.dock1_ofSplitHorizontal1.onMaxButtonClicked.connect(lambda arg=self.dock1_ofSplitHorizontal1 : self.on_max(arg)) self.dock1_ofSplitHorizontal1.onMinButtonClicked.connect(lambda arg=self.dock1_ofSplitHorizontal1 : self.on_min(arg)) self.splitHorizontal1.addWidget(self.dock1_ofSplitHorizontal1) self.dock2_ofSplitHorizontal1 = ImageView2DDockWidget(self.imageView2D_2) self.dock2_ofSplitHorizontal1.onDockButtonClicked.connect(lambda arg=self.dock2_ofSplitHorizontal1 : self.on_dock(arg)) self.dock2_ofSplitHorizontal1.onMaxButtonClicked.connect(lambda arg=self.dock2_ofSplitHorizontal1 : self.on_max(arg)) self.dock2_ofSplitHorizontal1.onMinButtonClicked.connect(lambda arg=self.dock2_ofSplitHorizontal1 : self.on_min(arg)) self.dock2_ofSplitHorizontal1.connectHud() self.dockableContainer.append(self.dock2_ofSplitHorizontal1) self.splitHorizontal1.addWidget(self.dock2_ofSplitHorizontal1) self.dock1_ofSplitHorizontal2 = ImageView2DDockWidget(self.imageView2D_3) self.dock1_ofSplitHorizontal2.onDockButtonClicked.connect(lambda arg=self.dock1_ofSplitHorizontal2 : self.on_dock(arg)) self.dock1_ofSplitHorizontal2.onMaxButtonClicked.connect(lambda arg=self.dock1_ofSplitHorizontal2 : self.on_max(arg)) self.dock1_ofSplitHorizontal2.onMinButtonClicked.connect(lambda arg=self.dock1_ofSplitHorizontal2 : self.on_min(arg)) self.dock1_ofSplitHorizontal2.connectHud() self.dockableContainer.append(self.dock1_ofSplitHorizontal2) self.splitHorizontal2.addWidget(self.dock1_ofSplitHorizontal2) self.dock2_ofSplitHorizontal2 = ImageView2DDockWidget(self.testView4) self.dockableContainer.append(self.dock2_ofSplitHorizontal2) self.splitHorizontal2.addWidget(self.dock2_ofSplitHorizontal2) #this is a hack: with 0 ms it does not work... QTimer.singleShot(250, self._resizeEqual)
def __init__( self, parent = None ): super( ToolWindowManager, self ).__init__( parent ) self.lastUsedArea = None self.suggestions = [] self.wrappers = [] self.areas = [] self.draggedToolWindows = [] #---- self.borderSensitivity = 12 testSplitter = QSplitter() self.rubberBandLineWidth = testSplitter.handleWidth() self.dragIndicator = QtGui.QLabel( None, Qt.ToolTip) self.dragIndicator.setAttribute( Qt.WA_ShowWithoutActivating) mainLayout = QtGui.QVBoxLayout( self ) mainLayout.setContentsMargins( 0, 0, 0, 0 ) wrapper = ToolWindowManagerWrapper( self ) wrapper.setWindowFlags( wrapper.windowFlags() & ~Qt.Tool ) mainLayout.addWidget( wrapper ) self.dropSuggestionSwitchTimer = QtCore.QTimer( self ) self.dropSuggestionSwitchTimer.timeout.connect( self.showNextDropSuggestion ) self.dropSuggestionSwitchTimer.setInterval( 800 ) self.dropCurrentSuggestionIndex = 0 palette = QtGui.QPalette() color = QtGui.QColor( Qt.blue ) color.setAlpha(80) palette.setBrush( QtGui.QPalette.Highlight, QtGui.QBrush( color ) ) self.rectRubberBand = QtGui.QRubberBand( QtGui.QRubberBand.Rectangle, self ) self.lineRubberBand = QtGui.QRubberBand( QtGui.QRubberBand.Line, self ) self.rectRubberBand.setPalette( palette ) self.lineRubberBand.setPalette( palette ) self.toolWindowList = []
def __init__(self, rulesModel, logoFnam, *args): QMainWindow.__init__(self, *args) self.rulesModel = rulesModel self.rulesModel.dataChanged.connect(self._statusRefresh) self.cancelled = True # for to handle win close box the same as Cancel button self.mainHSplit = QSplitter(self) # data | buttons self.mainHSplit.setChildrenCollapsible(False) self.setCentralWidget(self.mainHSplit) self.mainVSplit = QSplitter(Qt.Vertical) self.mainVSplit.setChildrenCollapsible(False) self.mainHSplit.addWidget(self.mainVSplit) self._drawRules() self.mainVSplit.addWidget(self.rulesView) self.condActSplit = QSplitter() self.condActSplit.setChildrenCollapsible(False) self._drawCondAct() self.mainVSplit.addWidget(self.condActSplit) # let rules view resize vertically two times faster than cond/action view self.rulesView.setSizeIncrement(self.rulesView.sizeIncrement().width(), 2 * self.condView.sizeIncrement().height()) self._drawButtons(logoFnam) self.setStatusBar(QStatusBar()) self.condView.horizontalHeader().setCascadingSectionResizes(True) self.rulesView.selectRow(0)
def __init__( self, parent = None ): QWidget.__init__( self, parent ) self.__projectContextItem = None self.__fileContextItem = None self.upper = self.__createRecentFilesLayout() self.lower = self.__createRecentProjectsLayout() self.__createProjectPopupMenu() self.__createFilePopupMenu() layout = QVBoxLayout() layout.setContentsMargins( 1, 1, 1, 1 ) splitter = QSplitter( Qt.Vertical ) splitter.addWidget( self.upper ) splitter.addWidget( self.lower ) splitter.setCollapsible( 0, False ) splitter.setCollapsible( 1, False ) layout.addWidget( splitter ) self.setLayout( layout ) self.__populateProjects() self.__populateFiles() self.__updateProjectToolbarButtons() self.__updateFileToolbarButtons() # Debugging mode support self.__debugMode = False parent.debugModeChanged.connect( self.__onDebugMode ) return
def _init_gui(self): """ Initializes some widgets and delegates tree initializing to another function """ self.text_output_1.setWindowTitle("Output Tree1") self.text_output_1.setReadOnly(True) self.text_output_2.setWindowTitle("Output Tree2") self.text_output_2.setReadOnly(True) self.signal_editor_of_tree1_clear.connect(self.text_output_1.clear) self.signal_editor_of_tree2_clear.connect(self.text_output_2.clear) self.main_window.setCentralWidget(self.window) self.main_window.resize(500, 300) widget_left_window = QWidget() widget_left_window.setLayout( self._initialize_create_tree(self.MAIN_TREE, self.tree_model_main, self.text_output_1)) self.widget_right_window.setLayout( self._initialize_create_tree(self.SECOND_TREE, self.tree_model_second, self.text_output_2)) self.widget_right_window.hide() widget_two_windows = QSplitter() layout_two_windows = QHBoxLayout() layout_two_windows.addWidget(widget_left_window) layout_two_windows.addWidget(self.widget_right_window) widget_two_windows.setLayout(layout_two_windows) self.window.setLayout(layout_two_windows)
def _setupUi(self): self.resize(558, 447) self.mainLayout = QVBoxLayout(self) self.mainLayout.setSpacing(0) self.mainLayout.setMargin(0) self.splitterView = QSplitter() self.splitterView.setChildrenCollapsible(False) self.splitterView.setOrientation(Qt.Vertical) self.subSplitterView = QSplitter() self.subSplitterView.setChildrenCollapsible(False) self.treeView = TreeView(self) self.treeView.setAcceptDrops(True) self.treeView.setFrameShape(QFrame.NoFrame) self.treeView.setFrameShadow(QFrame.Plain) self.treeView.setEditTriggers(QAbstractItemView.EditKeyPressed|QAbstractItemView.SelectedClicked) self.treeView.setDragEnabled(True) self.treeView.setDragDropMode(QAbstractItemView.InternalMove) self.treeView.setUniformRowHeights(True) self.treeView.setAllColumnsShowFocus(True) self.treeView.setSelectionMode(QAbstractItemView.ExtendedSelection) self.treeView.header().setStretchLastSection(False) self.subSplitterView.addWidget(self.treeView) self.pieChart = PieChartView(self) self.pieChart.setMinimumSize(300, 0) self.subSplitterView.addWidget(self.pieChart) self.splitterView.addWidget(self.subSplitterView) self.graphView = LineGraphView(self) self.graphView.setMinimumSize(0, 200) self.splitterView.addWidget(self.graphView) self.splitterView.setStretchFactor(0, 1) self.splitterView.setStretchFactor(1, 0) self.subSplitterView.setStretchFactor(0, 1) self.subSplitterView.setStretchFactor(1, 0) self.mainLayout.addWidget(self.splitterView)
def main(): app = QApplication(sys.argv) window = QMainWindow() splitter = QSplitter(window) window.setCentralWidget(splitter) left_view = MouseDevicesView(window) left_view.checkedDevicesChanged.connect(partial(show, 'left:')) right_view = MouseDevicesView(window) right_view.checkedDevicesChanged.connect(partial(show, 'right:')) splitter.addWidget(left_view) splitter.addWidget(right_view) def _move_checked_state(source, dest): checked = source.property('checkedDevices').toPyObject() dest.setProperty('checkedDevices', checked) toolbar = window.addToolBar('Actions') move_selection_left = QAction( QIcon.fromTheme('arrow-left'), 'Moved checked state left', window, triggered=partial(_move_checked_state, right_view, left_view)) move_selection_right = QAction( QIcon.fromTheme('arrow-right'), 'Moved checked state right', window, triggered=partial(_move_checked_state, left_view, right_view)) toolbar.addAction(move_selection_left) toolbar.addAction(move_selection_right) window.show() app.exec_()
class modulesManager(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) self.name = "moduleManager" self.stacked = stackedWidget(self) self.initWidget() self.initShape() def initWidget(self): self.toolbox = tabBox(self) def initShape(self): self.mainvbox = QVBoxLayout() self.splitter = QSplitter() self.splitter.setOrientation(Qt.Vertical) self.splitter.addWidget(self.toolbox) self.splitter.addWidget(self.stacked) self.mainvbox.addWidget(self.splitter) self.setLayout(self.mainvbox) cw = self.toolbox.currentWidget() cw.setCurrentItem(cw.item(0)) cw.emit(SIGNAL("itemPressed(QListWidgetItem *)"), cw.item(0)) def execute(self): args = self.stacked.currentWidget().validateModule() self.stacked.currentWidget().launchTask(args)
def __init__(self, filtertable, fname=None, query=None): super(QDialog, self).__init__(filtertable) self.filtertable = filtertable self.setupUi(self) self.editable = False self.defaultquery = None self.fname = None sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) self.setSizePolicy(sizePolicy) self.requestLayout.setSpacing(6) self.requestLayout.setSizeConstraint(QLayout.SetMinimumSize) self.requestLayout.setMargin(0) self.__splitter = QSplitter(Qt.Vertical) self.__splitter.setHandleWidth(12) self.requestLayout.addWidget(self.__splitter) self.__query = QTextEdit() self.__query.setReadOnly(True) if (fname == None) and (query == None): self.editable = True self.filterRequest = FilterRequests(self) self.connect(self.filterRequest, SIGNAL("queryUpdated"), self.updateQuery) self.__splitter.addWidget(self.filterRequest) self.__splitter.addWidget(self.__query) self.__splitter.setStretchFactor(0, 80) self.__splitter.setStretchFactor(1, 20) else: self.defaultquery = query self.fname = fname
def __init__(self, parent, outputpath=None): QSplitter.__init__(self) EventHandler.__init__(self) self.reportManager = ReportManager() self.reportManager.connection(self) self.parent = parent self.name = self.tr("Report Editor") self.reportView = ReportEditorView(self) self.reportTree = ReportEditorTree(self) self.connect(self.reportTree, SIGNAL("itemClicked"), self.reportView.displayItem) treeWidget = QWidget() vbox = QVBoxLayout() vbox.addWidget(self.reportTree) buttonPreview = QPushButton(self.tr("&Generate preview"), treeWidget) self.connect(buttonPreview, SIGNAL("clicked()"), self.reportView.showReportPreview) vbox.addWidget(buttonPreview) buttonExport = QPushButton(self.tr("&Export"), treeWidget) self.connect(buttonExport, SIGNAL("clicked()"), self.reportTree.export) vbox.addWidget(buttonExport) treeWidget.setLayout(vbox) self.addWidget(treeWidget) self.addWidget(self.reportView) self.setStretchFactor(1, 2)
def initUI(self, engine): splitter = QSplitter(Qt.Horizontal) # make the right panel right_panel = QSplitter(Qt.Vertical) player = Player() track_queue = QListWidget() ## set play on double click def play_track(): player.set_track(track_queue.currentItem().get_track()) player.play() track_queue.doubleClicked.connect(play_track) ## advance list on track finish def track_finish_task(): print 'track finished' if track_queue.currentRow() == track_queue.count() - 1: track_queue.setCurrentRow(0) else: track_queue.setCurrentRow(track_queue.currentRow() + 1) play_track() player.track_finished.connect(track_finish_task) ## put some entry controls on menu track_queue.setContextMenuPolicy(Qt.CustomContextMenu) def onContext(point): ## make action qaction = QAction('Delete item', track_queue) def remove_entry(): track_queue.takeItem(track_queue.currentRow()) qaction.triggered.connect(remove_entry) # Create a menu menu = QMenu("Menu", track_queue) menu.addAction(qaction) # Show the context menu. menu.exec_(track_queue.mapToGlobal(point)) track_queue.connect(track_queue, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), onContext) utils.add_widgets_to_component(right_panel, [player, track_queue]) ## make the left panel left_panel = QWidget() vbox = QVBoxLayout() utils.add_widgets_to_component(vbox, [PlaylistsPanel(engine, [player], [track_queue]), SearchPanel(engine, [player], [track_queue])]) left_panel.setLayout(vbox) utils.add_widgets_to_component(splitter, [left_panel, right_panel]) splitter.setSizes([1, 10]) bottomBar = self.make_bottom_bar() # Application UI layout vBox = QVBoxLayout(self) vBox.addWidget(splitter) vBox.addWidget(bottomBar) self.setLayout(vBox)
def __init__(self, peaks, parent=None): QSplitter.__init__(self, Qt.Vertical, parent) self.peaks = peaks self.choosenOne = [pe for pe in self.peaks if pe is not None][0] #self.peakModel = QStandardItemModel() self.identificationModel = QStandardItemModel() self.setupUi() self.setModel() self.connect(self.calcCorr, SIGNAL('pressed()'), self.setRankValue)
def __init__(self, parent, mainwin, name, orientation): QSplitter.__init__(self, parent) self.mainwin = mainwin self.setOrientation(orientation) self.setHandleWidth(7) self.setObjectName(name) self.splitterMoved.connect(self._update_position) self._timer = QTimer() self._timer.timeout.connect(self._timer_exhaust)
def _create_terminal(self): assert self._terminal is None, \ "should only call _create_terminal once" self._terminal_button = QToolButton(None) self._terminal_button.setToolTip("Toggle command line") self._ui.layerWidget.button_row.addWidget(self._terminal_button) self._terminal_button.setArrowType(Qt.DownArrow) try: from .widgets.terminal import glue_terminal widget = glue_terminal(data_collection=self._data, dc=self._data, hub=self._hub, **vars(env)) self._terminal_button.clicked.connect(self._toggle_terminal) except Exception as e: # pylint: disable=W0703 import traceback self._terminal_exception = traceback.format_exc() self._setup_terminal_error_dialog(e) return splitter = QSplitter(self) splitter.setOrientation(Qt.Vertical) splitter.addWidget(self._ui.centralwidget) splitter.addWidget(widget) splitter.setStretchFactor(0, 5) splitter.setStretchFactor(1, 1) self.setCentralWidget(splitter) self._terminal = widget self._hide_terminal()
def __init__(self, parent, name, value): QSplitter.__init__(self, Qt.Horizontal) self.__name = name self.__parent = parent self.reportBase = "Analyse/" self.table = EvtTableWidget() self.fillTable(value) self.addWidget(self.table) self.addWidget(EvtControlPannel(self.table)) self.setStretchFactor(0, 2)
def createLayouts(self): self.mainSplitter = QSplitter() self.setCentralWidget(self.mainSplitter) self.mainSplitter.addWidget(self.folderTree) self.messageSplitter = QSplitter(Qt.Vertical) self.messageSplitter.addWidget(self.table) self.messageSplitter.addWidget(self.textEdit2) self.mainSplitter.addWidget(self.messageSplitter)
def createLayouts(self): self.mainSplitter=QSplitter() self.setCentralWidget(self.mainSplitter) self.mainSplitter.addWidget(self.folderTree) self.messageSplitter=QSplitter(Qt.Vertical) self.messageSplitter.addWidget(self.table) self.messageSplitter.addWidget(self.textEdit2) self.mainSplitter.addWidget(self.messageSplitter)
def g_display(self): QWidget.__init__(self, None) self.layout = QVBoxLayout(self) self.hlayout = QSplitter(self) self.layout.insertWidget(0, self.hlayout) self.layout.setStretchFactor(self.hlayout, 1) self.gTable() self.viewTable() self.button = QPushButton("&Create dump") self.connect(self.button, SIGNAL("clicked()"), self.createDump) self.layout.addWidget(self.button)
def __init__(self, parent, name, events): QSplitter.__init__(self, Qt.Horizontal) self.__name = name self.__parent = parent self.reportBase = "Analyse/" self.evtxViewer = EventLogViewer() self.evtxViewer.admin_pannel.hide() self.evtxViewer.addEvents(events) self.addWidget(self.evtxViewer) self.addWidget(EvtControlPannel(self.evtxViewer.evtx_table_view)) self.setStretchFactor(0, 2)
def initDialog(self): self.initArguments() self.vlayout = QVBoxLayout(self) self.vlayout.addWidget(self.label) self.tableModules = ApplyModuleTable(self) self.splitter = QSplitter(Qt.Vertical, self) self.splitter.addWidget(self.tableModules) self.splitter.addWidget(self.argumentsContainer) self.vlayout.addWidget(self.splitter) self.vlayout.addWidget(self.buttonBox)
def __init__(self, params, parent=None): QWidget.__init__(self, parent) self.file_name=None self.is_global = False if params is not None: self.is_global = params["global"] import core.InterpreterEditorCommands core.InterpreterEditorCommands.EVENT_COMMAND_CLEAR += self.clear core.InterpreterEditorCommands.EVENT_COMMAND_RESET += self.reset self.setMinimumWidth(400) self.setMinimumHeight(100) # create widgets self._editor_widget = mixin( WidthPythonHighlighter, WithFind, WidthMqHighlighter, WithLineNumbers, WithViewPortMargins, WithWordCompletionMulty_, InterpreterEditor.WithInterpreterCompletion, WithCompletion, InterpreterEditor.WidthLineEnterEvent, WithBasicIdentationManager, WithLineHighlight, WithFixedFont, WithMqEditIO, BaseWidget, QPlainTextEdit)(self) self._editor_widget.on_lines_event += self._process_lines if self.is_global: self._editor_widget.namespace = globals() else: self._editor_widget.namespace = locals() self._result_widget = mixin(WithFixedFont, QPlainTextEdit)(self) # create a horizontal splitter v_splitter = QSplitter(Qt.Horizontal, self) v_splitter.addWidget(self._editor_widget) v_splitter.addWidget(self._result_widget) layout = QVBoxLayout(self) layout.addWidget(v_splitter) layout.setMargin(0) self.setLayout(layout) self.reset() WithSingleIO.__init__(self, params) BaseWidget.__init__(self, params)
def __init__(self, settings, name, filename, plain_text=False, parent=None): super().__init__(parent=parent) splitty = QSplitter(self) self.setWidget(splitty) self.setWindowTitle(os.path.basename(name)) self.setFloating(True) self.setAttribute(Qt.WA_DeleteOnClose) self.plain_text = plain_text self.notePath = settings.notePath fh = QFile(filename) try: if not fh.open(QIODevice.ReadOnly): raise IOError(fh.errorString()) except IOError as e: QMessageBox.warning(self, self.tr("Read Error"), self.tr("Failed to open %s: %s") % (filename, e)) finally: if fh is not None: noteBody = QTextStream(fh).readAll() fh.close() self.tocw = TocTree(self) splitty.addWidget(self.tocw) strip_math_for_header_parsing = False strip_fence_for_header_parsing = False self.tocw.itemClicked.connect(self.tocNavigate) if 'asciimathml' in settings.extensions: stuff=JSCRIPT_TPL.format(settings.mathjax) strip_math_for_header_parsing = True else: stuff='' if 'fenced_code' in settings.extensions or 'extra' in settings.extensions: strip_fence_for_header_parsing = True if plain_text: note_view = QPlainTextEdit(self) qfnt = QFont() qfnt.setFamily('monospace') note_view.setFont(qfnt) note_view.setPlainText(noteBody) else: note_view = QWebView(self) note_view.setHtml(settings.md.reset().convert(noteBody)+stuff) note_view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks) note_view.linkClicked.connect(self.linkClicked) note_view.settings().setUserStyleSheetUrl( QUrl('file://'+self.parent().settings.cssfile)) self.note_view = note_view splitty.addWidget(note_view) self.tocw.updateToc(os.path.basename(name), parseHeaders(noteBody, strip_fenced_block=strip_fence_for_header_parsing, strip_ascii_math=strip_math_for_header_parsing))
def __init__(self, parent=None): super(QWidget, self).__init__(parent) sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) self.setSizePolicy(sizePolicy) self.__hlayout = QHBoxLayout(self) self.__hlayout.setSpacing(6) self.__hlayout.setSizeConstraint(QLayout.SetMinimumSize) self.__hlayout.setMargin(0) self.__splitter = QSplitter(Qt.Horizontal, parent) self.__splitter.setHandleWidth(12) self.__hlayout.addWidget(self.__splitter)
def initUI(self): layout = QVBoxLayout(self) #Input part input_label = QLabel(inputlabeltext, self) input_label.setWordWrap(True) input_field = QLineEdit("MOM: Oh, good!", self) input_search = QPushButton("Search!", self) splitview = QSplitter(self) splitview.setOrientation(Qt.Vertical) splitview.setChildrenCollapsible(False) #Results list results_label = QLabel(resultslabeltext, self) results_label.setWordWrap(True) results_list = QTreeWidget() results_list.setColumnCount(3) #pointer, refs to pointer, text results_list.header().resizeSection(0, 100) results_list.header().resizeSection(1, 40) results_list.setFocusPolicy(Qt.NoFocus) #results_list.setMaximumSize(QSize(16777215, 100)) stringeditor = self.scripteditcontroller.getview() #Pack all into the layout layout.addWidget(input_label) layout.addWidget(input_field) layout.addWidget(input_search) layout.addWidget(results_label) #layout.addWidget(results_list) #layout.addWidget(stringeditor) splitview.addWidget(results_list) splitview.addWidget(stringeditor) splitview.setSizes([100, 500]) layout.addWidget(splitview) #Connect to actions input_search.clicked.connect(self.searchClick) results_list.itemSelectionChanged.connect(self.resultSelected) #Keeps some elements for later use self.input_field = input_field self.results_list = results_list self.stringeditor = stringeditor #Show the widget self.move(300, 150) self.setWindowTitle('Pokemon GBA String Editor') self.show()
class MainWindow(QMainWindow): def __init__(self, *args): QMainWindow.__init__(self, *args) self.resize(900, 640) self.viewer_3d = KubosViewer(doc_ctrl) self._splitter = QSplitter(Qt.Horizontal) #if appdata.get('mode') == 'script': from _gui.text_edit import TextEdit self.editor = TextEdit() self._splitter.addWidget(self.editor) self._splitter.addWidget(self.viewer_3d) self.setCentralWidget(self._splitter) self.setIconSize(QSize(22, 22)) # if appdata.get('mode') in ['test', 'standard']: self.command_dock_widget = CommandDockWidget() self.addDockWidget(Qt.RightDockWidgetArea, self.command_dock_widget) #if appdata.get('mode') in ['test', 'standard']: self.tool_options_dock = ToolOptionsDock(self) self.addDockWidget(Qt.RightDockWidgetArea, self.tool_options_dock) self.object_details_dock = ObjectDetailsDock(self) self.addDockWidget(Qt.RightDockWidgetArea, self.object_details_dock) self.setWindowIcon(appdata.get('icon')) def closeEvent(self, event): # delayed circular import: import actions.file actions.file.quit_() event.ignore() def keyPressEvent(self, event): if event.key() == Qt.Key_Escape: active_tool.activate_tool(tools.select.select) elif event.key() == Qt.Key_C: self.command_dock_widget.line_edit.setFocus() else: event.ignore() def update_status(self): """Update the text in the status bar""" if appdata.get('mode') not in ['standard', 'test']: return name = active_tool.active_tool.menu[-1].replace('&', '') help = active_tool.active_tool.help[active_tool.active_tool.step] message = name + ' Tool: ' + help self._message_area.show_message(message)
def setupViews2(self): self.setupTaskTable() msplitter = QSplitter(Qt.Horizontal) msplitter.addWidget(self.taskTableWidget) rsplitter = QSplitter(Qt.Vertical, msplitter) self.setupResultTable() rsplitter.addWidget(self.reservResultTable) self.taskViewWidget = taskviewwidget.TaskViewWidget() rsplitter.addWidget(self.taskViewWidget) self.setCentralWidget(msplitter) self.msgLabel = QLabel() self.statusBar().addWidget(self.msgLabel)
def test_dock(self): reg = global_registry() reg = QtWidgetRegistry(reg, parent=self.app) toolbox = WidgetToolBox() toolbox.setObjectName("widgets-toolbox") toolbox.setModel(reg.model()) text = QTextEdit() splitter = QSplitter() splitter.setOrientation(Qt.Vertical) splitter.addWidget(toolbox) splitter.addWidget(text) dock = CollapsibleDockWidget() dock.setExpandedWidget(splitter) toolbar = QToolBar() toolbar.addAction("1") toolbar.setOrientation(Qt.Vertical) toolbar.setMovable(False) toolbar.setFloatable(False) dock.setCollapsedWidget(toolbar) dock.show() self.app.exec_()
def initShape(self): self.mainvbox = QVBoxLayout() self.splitter = QSplitter() self.splitter.setOrientation(Qt.Vertical) self.splitter.addWidget(self.toolbox) self.splitter.addWidget(self.stacked) self.mainvbox.addWidget(self.splitter) self.setLayout(self.mainvbox) cw = self.toolbox.currentWidget() cw.setCurrentItem(cw.item(0)) cw.emit(SIGNAL("itemPressed(QListWidgetItem *)"), cw.item(0))
class NodesMapWidget(QWidget): def __init__(self): QWidget.__init__(self) self.inversedGeoCoder = InversedGeoCoder() self.vfs = VFS.Get() self.mainWindow = QApplication.instance().mainWindow self.vboxLayout = QVBoxLayout(self) self.vboxLayout.setSpacing(0) self.vboxLayout.setMargin(0) self.setLayout(self.vboxLayout) self.splitter = QSplitter() self.mapWidget = QGoogleMap(self) self.mapWidget.markerClicked.connect(self.markerClicked) self.mapWidget.waitUntilReady() self.splitter.addWidget(self.mapWidget) self.nodesAddressWidget = NodesAddressWidget(self) self.connect(self.nodesAddressWidget, SIGNAL("center"), self.center) self.splitter.addWidget(self.nodesAddressWidget) self.vboxLayout.addWidget(self.splitter) self.mapWidget.centerAt(43.776037, -31.330157) self.mapWidget.setZoom(3) def center(self, coord): self.mapWidget.centerAt(*coord) self.mapWidget.setZoom(14) def addNodeCoord(self, node, coord): ( latitude, longitude, ) = self.nodeCoord[node] res = self.mapWidget.addMarker( str(node.uid()), latitude, longitude, **dict(icon="http://google.com/mapfiles/ms/micons/green-dot.png", draggable=False, name=node.name())) try: decoded = self.inversedGeoCoder.decode(coord) except Exception as e: #limit usage or somethings else decoded = None self.nodesAddressWidget.addNodeAddress(node, Address(decoded, coord)) def markerClicked(self, key): nodeuid = long(key) node = self.vfs.getNodeById(nodeuid) self.mainWindow.emit(SIGNAL("previewUpdate"), node) self.nodesAddressWidget.emit(SIGNAL("focusOnNode"), nodeuid)
def g_display(self): QWidget.__init__(self, None) vlayout = QVBoxLayout() splitter = QSplitter(Qt.Horizontal) treemodel = RegTreeModel(self) treeview = RegTreeView(self) keyinfo = KeyInfoView(self, treemodel) tablevalue = TableValue(treemodel, self) treeview.setModel(treemodel) splitter.addWidget(treeview) splitter.addWidget(tablevalue) vlayout.addWidget(splitter) vlayout.addWidget(keyinfo) self.setLayout(vlayout)
class PostProcessConfigWidget(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent) self.tree = PostProcessModulesTreeWidget() self.config = PostProcessModulesConfig() self.connect(self.tree, SIGNAL("moduleClicked"), self.config.update) self.connect(self.tree, SIGNAL("moduleStateChanged"), self.config.updateState) sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding) sizePolicy.setVerticalStretch(1) self.setSizePolicy(sizePolicy) layout = QHBoxLayout() layout.setMargin(0) self.__splitter = QSplitter(Qt.Horizontal, self) layout.addWidget(self.__splitter) self.__splitter.addWidget(self.tree) self.__splitter.addWidget(self.config) self.__splitter.setStretchFactor(0, 0) self.__splitter.setStretchFactor(1, 80) self.setLayout(layout) def fillFromAnalyse(self): TaskManager().addAnalyseDependencies() self.tree.update()
def setup_widget_layout(self): self.tabs = QTabWidget() self.connect(self.tabs, SIGNAL('currentChanged(int)'), self.changeFit) self.fit_layout = QSplitter(self) if self.auto_fit_enabled: auto_group = self.create_autofit_group() self.fit_layout.addWidget(auto_group) self.fit_layout.addWidget(self.tabs) self.plot_layout.addWidget(self.fit_layout, 1, 0) vlayout = QVBoxLayout(self) vlayout.addWidget(self.toolbar) vlayout.addLayout(self.plot_layout, 0) self.setLayout(vlayout)
def __init__(self, modelRoot, *args, **kwargs): super(PlotWidgetContainer, self).__init__(*args) self.modelRoot = modelRoot if len(moose.wildcardFind(modelRoot + "/##[ISA=ChemCompt]")) == 0: self.modelType = ELECTRICAL else: self.modelType = CHEMICAL self.model = moose.element(self.modelRoot) if self.modelRoot != "/": self.modelRoot = self.findModelPath(self.modelRoot) if moose.exists(modelRoot + "/data"): self.data = moose.element(self.modelRoot + "/data") else: self.data = moose.Neutral(self.modelRoot + "/data") else: self.data = moose.element("/data") self._layout = QVBoxLayout() self.graphs = QSplitter() self.graphs.setOrientation(PyQt4.QtCore.Qt.Vertical) self.graphsArea = QScrollArea() # self.graphsLayout = QGridLayout() # self.menubar = self.createMenuBar() self.rowIndex = 0 # self.setSizePolicy( QtGui.QSizePolicy.Expanding # , QtGui.QSizePolicy.Expanding # ) self.graphs.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.setAcceptDrops(True) # self._layout.setSizeConstraint( QLayout.SetNoConstraint ) # self.graphs.setLayout(self.graphsLayout) self.graphsArea.setWidget(self.graphs) self.graphsArea.setWidgetResizable(True) self.graphWidgets = [] # self._layout.addWidget(self.menubar) self._layout.addWidget(self.graphsArea) self.setLayout(self._layout) for graph in self.data.children: self.addPlotWidget(graph=graph) if len(self.data.children) == 0: self.addPlotWidget()
def _setupUi(self): self.setWindowTitle(tr("Re-Prioritize duplicates")) self.resize(700, 400) #widgets msg = tr("Add criteria to the right box and click OK to send the dupes that correspond the " "best to these criteria to their respective group's " "reference position. Read the help file for more information.") self.promptLabel = QLabel(msg) self.promptLabel.setWordWrap(True) self.categoryCombobox = QComboBox() self.criteriaListView = QListView() self.addCriteriaButton = QPushButton(self.style().standardIcon(QStyle.SP_ArrowRight), "") self.removeCriteriaButton = QPushButton(self.style().standardIcon(QStyle.SP_ArrowLeft), "") self.prioritizationListView = QListView() self.prioritizationListView.setAcceptDrops(True) self.prioritizationListView.setDragEnabled(True) self.prioritizationListView.setDragDropMode(QAbstractItemView.InternalMove) self.prioritizationListView.setSelectionBehavior(QAbstractItemView.SelectRows) self.buttonBox = QDialogButtonBox() self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok) # layout self.mainLayout = QVBoxLayout(self) self.mainLayout.addWidget(self.promptLabel) self.splitter = QSplitter() sp = self.splitter.sizePolicy() sp.setVerticalPolicy(QSizePolicy.Expanding) self.splitter.setSizePolicy(sp) self.leftSide = QWidget() self.leftWidgetsLayout = QVBoxLayout() self.leftWidgetsLayout.addWidget(self.categoryCombobox) self.leftWidgetsLayout.addWidget(self.criteriaListView) self.leftSide.setLayout(self.leftWidgetsLayout) self.splitter.addWidget(self.leftSide) self.rightSide = QWidget() self.rightWidgetsLayout = QHBoxLayout() self.addRemoveButtonsLayout = QVBoxLayout() self.addRemoveButtonsLayout.addItem(verticalSpacer()) self.addRemoveButtonsLayout.addWidget(self.addCriteriaButton) self.addRemoveButtonsLayout.addWidget(self.removeCriteriaButton) self.addRemoveButtonsLayout.addItem(verticalSpacer()) self.rightWidgetsLayout.addLayout(self.addRemoveButtonsLayout) self.rightWidgetsLayout.addWidget(self.prioritizationListView) self.rightSide.setLayout(self.rightWidgetsLayout) self.splitter.addWidget(self.rightSide) self.mainLayout.addWidget(self.splitter) self.mainLayout.addWidget(self.buttonBox)
def setupUi(self): """setup UI elements""" self.viewLeft = ScoreViewLeft(self) self.viewRight = ScoreViewRight(self) self.viewRight.setHorizontalScrollBar(HorizontalScrollBar(self)) self.viewRight.setHorizontalScrollMode(QAbstractItemView.ScrollPerItem) self.viewRight.setFocusPolicy(Qt.NoFocus) self.viewRight.header().setClickable(False) self.viewRight.header().setMovable(False) self.viewRight.setSelectionMode(QAbstractItemView.NoSelection) windowLayout = QVBoxLayout(self) self.splitter = QSplitter(Qt.Vertical) self.splitter.setObjectName('ScoreTableSplitter') windowLayout.addWidget(self.splitter) scoreWidget = QWidget() self.scoreLayout = QHBoxLayout(scoreWidget) leftLayout = QVBoxLayout() leftLayout.addWidget(self.viewLeft) self.leftLayout = leftLayout self.scoreLayout.addLayout(leftLayout) self.scoreLayout.addWidget(self.viewRight) self.splitter.addWidget(scoreWidget) self.ruleTree = RuleTreeView(m18nc('kajongg','Used Rules')) self.splitter.addWidget(self.ruleTree) # this shows just one line for the ruleTree - so we just see the # name of the ruleset: self.splitter.setSizes(list([1000, 1]))
def __init__(self): super().__init__() gui.label(self.controlArea, self, "from pandas:") self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.allSQLSelectWidgets.append(self) # set default settings self.domain = None self.recentConnections = list() self.recentConnections.append("(none)") self.queryFile = None self.query = "" self.lastQuery = None if self.lastQuery is not None: self.query = self.lastQuery sources = pyodbc.dataSources() dsns = list(sources.keys()) dsns.sort() for dsn in dsns: self.recentConnections.append("DSN={dsn}".format(dsn=dsn)) self.connectString = self.recentConnections[0] self.connectBox = gui.widgetBox(self.controlArea, "Database") self.connectLineEdit = gui.lineEdit(self.connectBox, self, "connectString", callback=None) self.connectCombo = gui.comboBox( self.connectBox, self, "connectString", items=self.recentConnections, valueType=str, sendSelectedValue=True ) self.button = gui.button(self.connectBox, self, "connect", callback=self.connectDB, disabled=0) # query self.splitCanvas = QSplitter(QtCore.Qt.Vertical, self.mainArea) self.mainArea.layout().addWidget(self.splitCanvas) self.textBox = gui.widgetBox(self, "HiveQL") self.splitCanvas.addWidget(self.textBox) self.queryTextEdit = QPlainTextEdit(self.query, self) self.textBox.layout().addWidget(self.queryTextEdit) self.selectBox = gui.widgetBox(self.controlArea, "Select statement") # self.selectSubmitBox = QHGroupBox("", self.selectBox) # self.queryTextEdit.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)) # self.queryTextEdit.setMinimumWidth(300) # self.connect(self.queryTextEdit, SIGNAL('returnPressed()'), self.executeQuery) gui.button(self.selectBox, self, "Open...", callback=self.openScript) gui.button(self.selectBox, self, "Save...", callback=self.saveScript) self.selectBox.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) gui.button(self.selectBox, self, "format SQL!", callback=self.format_sql, disabled=0) gui.button(self.selectBox, self, "execute!", callback=self.executeQuery, disabled=0) self.domainBox = gui.widgetBox(self.controlArea, "Domain") self.domainLabel = gui.label(self.domainBox, self, "") # info self.infoBox = gui.widgetBox(self.controlArea, "Info") self.info = [] self.info.append(gui.label(self.infoBox, self, "No data loaded.")) self.info.append(gui.label(self.infoBox, self, "")) self.resize(300, 300) self.cnxn = None
def setup_widgets_and_layout(self): sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) self.gridLayout = QGridLayout(self) self.splitter = QSplitter(self) self.splitter.setOrientation(Qt.Horizontal) self.peakmap_plotter = PeakmapPlotter(self.splitter) self.verticalLayoutWidget = QWidget(self.splitter) self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setMargin(0) self.params = PeakMapScalingParameters(self.verticalLayoutWidget) sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.params.sizePolicy().hasHeightForWidth()) self.params.setSizePolicy(sizePolicy) self.verticalLayout.addWidget(self.params) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.MinimumExpanding) self.verticalLayout.addItem(spacerItem) self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
def event(self,event): """ Call tabChanged if window is activated. """ if not self._tabWidget: if event.type()==QEvent.WindowActivate: QCoreApplication.instance().tabChanged() return QSplitter.event(self,event)
def createEditor(self): self.createToolBar(0) self._editorSplitter = QSplitter(Qt.Horizontal) toolBarSectionId = self.toolBar().addSection(SplitterToolBar.ALIGNMENT_LEFT) self._editorTableView=CodeTableView(self._editorSplitter) self._editorSplitter.setSizes([100, 300]) self._minimizeButton = QToolButton() self._minimizeButton.setText("v") self._minimizeButton.setCheckable(True) self._originalButton = QToolButton() self._originalButton.setText("-") self._originalButton.setCheckable(True) self._originalButton.setChecked(True) self._maximizeButton = QToolButton() self._maximizeButton.setText("^") self._maximizeButton.setCheckable(True) self._centerViewToolBarId = self.toolBar().addSection(SplitterToolBar.ALIGNMENT_CENTER) self.toolBar().addWidgetToSection(self._minimizeButton, self._centerViewToolBarId) self.toolBar().addWidgetToSection(self._originalButton, self._centerViewToolBarId) self.toolBar().addWidgetToSection(self._maximizeButton, self._centerViewToolBarId) self.verticalSplitter().insertWidget(0,self._editorSplitter) self.updateToolBarSizes() controller = self.controller() if controller: self.connect(self._minimizeButton, SIGNAL('clicked(bool)'), controller.minimizeEditor) self.connect(self._originalButton, SIGNAL('clicked(bool)'), controller.originalEditor) self.connect(self._maximizeButton, SIGNAL('clicked(bool)'), controller.maximizeEditor)
def __init__(self): super().__init__() gui.label(self.controlArea, self, "Spark DataFrame") self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.allSQLSelectWidgets.append(self) # set default settings self.domain = None self.queryFile = None self.query = '' self.lastQuery = None # self.loadSettings() if self.lastQuery is not None: self.query = self.lastQuery # query self.splitCanvas = QSplitter(QtCore.Qt.Vertical, self.mainArea) self.mainArea.layout().addWidget(self.splitCanvas) self.textBox = gui.widgetBox(self, 'SparkSQL') self.splitCanvas.addWidget(self.textBox) self.queryTextEdit = QPlainTextEdit(self.query, self) self.textBox.layout().addWidget(self.queryTextEdit) self.selectBox = gui.widgetBox(self.controlArea, "Select statement") self.selectBox.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) gui.button(self.selectBox, self, 'format SQL!', callback = self.format_sql, disabled = 0) gui.button(self.selectBox, self, 'execute!', callback = self.executeQuery, disabled = 0) # info self.infoBox = gui.widgetBox(self.controlArea, "Info") self.info = [] self.info.append(gui.label(self.infoBox, self, 'No data loaded.')) self.info.append(gui.label(self.infoBox, self, '')) self.resize(300, 300)
def __init__(self, settings, parent=None): super(MikiWindow, self).__init__(parent) self.setObjectName("mikiWindow") self.settings = settings self.notePath = settings.notePath ################ Setup core components ################ self.notesTree = MikiTree(self) self.notesTree.setObjectName("notesTree") self.initTree(self.notePath, self.notesTree) self.notesTree.sortItems(0, Qt.AscendingOrder) self.ix = None self.setupWhoosh() self.viewedList = QToolBar(self.tr('Recently Viewed'), self) self.viewedList.setIconSize(QSize(16, 16)) self.viewedList.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.viewedListActions = [] self.noteSplitter = QSplitter(Qt.Horizontal) self.dockIndex = QDockWidget("Index") self.dockSearch = QDockWidget("Search") self.searchEdit = QLineEdit() self.searchView = MikiSearch(self) self.searchTab = QWidget() self.dockToc = QDockWidget("TOC") self.tocTree = TocTree() self.dockAttachment = QDockWidget("Attachment") self.attachmentView = AttachmentView(self) self.notesEdit = MikiEdit(self) self.notesEdit.setObjectName("notesEdit") MikiHighlighter(self.notesEdit) self.notesView = MikiView(self) self.findBar = QToolBar(self.tr('Find'), self) self.findBar.setFixedHeight(30) self.findEdit = QLineEdit(self.findBar) self.checkBox = QCheckBox(self.tr('Match case'), self.findBar) self.statusBar = QStatusBar(self) self.statusLabel = QLabel(self) self.altPressed = False ################ Setup actions ################ self.actions = dict() self.setupActions() ################ Setup mainwindow ################ self.setupMainWindow() # show changelogs after upgrade mikidown if self.settings.version < __version__: self.changelogHelp() self.settings.qsettings.setValue("version", __version__)
def create_layout(self): self.setCentralWidget(self.dual_img_) splitter = QSplitter(Qt.Vertical) splitter.addWidget(self.corr_list_) splitter.addWidget(self.pair_list_) self.dock(splitter, Qt.LeftDockWidgetArea, title="Correspondences") wpanel = QWidget() hpanel = QHBoxLayout(wpanel) hpanel.addWidget(self.prev_button_) hpanel.addWidget(self.next_button_) hpanel.addWidget(self.status_msg_) hpanel.addStretch() wpanel.setLayout(hpanel) bot = self.dock(wpanel, Qt.BottomDockWidgetArea) bot.setFeatures(bot.features() & QDockWidget.NoDockWidgetFeatures)