Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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()
Пример #4
0
    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)
Пример #5
0
 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
Пример #6
0
 def __init__(self,
              config,
              parent,
              replication_checkbox=False,
              segmentation_checkbox=False):
     QDialog.__init__(self)
     self.setStyleSheet(parent.styleSheet())
     self.setWindowTitle("Method Settings")
     self.data = config
     self.ui = {}
     self.area = QScrollArea()
     self.widget = QWidget()
     l = self._parseConfig(self.data, self.ui)
     self.widget.setLayout(l)
     self.area.setWidget(self.widget)
     self.area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
     self.layout = QVBoxLayout()
     self.layout.addWidget(self.area)
     if replication_checkbox:
         self.replication_checkbox = QCheckBox(self.tr("Allow replication"))
         self.layout.addWidget(self.replication_checkbox)
     if segmentation_checkbox:
         self.segmentation_checkbox = QCheckBox(
             self.tr("Generate assegnments in segments"))
         self.layout.addWidget(self.segmentation_checkbox)
     self.buttons = QHBoxLayout()
     self.ok = QPushButton("OK")
     self.cancel = QPushButton("Cancel")
     self.buttons.addWidget(self.ok)
     self.buttons.addWidget(self.cancel)
     self.layout.addLayout(self.buttons)
     self.setLayout(self.layout)
     QObject.connect(self.ok, SIGNAL("clicked()"), self.OK)
     QObject.connect(self.cancel, SIGNAL("clicked()"), self.Cancel)
Пример #7
0
 def buildRouter(self, servername, path):
     self.router = CrossbarRouter(servername, path, self)
     self.router.MixerRoutingChanged.connect(self.mixer.updateRouting)
     scrollarea = QScrollArea(self.tabs)
     scrollarea.setWidgetResizable(True)
     scrollarea.setWidget(self.router)
     return scrollarea
Пример #8
0
    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)
Пример #9
0
    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)
Пример #10
0
    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()
Пример #11
0
    def __init__(self, parent, model, result):
        QWidget.__init__(self, parent)
        self.setLayout(QVBoxLayout())

        scrollArea = QScrollArea(self)
        self.layout().addWidget(scrollArea)
        scrollArea.setWidgetResizable(True)

        viewport = QToolBox()
        scrollArea.setWidget(viewport)

        self.computationTimeGroup = ComputationTimeTable(result)
        self.preemptionsGroup = InformationTable(
            result, 'preemption_count', ['min', 'avg', 'max', 'sum'])
        self.migrationsGroup = InformationTable(
            result, 'migration_count', ['min', 'avg', 'max', 'sum'])
        self.taskMigrationsGroup = TaskMigrationTable(result)
        self.responseTimeGroup = InformationTable(
            result, 'response_time', ['min', 'avg', 'max', 'std dev'],
            map_=lambda x: x / float(model.cycles_per_ms))

        viewport.addItem(self.computationTimeGroup, "Computation time:")
        viewport.addItem(self.preemptionsGroup, "Preemptions:")
        viewport.addItem(self.migrationsGroup, "Migrations:")
        viewport.addItem(self.taskMigrationsGroup, "Task migrations:")
        viewport.addItem(self.responseTimeGroup, "Response time:")
Пример #12
0
 def __init__(self, config, parent):
     QDialog.__init__(self)
     self.setStyleSheet(parent.styleSheet())
     self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint
                         | Qt.CustomizeWindowHint)
     self.setWindowTitle(" ")
     self.data = config
     self.ui = {}
     self.area = QScrollArea()
     self.widget = QWidget()
     l = self._parseConfig(self.data, self.ui)
     self.widget.setLayout(l)
     self.area.setWidget(self.widget)
     self.area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
     self.layout = QVBoxLayout()
     self.layout.addWidget(self.area)
     self.buttons = QHBoxLayout()
     self.ok = QPushButton("OK")
     self.cancel = QPushButton("Cancel")
     self.buttons.addWidget(self.ok)
     self.buttons.addWidget(self.cancel)
     self.layout.addLayout(self.buttons)
     self.setLayout(self.layout)
     QObject.connect(self.ok, SIGNAL("clicked()"), self.OK)
     QObject.connect(self.cancel, SIGNAL("clicked()"), self.Cancel)
Пример #13
0
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)
Пример #14
0
    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
Пример #15
0
 def _initialize(self):
     ## self.paramTPerm = self.field("paramTPerm")
     self.tabs.clear()
     self.total_answers = 0
     self.radioGroups = {}
     filas = int(self.paramNPerm.toString())
     for x in range(filas):
         mygroupbox = QScrollArea()
         mygroupbox.setWidget(QWidget())
         mygroupbox.setWidgetResizable(True)
         myform = QHBoxLayout(mygroupbox.widget())
         cols = self.paramNCols.toString().split(',')
         ansID = 0
         radioGroupList = {}
         for col in cols:
             mygroupboxCol = QGroupBox()
             myformCol = QFormLayout()
             mygroupboxCol.setLayout(myformCol)
             for y in range(int(col)):
                 ansID += 1
                 radioGroupList[ansID] = QButtonGroup()
                 layoutRow = QHBoxLayout()
                 for j in range(int(self.paramNAlts.toString())):
                     myradio = QRadioButton(chr(97 + j).upper())
                     layoutRow.addWidget(myradio)
                     radioGroupList[ansID].addButton(myradio)
                 self.total_answers += 1
                 myformCol.addRow(str(ansID), layoutRow)
             myform.addWidget(mygroupboxCol)
         self.radioGroups[chr(97 + x).upper()] = radioGroupList
         self.tabs.addTab(mygroupbox, _('Model ') + chr(97 + x).upper())
Пример #16
0
    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
Пример #17
0
    def initUI(self):
        self.topFiller = QTextEdit()
        self.topFiller.setReadOnly(True)
        self.topFiller.setMinimumSize(1000, 1000)

        text = self.scell_name + u" 的不对称小区有: " + str(self.count1) \
               + u" 个,对称小区有: " + str(self.count2) + u" 个" + u"\n\n"
        for (i, info) in enumerate(self.info_list):
            text = text + info + u"\n"
        self.topFiller.setText(text)

        scroll = QScrollArea()
        scroll.setWidget(self.topFiller)
        scroll.setAutoFillBackground(True)
        scroll.setWidgetResizable(True)

        hbox = QHBoxLayout()
        ok = QPushButton(u"确定")
        self.connect(ok, SIGNAL('clicked()'), self.accept)
        hbox.addStretch(1)
        hbox.addWidget(ok)
        hbox.addStretch(1)

        vbox = QVBoxLayout()
        vbox.addWidget(scroll)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
        self.setWindowTitle(u"所选服务小区信息")
        self.resize(680, 320)
Пример #18
0
    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()
Пример #19
0
    def setupUi(self, label_list):
        self.setWindowTitle('批量修改')

        layout = QVBoxLayout()
        self.setLayout(layout)
        temp_layout = QtGui.QHBoxLayout()
        self.spin_box = QtGui.QSpinBox()
        self.spin_box.setMinimum(0)
        self.spin_box.setMaximum(255)
        self.modify_btn = QPushButton('批量修改')
        self.modify_btn.clicked.connect(self.all_modify)
        temp_layout.addWidget(self.spin_box)
        temp_layout.addWidget(self.modify_btn)
        layout.addLayout(temp_layout)
        self.all_check_box = QtGui.QCheckBox('全选')
        self.all_check_box.stateChanged.connect(self.all_check)
        layout.addWidget(self.all_check_box)

        self._parea = QWidget()
        self._classbox = QScrollArea()
        self._classbox_layout = QVBoxLayout()
        self._parea.setLayout(self._classbox_layout)
        self._parea.setGeometry(0, 0, len(label_list) * 50, 300)
        self._classbox.setWidget(self._parea)
        self._classbox.setGeometry(0, 0, 200, 200)

        layout.addWidget(self._classbox)

        self.class_check = {}
        for label in label_list:
            self.class_check[label] = QtGui.QCheckBox(label)
            self._classbox_layout.addWidget(self.class_check[label])
            self.class_check[label].stateChanged.connect(self.change_all)
Пример #20
0
    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()
Пример #21
0
 def setPDFLabelScrollArea(self):
     self.pdfLabel = PDFLabel(self)
     self.scrollArea = QScrollArea()
     self.scrollArea.setWidgetResizable(True)
     self.scrollArea.setAlignment(Qt.AlignCenter)
     self.scrollArea.setWidget(self.pdfLabel)
     self.hboxLayout.addWidget(self.scrollArea)
Пример #22
0
    def setupUi(self):
        layout = QVBoxLayout()
        self.setLayout(layout)
        json_conf = Main.get_json()
        label_list = []
        for current_json in json_conf:
            label_list.append(current_json['attributes']['class'])

        self._parea = QWidget()
        self._classbox = QScrollArea()
        self._classbox_layout = QVBoxLayout()
        self._parea.setLayout(self._classbox_layout)
        self._parea.setGeometry(0, 0, len(label_list) * 35, 400)
        self._classbox.setWidget(self._parea)
        self._classbox.setGeometry(0, 0, 200, 300)

        layout.addWidget(self._classbox)

        self.class_check = {}
        for label in label_list:
            self.class_check[label] = QtGui.QCheckBox(label)
            self._classbox_layout.addWidget(self.class_check[label])

        self.ok_btn = QPushButton('确认')
        self.ok_btn.clicked.connect(self.close)
        layout.addWidget(self.ok_btn)
Пример #23
0
 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)
Пример #24
0
 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)
Пример #25
0
 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)
Пример #26
0
    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)
Пример #27
0
 def setCurrentWidget(self):
     config = self.ppModules().config(self.moduleName)
     configCurrentWidget = self.configWidget(
         self.loader.modules[self.moduleName], config)
     scroll = QScrollArea(self)
     scroll.setWidgetResizable(True)
     scroll.setWidget(configCurrentWidget)
     configCurrentWidget.setAutoFillBackground(False)
     self.currentWidget = scroll
Пример #28
0
 def __init__(self, sid, title, header, body, footer, formarts, columns,  parent=None):
     super(TableProfile, self).__init__(parent)
     #page setup
     self.setGeometry(100, 100, 700, 700)
     self.textStyle = "background-color: white; color:black; border: 3px ridge #ccc"
     self.minW = 670
     self.maxW = 700
     self.sid = sid
     self.header = header
     self.body = body
     self.footer = footer
     self.formarts = formarts
     self.title = title
     self.columns = [x + 1 for x in columns]
     self.hold = self.columns
     cn = Db()
     self.myterms = cn.getTermClass(self.sid)
     menu = self.menuUi()
     
     self.h1_box = QVBoxLayout()
     
     self.bioText = QTextEdit(self)
     self.bioText.setMinimumWidth(self.minW)
     self.bioText.setMinimumHeight(self.maxW)
     self.bioText.setMaximumHeight(self.maxW)
     btext = self.buildBio()
     self.bioText.insertHtml(btext)
     self.bioText.setStyleSheet(self.textStyle)
     self.h1_box.addWidget(self.bioText)
     self.h1_box.setSizeConstraint(QLayout.SetFixedSize)
     self.doc1 = self.bioText
     
     scrollArea = QScrollArea(self)
     scrollArea.setWidgetResizable(True)
     scrollArea.setFixedHeight(700)
     scrollArea.setFixedWidth(700)
     
     bioProfileWidget = QWidget()
     bioProfileWidget.setLayout(self.h1_box)
     #Main layout
     Hbox = QVBoxLayout()
     Hbox.addWidget(menu)
     Hbox.addStretch()
     Hbox.addWidget(bioProfileWidget)
     Hbox.setContentsMargins(0, 0, 0, 0)
    
     #Create central widget, add layout and set
     central_widget = QWidget(scrollArea)
     scrollArea.setWidget(central_widget)
     central_widget.setContentsMargins(0, 0, 0, 0)
     central_widget.setGeometry(0, 0, 650, 700)
     central_widget.setStyleSheet("background-color: #ccc; color:#000")
     central_widget.setLayout(Hbox)
    
     self.setWindowTitle(title)
     self.show()    
Пример #29
0
    def __init__(self, parameters, parent=None):
        """Constructor

        .. versionadded:: 2.2

        :param parameters: List of Parameter Widget
        :type parameters: list

        """
        QWidget.__init__(self, parent)

        self._parameters = parameters

        # Vertical layout to place the parameter widgets
        self.vertical_layout = QVBoxLayout()
        self.vertical_layout.setContentsMargins(0, 0, 0, 0)
        self.vertical_layout.setSpacing(0)

        # Widget to hold the vertical layout
        self.widget = QWidget()
        self.widget.setLayout(self.vertical_layout)

        # Scroll area to make the container scroll-able
        self.scroll_area = QScrollArea()
        self.scroll_area.setWidgetResizable(True)
        # self.scroll_area.setSizePolicy(QSizePolicy.Expanding)
        self.scroll_area.setWidget(self.widget)

        # Main layout of the container
        self.main_layout = QGridLayout()
        self.main_layout.addWidget(self.scroll_area)
        self.main_layout.setContentsMargins(0, 0, 0, 0)
        # self.main_layout.addStretch(1)
        self.setLayout(self.main_layout)

        self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)

        qt4_parameter_factory = Qt4ParameterFactory()
        color_odd = QColor(220, 220, 220)
        color_even = QColor(192, 192, 192)

        i = 0
        for parameter in parameters:
            parameter_widget = qt4_parameter_factory.get_widget(parameter)
            if i % 2:
                color = color_even
            else:
                color = color_odd
            i += 1
            parameter_widget.setAutoFillBackground(True)
            palette = parameter_widget.palette()
            palette.setColor(parameter_widget.backgroundRole(), color)
            parameter_widget.setPalette(palette)
            self.vertical_layout.addWidget(parameter_widget)
Пример #30
0
    def create_doc_tab_populate_combobox(self):
        """
        Creates the supporting document component widget.
        """
        self.doc_tab_data()
        self.docs_tab = QTabWidget()
        self.docs_tab_index = OrderedDict()
        for i, (id, doc) in enumerate(self.doc_types.iteritems()):
            self.docs_tab_index[doc] = i
            # the tab widget containing the document widget layout
            # and the child of the tab.
            tab_widget = QWidget()
            tab_widget.setObjectName(doc)
            # The layout of the tab widget
            cont_layout = QVBoxLayout(tab_widget)
            cont_layout.setObjectName(u'widget_layout_{}'.format(doc))
            # the scroll area widget inside the tab widget.
            scroll_area = QScrollArea(tab_widget)
            scroll_area.setFrameShape(QFrame.NoFrame)
            scroll_area.setObjectName(u'tab_scroll_area_{}'.format(doc))

            layout_widget = QWidget()
            # the widget the is under the scroll area content and
            # the widget containing the document widget layout
            # This widget is hidden and shown based on the STR number
            layout_widget.setObjectName(u'widget_{}'.format(doc))

            doc_widget_layout = QVBoxLayout(layout_widget)
            doc_widget_layout.setObjectName(
                u'doc_widget_layout_{}'.format(doc))
            doc_widget = QWidget()
            doc_widget.setObjectName(u'doc_widget_{}_{}'.format(
                doc, self.str_number))

            doc_widget_layout.addWidget(doc_widget)

            # the layout containing document widget.
            ### This is the layout that is registered to add uploaded
            # supporting documents widgets into.
            tab_layout = QVBoxLayout(doc_widget)
            tab_layout.setObjectName(u'layout_{}_{}'.format(
                doc, self.str_number))

            scroll_area.setWidgetResizable(True)
            scroll_area.setWidget(layout_widget)

            cont_layout.addWidget(scroll_area)
            # Add the tab widget with the document
            # type name to create a tab.
            self.docs_tab.addTab(tab_widget, doc)

            self.container_box.addWidget(self.docs_tab, 1)
            if len(self.str_numbers) == 1:
                self.doc_type_cbo.addItem(doc, id)