def __init__(self, scheme, parent): super(EditorSchemeDesigner, self).__init__(parent, Qt.Dialog) self.original_style = copy.copy(resources.CUSTOM_SCHEME) self._avoid_on_loading = True self.saved = False self._components = {} self.setWindowTitle(translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER) self.setMinimumWidth(500) vbox = QVBoxLayout(self) scrollArea = QScrollArea() vbox.addWidget(scrollArea) frame = QFrame() vbox = QVBoxLayout() self._grid = QGridLayout() self._grid.addWidget(QLabel('Scheme Name:'), 0, 0) self.line_name = QLineEdit() self._grid.addWidget(self.line_name, 0, 1) btnSave = QPushButton('Save Scheme') self._grid.addWidget(btnSave, 0, 2) self._grid.addWidget(QLabel('Properties:'), 1, 0) self.connect(btnSave, SIGNAL("clicked()"), self.save_scheme) keys = sorted(list(resources.COLOR_SCHEME.keys())) for key in keys: self.add_item(key, scheme) vbox.addLayout(self._grid) frame.setLayout(vbox) scrollArea.setWidget(frame) self._avoid_on_loading = False self._modified = False
def load_ui(self): sections = sorted(list(Preferences.configuration.keys()), key=lambda item: Preferences.configuration[item]['weight']) for section in sections: text = Preferences.configuration[section]['text'] Widget = Preferences.configuration[section]['widget'] widget = Widget(self) area = QScrollArea() area.setWidgetResizable(True) area.setWidget(widget) index = self.stacked.addWidget(area) item = QTreeWidgetItem([text]) item.setData(0, Qt.UserRole, index) self.tree.addTopLevelItem(item) #Sort Item Children subcontent = Preferences.configuration[section].get( 'subsections', {}) subsections = sorted(list(subcontent.keys()), key=lambda item: subcontent[item]['weight']) for sub in subsections: text = subcontent[sub]['text'] Widget = subcontent[sub]['widget'] widget = Widget(self) area = QScrollArea() area.setWidgetResizable(True) area.setWidget(widget) index = self.stacked.addWidget(area) subitem = QTreeWidgetItem([text]) subitem.setData(0, Qt.UserRole, index) item.addChild(subitem) self.tree.expandAll()
class SimpleRichTypesDialog(QDialog): """Simple dialog to display and change RichTypes""" def __init__(self, parent=None, windowTitle='', scrolling=True, text=''): QDialog.__init__(self, parent) self.mainLayout = QVBoxLayout(self) self.textLabel = QLabel(self) self.textLabel.setText(text) self.mainLayout.addWidget(self.textLabel) if scrolling: self.scrollArea = QScrollArea(self) self.mainLayout.addWidget(self.scrollArea) self.richTypesWidget = RichTypesWidget(self.scrollArea) self.scrollArea.setWidget(self.richTypesWidget) self.scrollArea.setWidgetResizable(False) else: self.richTypesWidget = RichTypesWidget(self) self.mainLayout.addWidget(self.richTypesWidget) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.mainLayout.addWidget(self.buttonBox) QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.accept) QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.reject) self.setWindowTitle(windowTitle) self.result = None def addRichTypes(self, l): """set the list of richtypes""" self.richTypesWidget.addRichTypes(l) def accept(self): """after dialog closes, RichType list is available as self.result""" self.result = self.richTypesWidget.applyChanges() QDialog.accept(self)
def insertLayout(self): """ Reimplemented from OWWidget.insertLayout. Pull the OWWidget created controlArea and mainArea widgets into QScrollArea's. """ super().insertLayout() cls = type(self) if cls.want_basic_layout and cls.want_control_area: layout = self.leftWidgetPart.layout() area = QScrollArea() layout_insert(layout, area, before=self.controlArea) layout.takeAt(layout.indexOf(self.controlArea)) area.setWidget(self.controlArea) area.setWidgetResizable(True) if cls.want_basic_layout and cls.want_main_area: layout = self.topWidgetPart.layout() area = QScrollArea() layout_insert(layout, area, before=self.mainArea) layout.takeAt(layout.indexOf(self.mainArea)) area.setWidget(self.mainArea) area.setWidgetResizable(True)
class ViewAnimationForm(QWidget): def __init__(self, visualization, parent_widget=None): QWidget.__init__(self, parent_widget) self.inGui = False self.visualization = visualization size = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.widgetLayout = QGridLayout(self) self.setSizePolicy(size) self.scroll = QScrollArea() file_path = self.visualization.get_file_path() self.label = QLabel() movie = QMovie(QString(file_path), QByteArray(), self) movie.setCacheMode(QMovie.CacheAll) self.label.setMovie(movie) movie.start() self.scroll.setWidget(self.label) self.widgetLayout.addWidget(self.scroll) self.tabIcon = QIcon(":/Images/Images/map.png") self.tabLabel = visualization.table_name def removeElement(self): return True
def update(self): for i in range(self.layout().count()): self.layout().itemAt(0).widget().close() self.layout().takeAt(0) qsa = QScrollArea() scroll_area_widget = QWidget() layout = QVBoxLayout() scroll_area_widget.setLayout(layout) model = self.result.model cycles_per_ms = model.cycles_per_ms for proc in model.processors: proc_r = self.result.processors[proc] gb = QGroupBox(proc.name) gb_layout = QVBoxLayout() gb.setLayout(gb_layout) gb_layout.addWidget( QLabel("Cxt Save count: {}".format(proc_r.context_save_count))) gb_layout.addWidget( QLabel("Cxt Load count: {}".format(proc_r.context_load_count))) gb_layout.addWidget( QLabel("Cxt Save overhead: {0:.4f}ms ({1:.0f} cycles)".format( float(proc_r.context_save_overhead) / cycles_per_ms, proc_r.context_save_overhead))) gb_layout.addWidget( QLabel("Cxt Load overhead: {0:.4f}ms ({1:.0f} cycles)".format( float(proc_r.context_load_overhead) / cycles_per_ms, proc_r.context_load_overhead))) layout.addWidget(gb) qsa.setWidget(scroll_area_widget) self.layout().addWidget(qsa)
def __init__(self, items, parent, insertionMode=False): QScrollArea.__init__(self, parent) self._editor = parent self._items = items self._insertion_mode = insertionMode # Find all classes self._label_classes = set([item['class'] for item in items if 'class' in item]) n_classes = len(self._label_classes) LOG.debug("Creating editor for %d item classes: %s" % (n_classes, ", ".join(list(self._label_classes)))) # Widget layout self._layout = QVBoxLayout() self._content = QWidget() self._content.setLayout(self._layout) attributes = set() for lc in self._label_classes: attributes |= set(self._editor.getLabelClassAttributes(lc)) for attr in attributes: handler = self._editor.getHandler(attr) if handler is not None: if len(items) > 1: valid_items = [item for item in items if attr in self._editor.getLabelClassAttributes(item['class'])] handler.setItems(valid_items, True) else: handler.setItems(items) self._layout.addWidget(handler) self._layout.addWidget(handler) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setWidgetResizable(True) self.setWidget(self._content)
def generate_category_widget(symbolCategory, symbols, synchronizer): """ Generate the widget for a single symbolCategory. """ # layout for current tab currentWidget = QWidget() layout = SymbolSelectorGridLayout() currentWidget.setLayout(layout) # sort symbols in requested order rawList = [] for symbol in symbols: rawList.append((int(symbol["category_pos"]), symbol)) #rawList.sort(lambda x,y: cmp(x[0], y[0])) rawList.sort(key=(lambda x: x[0])) # add them to the tab widgetList = {} for (row, symbolEntry) in enumerate(rawList): symbol = symbolEntry[1] newItem = SymbolSelectorItem(symbol, synchronizer) newLabel = SymbolSelectorLabel(symbol) layout.append_row(newItem, newLabel) QObject.connect(newLabel, SIGNAL("label_clicked()"), newItem.click_me) widgetList[(symbol["name"], symbol["category"])] = newItem scrollArea = QScrollArea() scrollArea.setWidget(currentWidget) return (scrollArea, widgetList)
def _add_component_boxes(self): # ECU Box self.ecu_box_wid = QScrollArea() wid = QWidget() self.ecu_box_wid.setWidget(wid) self.ecu_box_wid.setWidgetResizable(True) self.ecu_box = QGridLayout() wid.setLayout(self.ecu_box) self.ecu_box_wid_wid = wid self.comps_layout.addWidget(self.ecu_box_wid) # Bus Box self.bus_box_wid = QScrollArea() wid = QWidget() self.bus_box_wid.setWidget(wid) self.bus_box_wid.setWidgetResizable(True) self.bus_box = QGridLayout() wid.setLayout(self.bus_box) self.bus_box_wid_wid = wid self.comps_layout.addWidget(self.bus_box_wid) # Others Box self.others_box_wid = QScrollArea() wid = QWidget() self.others_box_wid.setWidget(wid) self.others_box_wid.setWidgetResizable(True) self.others_box = QGridLayout() wid.setLayout(self.others_box) self.others_box_wid_wid = wid self.comps_layout.addWidget(self.others_box_wid)
def __init__( self, parent ): QScrollArea.__init__( self, parent ) #self.setFrameShape( QScrollArea.NoFrame ) self.setAutoFillBackground( False ) self.setWidgetResizable( True ) self.setMouseTracking(True) self.verticalScrollBar().setMaximumWidth(10) # from PyQt4.QtGui import QWidget widget = QWidget( self ) # define custom properties self._rolloutStyle = AccordianWidget.Rounded self._dragDropMode = AccordianWidget.NoDragDrop self._scrolling = False self._scrollInitY = 0 self._scrollInitVal = 0 self._itemClass = AccordianItem # create the layout # from PyQt4.QtGui import QVBoxLayout layout = QVBoxLayout() layout.setContentsMargins( 3, 3, 3, 3 ) layout.setSpacing( 3 ) layout.addStretch(1) widget.setLayout( layout ) self.setWidget( widget )
def build_post_processor_form(self, form_elements): """Build Post Processor Tab. :param form_elements: A Dictionary containing element of form. :type form_elements: dict """ scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) main_layout = QVBoxLayout() main_layout.addWidget(scroll) main_widget = QWidget() main_widget.setLayout(main_layout) self.tabWidget.addTab(main_widget, self.tr('Postprocessors')) self.tabWidget.tabBar().setVisible(True) # create elements for the tab values = OrderedDict() for label, parameters in form_elements.items(): parameter_container = ParameterContainer(parameters) parameter_container.setup_ui(must_scroll=False) scroll_layout.addWidget(parameter_container) input_values = parameter_container.get_parameters values[label] = input_values self.values['postprocessors'] = values scroll_layout.addStretch()
def build_minimum_needs_form(self, parameters): """Build minimum needs tab. :param parameters: A list containing element of form :type parameters: list """ # create minimum needs tab scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) main_layout = QVBoxLayout() main_layout.addWidget(scroll) main_widget = QWidget() main_widget.setLayout(main_layout) extra_parameters = [(ResourceParameter, ResourceParameterWidget)] parameter_container = ParameterContainer( parameters=parameters, extra_parameters=extra_parameters) parameter_container.setup_ui() scroll_layout.addWidget(parameter_container) self.tabWidget.addTab(main_widget, self.tr('Minimum Needs')) self.tabWidget.tabBar().setVisible(True) self.values['minimum needs'] = parameter_container.get_parameters
def __init__(self, parent=None): super(MikidownCfgDialog, self).__init__(parent) #tab = QWidget() #tab2 = QWidget() self.setWindowTitle(self.tr("Settings - mikidown")) self.recentNotesCount = QSpinBox() recent_notes_n = Mikibook.settings.value('recentNotesNumber',type=int, defaultValue=20) self.recentNotesCount.setValue(recent_notes_n) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.hltCfg = MikidownHighlightCfgWidget(parent=self) self.tabWidth = QSpinBox(self) self.tabWidth.setRange(2, 8) self.tabWidth.setSingleStep(2) self.iconTheme = QLineEdit(self) self.iconTheme.setText(Mikibook.settings.value('iconTheme', QIcon.themeName())) self.editorFont = QFontButton(parent=self) fontval = QFont() fontfam = Mikibook.settings.value('editorFont', defaultValue=None) fontsize = Mikibook.settings.value('editorFontSize', type=int, defaultValue=12) if fontfam is not None: fontval.setFamily(fontfam) fontval.setPointSize(fontsize) self.headerScalesFont = QCheckBox(self) if Mikibook.settings.value('headerScaleFont', type=bool, defaultValue=True): self.headerScalesFont.setCheckState(Qt.Checked) else: self.headerScalesFont.setCheckState(Qt.Unchecked) self.editorFont.font = fontval self.tabWidth.setValue(Mikibook.settings.value('tabWidth', type=int, defaultValue=4)) self.tabToSpaces = QCheckBox(self) if Mikibook.settings.value('tabInsertsSpaces', type=bool, defaultValue=True): self.tabToSpaces.setCheckState(Qt.Checked) else: self.tabToSpaces.setCheckState(Qt.Unchecked) layout = QGridLayout(self) layout.addWidget(QLabel(self.tr("# of recently viewed notes to keep")),0,0,1,1) layout.addWidget(self.recentNotesCount,0,1,1,1) layout.addWidget(QLabel(self.tr("Editor font")), 1, 0, 1, 1) layout.addWidget(self.editorFont, 1, 1, 1, 1) layout.addWidget(QLabel(self.tr("Header rank scales editor font?")), 2, 0, 1, 1) layout.addWidget(self.headerScalesFont, 2, 1, 1, 1) qs = QScrollArea(self) qs.setWidget(self.hltCfg) layout.addWidget(QLabel(self.tr("Tabs expand to spaces?")), 3, 0, 1, 1) layout.addWidget(self.tabToSpaces, 3, 1, 1, 1) layout.addWidget(QLabel(self.tr("Tab width")), 4, 0, 1, 1) layout.addWidget(self.tabWidth, 4, 1, 1, 1) layout.addWidget(QLabel(self.tr("Icon Theme")),5,0,1,1) layout.addWidget(self.iconTheme,5,1,1,1) layout.addWidget(qs,6,0,1,2) layout.addWidget(self.buttonBox,7,0,1,2) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject)
def __init__(self, items, parent, insertionMode=False): QScrollArea.__init__(self, parent) self._editor = parent self._items = items self._insertion_mode = insertionMode # Find all classes self._label_classes = set([item['class'] for item in items if 'class' in item]) n_classes = len(self._label_classes) LOG.debug("Creating editor for %d item classes: %s" % (n_classes, ", ".join(list(self._label_classes)))) # Widget layout self._layout = QVBoxLayout() self._content = QWidget() self._content.setLayout(self._layout) attributes = set() for lc in self._label_classes: attributes |= set(self._editor.getLabelClassAttributes(lc)) for attr in attributes: handler = self._editor.getHandler(attr) if handler is not None: if len(items) > 1: valid_items = [item for item in items if attr in self._editor.getLabelClassAttributes(item['class'])] handler.setItems(valid_items, True) else: handler.setItems(items) self._layout.addWidget(handler) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setWidgetResizable(True) self.setWidget(self._content)
def __init__(self, base): Window.__init__(self, base, i18n.get('image_preview')) self.loader = BarLoadIndicator() self.view = QLabel() self.view.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.view.setScaledContents(True) scroll_area = QScrollArea() scroll_area.setBackgroundRole(QPalette.Dark) scroll_area.setWidget(self.view) scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.error_label = QLabel(i18n.get('error_loading_image')) self.error_label.setAlignment(Qt.AlignHCenter) self.error_label.setStyleSheet("QLabel {background-color: #ffecec;}") layout = QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.loader) layout.addWidget(self.error_label) layout.addWidget(scroll_area) self.setLayout(layout) self.__clear()
def _create_translators_tab(self): translators = [ (_('Catalan'), [u'Jaume Barcelo']), (_('German'), []), (_('Galician'), [u'Jesús Arias Fisteus']), (_('French'), []), (_('Portuguese'), []), (_('Spanish'), [u'Jesús Arias Fisteus']), ] parts = [] for language, names in sorted(translators, cmp=DialogAbout._tuple_strcoll): if names: parts.append(u'<p><b>{0}:</b></p>'.format(language)) parts.append(u'<ul>') for name in names: parts.append(u'<li>{0}</li>'.format(name)) parts.append(u'</ul>') label = QLabel(u''.join(parts)) label.setTextInteractionFlags((Qt.LinksAccessibleByKeyboard | Qt.LinksAccessibleByMouse | Qt.TextBrowserInteraction | Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse)) scroll_area = QScrollArea(self.parent()) scroll_area.setWidget(label) return scroll_area
def __init__(self, zeros): """ Constructor """ QDialog.__init__(self) self.__zeros = zeros self.setWindowTitle(QCoreApplication.translate("VDLTools", "Zeros")) self.__layout = QGridLayout() self.__zeroLabels = [] self.__zeroChecks = [] displayButton = False self.__scrollLayout = QGridLayout() for i in range(len(self.__zeros)): msg = "- vertex " + str(self.__zeros[i][0]) msg += QCoreApplication.translate("VDLTools", ", elevation : '0', ") if self.__zeros[i][1] is not None: msg += QCoreApplication.translate("VDLTools", "interpolated elevation : ") msg += str(self.__zeros[i][1]) + "m" if self.__zeros[i][2] > 1: msg += QCoreApplication.translate("VDLTools", " (and apply to point)") msgCheck = QCheckBox() msgCheck.setChecked(True) self.__zeroChecks.append(msgCheck) self.__scrollLayout.addWidget(self.__zeroChecks[i], i+1, 2) displayButton = True else: msg += QCoreApplication.translate("VDLTools", "no interpolated elevation") self.__zeroChecks.append(None) zeroLabel = QLabel(msg) self.__zeroLabels.append(zeroLabel) self.__scrollLayout.addWidget(self.__zeroLabels[i], i+1, 0, 1, 2) widget = QWidget() widget.setLayout(self.__scrollLayout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(widget) self.__layout.addWidget(scroll, 1, 0, 1, 2) self.__passButton = QPushButton(QCoreApplication.translate("VDLTools", "Pass")) self.__passButton.setMinimumHeight(20) self.__passButton.setMinimumWidth(100) pos = len(self.__zeros) + 1 self.__layout.addWidget(self.__passButton, pos, 0) self.__applyButton = QPushButton(QCoreApplication.translate("VDLTools", "Apply interpolation")) self.__applyButton.setMinimumHeight(20) self.__applyButton.setMinimumWidth(100) if displayButton: self.__layout.addWidget(self.__applyButton, pos, 1) self.setLayout(self.__layout)
class ViewAnimationForm(QWidget): def __init__(self, visualization, parent_widget = None): QWidget.__init__(self, parent_widget) self.inGui = False self.visualization = visualization size = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.widgetLayout = QGridLayout(self) self.setSizePolicy(size) self.scroll = QScrollArea() file_path = self.visualization.get_file_path() self.label = QLabel() movie = QMovie(QString(file_path), QByteArray(), self) movie.setCacheMode(QMovie.CacheAll) self.label.setMovie(movie) movie.start() self.scroll.setWidget(self.label) self.widgetLayout.addWidget(self.scroll) self.tabIcon = QIcon(":/Images/Images/map.png") self.tabLabel = visualization.table_name def removeElement(self): return True
def build_form(self, parameters): """Build a form from impact functions parameter. .. note:: see http://tinyurl.com/pyqt-differences :param parameters: Parameters to be edited """ scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) self.configLayout.addWidget(scroll) for key, value in parameters.items(): if key == 'postprocessors': self.build_post_processor_form(value) elif key == 'minimum needs': self.build_minimum_needs_form(value) else: self.build_widget(scroll_layout, key, value) if scroll_layout.count() == 0: # Rizky: in case empty impact function, let's show some messages label = QLabel() message = tr('This impact function does not have any options to ' 'configure') label.setText(message) scroll_layout.addWidget(label) scroll_layout.addStretch()
def __init__(self): super().__init__() self.last_total = 24763 self.networks = [] self.tables = [] image = QPixmap(os.path.dirname(__file__) + "/icons/snap_logo.png") imageLabel = QLabel(self) imageLabel.setPixmap(image) self.controlArea.layout().addWidget(imageLabel) self.controlArea.layout().addStretch(1) lbl = QLabel("<a href='http://snap.stanford.edu/data/'>http://snap.stanford.edu/data</a>", self) lbl.setOpenExternalLinks(True) self.controlArea.layout().addWidget(lbl) scrollArea = QScrollArea(self.mainArea) self.mainArea.layout().addWidget(scrollArea) self.network_list = gui.widgetBox(self.mainArea, addToLayout=False) self.network_list.layout().setSizeConstraint(QLayout.SetFixedSize); scrollArea.setWidget(self.network_list); self.snap = network.snap.SNAP() self.snap.get_network_list(self.add_tables, self.progress_callback) self.progressBarInit() self.setMinimumSize(960, 600)
def createWidgets(self): """ QtWidgets creation """ self.dockToolbar = QToolBar(self) self.dockToolbar.setStyleSheet( "QToolBar { border: 0px }") # remove 3D border self.imageLabel = QLabel(self) self.imageLabel.setBackgroundRole(QPalette.Base) self.imageLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.imageLabel.setScaledContents(True) self.scrollArea = QScrollArea() self.scrollArea.setBackgroundRole(QPalette.Dark) self.scrollArea.setWidget(self.imageLabel) title = QLabel("Image:") title.setStyleSheet("QLabel { padding-left: 2px; padding-top: 2px }") font = QFont() font.setBold(True) title.setFont(font) layout = QVBoxLayout() layout.addWidget(title) layout.addWidget(self.dockToolbar) layout.addWidget(self.scrollArea) layout.setContentsMargins(2, 2, 2, 2) self.setLayout(layout)
def __init__(self, parent = None, direction = "ltr", rtf = False): """ Creates a new QPageWidget on given parent object. parent: QWidget parent direction: "ltr" -> Left To Right "ttb" -> Top To Bottom rtf: Return to first, if its True it flips to the first page when next page requested at the last page """ # First initialize, QPageWidget is based on QScrollArea QScrollArea.__init__(self, parent) # Properties for QScrollArea self.setFrameShape(QFrame.NoFrame) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setWidgetResizable(True) # Main widget, which stores all Pages in it self.widget = QWidget(self) # Layout based on QBoxLayout which supports Vertical or Horizontal layout if direction == "ltr": self.layout = QBoxLayout(QBoxLayout.LeftToRight, self.widget) self.__scrollBar = self.horizontalScrollBar() self.__base_value = self.width else: self.layout = QBoxLayout(QBoxLayout.TopToBottom, self.widget) self.__scrollBar = self.verticalScrollBar() self.__base_value = self.height self.layout.setSpacing(0) self.layout.setMargin(0) # Return to first self.__return_to_first = rtf # TMP_PAGE, its using as last page in stack # A workaround for a QScrollArea bug self.__tmp_page = Page(QWidget(self.widget)) self.__pages = [self.__tmp_page] self.__current = 0 self.__last = 0 # Set main widget self.setWidget(self.widget) # Animation TimeLine self.__timeline = QTimeLine() self.__timeline.setUpdateInterval(2) # Updates scrollbar position when frame changed self.__timeline.frameChanged.connect(lambda x: self.__scrollBar.setValue(x)) # End of the animation self.__timeline.finished.connect(self._animateFinished) # Initialize animation self.setAnimation() self.setDuration()
def setupScrollArea(self): self.scrollArea = QScrollArea(self) self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.scrollArea.setMaximumWidth(530) self.scrollArea.setMinimumHeight(600) self.scrollArea.setWidgetResizable(False) self.scrollArea.setWidget(self.containerWidget)
def setChildWidget(self, widget, wrap, row, col, rowspan = 1, colspan = 1): if wrap: scrollArea = QScrollArea() scrollArea.setWidget(widget) scrollArea.setWidgetResizable(True); self.layout().addWidget(scrollArea, row, col, rowspan, colspan) else: self.addWidget(widget)
def create_scrolled_panel ( self, parent ): """ Returns a panel that can scroll its contents. """ sa = QScrollArea( check_parent( parent ) ) sa.setFrameShape( QFrame.NoFrame ) sa.setWidgetResizable( True ) return control_adapter_for( sa )
def keyPressEvent( self, event ): """ Handles the key press events """ if event.key() == Qt.Key_Escape: self.escapePressed.emit() event.accept() else: QScrollArea.keyPressEvent( self, event ) return
def __init__(self, dialog): super(ScrolledPage, self).__init__(dialog) layout = QVBoxLayout(margin=0, spacing=0) self.setLayout(layout) scrollarea = QScrollArea(frameWidth=0, frameShape=QScrollArea.NoFrame) layout.addWidget(scrollarea) self.scrolledWidget = QWidget(scrollarea) scrollarea.setWidget(self.scrolledWidget) scrollarea.setWidgetResizable(True)
def setTracks(self, tracks): if not self._first_display: self._removeOldWidgets() self._first_display = False self._widgets = {} parent = QWidget(self) l = QVBoxLayout(parent) for track in tracks: w = self._createTrackProgress(parent, track) l.addWidget(w) self._widgets[track['id']] = w l.addStretch(1) parent.setLayout(l) scroll = QScrollArea(self) scroll.setWidgetResizable(True) scroll.setWidget(parent) scroll.setAlignment(Qt.AlignCenter) scroll.setFrameShape(QFrame.NoFrame); l = QVBoxLayout(self) l.addWidget(scroll) l.addWidget(self.close_button) self.setLayout(l) self.close_button.setEnabled(False)
def __init__(self, names): """ Constructor """ QDialog.__init__(self) self.__names = names self.setWindowTitle(QCoreApplication.translate("VDLTools", "Choose Controls")) self.__layout = QGridLayout() self.__confirmLabel = QLabel( QCoreApplication.translate("VDLTools", "Choose which controls you want to process :")) self.__layout.addWidget(self.__confirmLabel, 0, 0, 1, 2) self.__group = QButtonGroup() self.__controlsLabels = [] self.__controlsChecks = [] self.__scrollLayout = QGridLayout() for i in range(len(self.__names)): label = QLabel(self.__names[i]) label.setMinimumHeight(20) label.setMinimumWidth(50) self.__controlsLabels.append(label) self.__scrollLayout.addWidget(self.__controlsLabels[i], i+1, 0) check = QCheckBox() check.setChecked(False) self.__controlsChecks.append(check) self.__scrollLayout.addWidget(self.__controlsChecks[i], i+1, 1) widget = QWidget() widget.setLayout(self.__scrollLayout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(widget) self.__layout.addWidget(scroll, 1, 0, 1, 2) self.__okButton = QPushButton(QCoreApplication.translate("VDLTools", "Ok")) self.__okButton.setMinimumHeight(20) self.__okButton.setMinimumWidth(100) self.__cancelButton = QPushButton(QCoreApplication.translate("VDLTools", "Cancel")) self.__cancelButton.setMinimumHeight(20) self.__cancelButton.setMinimumWidth(100) self.__layout.addWidget(self.__okButton, 100, 0) self.__layout.addWidget(self.__cancelButton, 100, 1) self.setLayout(self.__layout)
def _set_expander(self): """Set the expander widget.""" self.ssl_text = QTextEdit() self.ssl_text.setText(self.details) scroll_area = QScrollArea() scroll_area.setViewport(self.ssl_text) scroll_area.setFixedHeight(50) self.expander = QExpander(SSL_CERT_DETAILS) self.expander.addWidget(scroll_area) self.ui.expander_layout.insertWidget(2, self.expander)
def setupGUI(self): self.scrollArea = QScrollArea(self) self.scrollArea.setWidgetResizable(True) self.aWidget = QWidget(self.scrollArea) self._main_layout = QGridLayout(self.aWidget) self.aWidget.setMinimumSize(480, 800) self.aWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.scrollArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.scrollArea.setWidget(self.aWidget) try: scroller = self.scrollArea.property( "kineticScroller") #.toPyObject() scroller.setEnabled(True) except: pass gridIndex = 0 self._main_layout.addWidget(QLabel('Font :'), gridIndex, 0) gridIndex += 1 self.fontName = QFontComboBox() self._main_layout.addWidget(self.fontName, gridIndex, 0) gridIndex += 1 self.fontSize = QSpinBox() self._main_layout.addWidget(self.fontSize, gridIndex, 0) gridIndex += 1 self._main_layout.addWidget(QLabel('Plugins :'), gridIndex, 0) gridIndex += 1 init_plugin_system() self.plugins_widgets = [] for plugin in find_plugins(): aCheckBox = QCheckBox(plugin.__name__ + ' ' + plugin.__version__) self.plugins_widgets.append(aCheckBox) self._main_layout.addWidget(aCheckBox, gridIndex, 0) gridIndex += 1 self._main_layout.addWidget(QLabel('Others preferences :'), gridIndex, 0) gridIndex += 1 self.wrapLine = QCheckBox('Wrap Lines') self._main_layout.addWidget(self.wrapLine, gridIndex, 0) gridIndex += 1 self.qt18720 = QCheckBox('Work Arround QTBUG-18720') self._main_layout.addWidget(self.qt18720, gridIndex, 0) gridIndex += 1 self.aWidget.setLayout(self._main_layout) self.setCentralWidget(self.scrollArea)
def __init__(self, weboob, parent=None): QScrollArea.__init__(self, parent) self.weboob = weboob self.setFrameShadow(self.Plain) self.setFrameShape(self.NoFrame) self.setWidgetResizable(True) widget = QWidget(self) widget.setLayout(QVBoxLayout()) widget.show() self.setWidget(widget)
def __init__(self, parent=None): QScrollArea.__init__(self, parent) self.s = 100 self.setMinimumSize(0, 0) self.__max = 250 self.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)) self.__w = QWidget() self.setWidget(self.__w) self.setWidgetResizable(True) self.__w.setLayout(QVBoxLayout()) self.__w.layout().setContentsMargins(0, 0, 0, 0) self.setFrameShape(QFrame.NoFrame) self.__recalcSize()
class CentralWidget(QWidget): def __init__(self, parent): super().__init__(parent) self.h_box_layout = QHBoxLayout() self.setLayout(self.h_box_layout) self.board = GOBoard() self.nodes_widget = NodesWidget() self.button_bar = ButtonBar() self.scroll_area = QScrollArea() self.scroll_area.setWidget(self.nodes_widget) self.h_box_layout.addWidget(self.board) self.h_box_layout.addWidget(self.scroll_area) self.h_box_layout.addWidget(self.button_bar)
def __init__(self): QScrollArea.__init__(self) self.setWidgetResizable(True) scroll_widget = QWidget() self.scroll_box_layout = QVBoxLayout(scroll_widget) self.setWidget(scroll_widget) self.scroll_box_layout.setSpacing(2) self.scroll_box_layout.setMargin(2) self.scroll_box_layout.setAlignment(Qt.AlignTop) self.scroll_box_layout.setSizeConstraint(QtGui.QLayout.SetMaximumSize)
def __init__(self): """ Constructor """ QDialog.__init__(self) self.setWindowTitle(QCoreApplication.translate("VDLTools", "Edition Confirmation")) self.__layout = QGridLayout() self.__confirmLabel = QLabel( QCoreApplication.translate("VDLTools", "This LineString layer is not editable, what do you want to do ?")) self.__layout.addWidget(self.__confirmLabel, 0, 0, 1, 2) self.__radios = [] self.__radios.append(QRadioButton( QCoreApplication.translate("VDLTools", "Create point, and edit line with new vertex"))) self.__radios.append(QRadioButton(QCoreApplication.translate("VDLTools", "Create only the point"))) self.__radios.append(QRadioButton(QCoreApplication.translate("VDLTools", "Just edit line with new vertex"))) self.__scrollLayout = QGridLayout() self.__radios[0].setChecked(True) self.__radio_button_group = QButtonGroup() for i in range(len(self.__radios)): self.__scrollLayout.addWidget(self.__radios[i], i+1, 0, 1, 2) self.__radio_button_group.addButton(self.__radios[i], i) widget = QWidget() widget.setLayout(self.__scrollLayout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(widget) self.__layout.addWidget(scroll, 1, 0, 1, 2) self.__okButton = QPushButton(QCoreApplication.translate("VDLTools", "OK")) self.__okButton.setMinimumHeight(20) self.__okButton.setMinimumWidth(100) self.__layout.addWidget(self.__okButton, 4, 0) self.__cancelButton = QPushButton(QCoreApplication.translate("VDLTools", "Cancel")) self.__cancelButton.setMinimumHeight(20) self.__cancelButton.setMinimumWidth(100) self.__layout.addWidget(self.__cancelButton, 4, 1) self.setLayout(self.__layout)
def newTab(self,name=None): scroll = QScrollArea(self) if name == None: name = "modelo_"+str(len(self.models)) i=1 while name in [ m.name for m in self.models ]: name = "modelo_"+str(len(self.models)+i) i+=1 self.models.append(DropFrame(name, self)) self.models[-1].setGeometry(0,0,3000,2000) scroll.setWidget(self.models[-1]) self.addTab(scroll, self.models[-1].name) self.empty = False