def __init__(self, parent=None):
        super().__init__(parent)

        ## Attributes
        self.data = None
        self.distances = None
        self.groups = None
        self.unique_pos = None
        self.base_group_index = 0

        ## GUI
        box = gui.widgetBox(self.controlArea, "Info")
        self.info_box = gui.widgetLabel(box, "\n")

        ## Separate By box
        box = gui.widgetBox(self.controlArea, "Separate By")
        self.split_by_model = itemmodels.PyListModel(parent=self)
        self.split_by_view = QListView()
        self.split_by_view.setSelectionMode(QListView.ExtendedSelection)
        self.split_by_view.setModel(self.split_by_model)
        box.layout().addWidget(self.split_by_view)

        self.split_by_view.selectionModel().selectionChanged.connect(
            self.on_split_key_changed)

        ## Sort By box
        box = gui.widgetBox(self.controlArea, "Sort By")
        self.sort_by_model = itemmodels.PyListModel(parent=self)
        self.sort_by_view = QListView()
        self.sort_by_view.setSelectionMode(QListView.ExtendedSelection)
        self.sort_by_view.setModel(self.sort_by_model)
        box.layout().addWidget(self.sort_by_view)

        self.sort_by_view.selectionModel().selectionChanged.connect(
            self.on_sort_key_changed)

        ## Distance box
        box = gui.widgetBox(self.controlArea, "Distance Measure")
        gui.comboBox(box,
                     self,
                     "selected_distance_index",
                     items=[name for name, _ in self.DISTANCE_FUNCTIONS],
                     callback=self.on_distance_measure_changed)

        self.scene = QGraphicsScene()
        self.scene_view = QGraphicsView(self.scene)
        self.scene_view.setRenderHints(QPainter.Antialiasing)
        self.scene_view.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.mainArea.layout().addWidget(self.scene_view)

        self.scene_view.installEventFilter(self)

        self._disable_updates = False
        self._cached_distances = {}
        self._base_index_hints = {}
        self.main_widget = None

        self.resize(800, 600)
Exemple #2
0
 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)
Exemple #3
0
    def setup_ui(self):
        self.resize(800, 480)
        self.grid = QGridLayout(self)

        self.display = pg.PlotWidget(name='st', background='w')

        add_circles(self.display, (1, 2))

        self.grid.addWidget(self.display, 0, 0, 2, 2)

        self.display.getViewBox().setXRange(-np.pi, np.pi)
        self.display.getViewBox().setYRange(-np.pi/2, np.pi/2)
        self.display.getViewBox().setAspectLocked()

        self.list_view = QListView(self)
        self.grid.addWidget(self.list_view, 0, 2, 1, 2)

        self.letter_selector = QComboBox(self)
        self.grid.addWidget(self.letter_selector, 1, 2, 1, 2)

        self.preview_btn = QPushButton(self)
        self.preview_btn.setText('Preview 3D')
        self.grid.addWidget(self.preview_btn, 2, 0, 1, 1)

        self.create_core_btn = QPushButton(self)
        self.create_core_btn.setText('Create core')
        self.grid.addWidget(self.create_core_btn, 2, 1, 1, 1)

        self.letter_edt = QLineEdit(self)
        self.grid.addWidget(self.letter_edt, 2, 2, 1, 1)

        self.set_letter_btn = QPushButton(self)
        self.set_letter_btn.setText('Set')
        self.grid.addWidget(self.set_letter_btn, 2, 3, 1, 1)
    def __init__(self):
        self.data = None
        self.indices = []
        box = gui.vBox(self.controlArea, 'Axes')
        self.combo_ax2 = gui.comboBox(
            box, self, 'ax2', label='Y axis:', callback=self.replot,
            sendSelectedValue=True, orientation='horizontal')
        self.combo_ax1 = gui.comboBox(
            box, self, 'ax1', label='Radial:', callback=self.replot,
            sendSelectedValue=True, orientation='horizontal')
        box = gui.vBox(self.controlArea, 'Aggregation')
        self.combo_func = gui.comboBox(
            box, self, 'agg_func', label='Function:', orientation='horizontal',
            callback=self.replot)
        func_model = ListModel(AGG_FUNCTIONS, parent=self)
        self.combo_func.setModel(func_model)

        self.attrlist_model = VariableListModel(parent=self)
        self.attrlist = QListView(selectionMode=QListView.ExtendedSelection)
        self.attrlist.setModel(self.attrlist_model)
        self.attrlist.selectionModel().selectionChanged.connect(
            self.attrlist_selectionChanged)
        box.layout().addWidget(self.attrlist)
        gui.rubber(self.controlArea)
        self.chart = chart = Spiralogram(self,
                                         selection_callback=self.on_selection)
        self.mainArea.layout().addWidget(chart)
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        while not isinstance(parent, QDialog):
            parent = parent.parent()
        self.setObjectName("CheckedListBox" +
                           str(len(parent.findChildren(CheckedListBox))))

        self.setObjectName("checkBoxWidget")
        self.hLayout = QHBoxLayout(self)
        self.hLayout.setObjectName("hLayout")

        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)

        # self.frame = Frame()
        self.listView = QListView(self)
        self.hLayout.addWidget(self.listView)

        self.stdModel = QStandardItemModel()
        self.listView.setModel(self.stdModel)

        self.hasObject = False
        self.objList = []

        self.checkBoxList = []

        self.listView.pressed.connect(self.listView_clicked)
Exemple #6
0
    def list_view(self):
        list = QListView()
        # Create an empty model for the list's data
        # model = QStandardItemModel(list)
        repo = LocusRepository()
        locusList = repo.get_all_locus()

        # Create an empty model for the list's data
        model = QStandardItemModel(list)

        for locus in locusList:
            # Create an item with a caption
            item = QStandardItem(locus.locus_id)

            # Add the item to the model
            model.appendRow(item)

        model.itemChanged.connect(self.on_item_changed)

        #    current_index = 0
        #    list.currentChanged(current_index)
        # list.selectionModel().currentChanged.connect(on_current_changed)

        # self.listWidget.itemClicked.connect(self.printItemText)
        # app.connect(list, SIGNAL("currentChanged()"),
        #              printItemText)

        # Apply the model to the list view
        list.setModel(model)
        list.selectionModel().currentChanged.connect(self.on_current_changed)

        self.horizontalLayout_1.addWidget(list)
Exemple #7
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.component_x = 0
        self.component_y = 1

        box = gui.vBox(self.controlArea, "Variables")
        self.varlist = itemmodels.VariableListModel()
        self.varview = view = QListView(selectionMode=QListView.MultiSelection)
        view.setModel(self.varlist)
        view.selectionModel().selectionChanged.connect(self._var_changed)

        box.layout().addWidget(view)

        axes_box = gui.vBox(self.controlArea, "Axes")
        box = gui.vBox(axes_box, "Axis X", margin=0)
        box.setFlat(True)
        self.axis_x_cb = gui.comboBox(
            box, self, "component_x", callback=self._component_changed)

        box = gui.vBox(axes_box, "Axis Y", margin=0)
        box.setFlat(True)
        self.axis_y_cb = gui.comboBox(
            box, self, "component_y", callback=self._component_changed)

        self.infotext = gui.widgetLabel(
            gui.vBox(self.controlArea, "Contribution to Inertia"), "\n"
        )

        gui.rubber(self.controlArea)

        self.plot = pg.PlotWidget(background="w")
        self.plot.setMenuEnabled(False)
        self.mainArea.layout().addWidget(self.plot)
    def __init__(self, values, checked_values=[]):
        self.dial = QDialog()
        self.result = ""

        # Layout Principal
        m_vbl = QVBoxLayout(self.dial)

        # List item checkable
        view = QListView()
        m_vbl.addWidget(view)

        self.m_sim = QStandardItemModel()
        view.setModel(self.m_sim)

        self._load_item(values, checked_values)

        # List buttons
        bt_all = QPushButton(self.tr("All"))
        bt_all.clicked.connect(lambda: self._check_all())

        bt_nothing = QPushButton(self.tr("Nothing"))
        bt_nothing.clicked.connect(lambda: self._check_nothing())

        bt_print = QPushButton(self.tr("Ok"))
        bt_print.clicked.connect(lambda: self._check_ok())

        # Sub layout for buttons
        m_vbh = QHBoxLayout()
        m_vbl.addLayout(m_vbh)

        m_vbh.addWidget(bt_all)
        m_vbh.addWidget(bt_nothing)
        m_vbh.addWidget(bt_print)
Exemple #9
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.data = None
        self.input_vars = ()
        self._invalidated = False

        box = gui.widgetBox(self.controlArea, "Domain Features")

        self.domain_model = itemmodels.VariableListModel()
        self.domain_view = QListView(selectionMode=QListView.SingleSelection)
        self.domain_view.setModel(self.domain_model)
        self.domain_view.selectionModel().selectionChanged.connect(
            self._on_selection_changed)
        box.layout().addWidget(self.domain_view)

        box = gui.widgetBox(self.controlArea, "Reset")
        gui.button(box, self, "Reset selected", callback=self.reset_selected)
        gui.button(box, self, "Reset all", callback=self.reset_all)

        gui.auto_commit(self.controlArea, self, "autocommit", "Commit",
                        "Commit on change is on")

        box = gui.widgetBox(self.mainArea, "Edit")
        self.editor_stack = QtGui.QStackedWidget()

        self.editor_stack.addWidget(DiscreteVariableEditor())
        self.editor_stack.addWidget(ContinuousVariableEditor())
        self.editor_stack.addWidget(VariableEditor())

        box.layout().addWidget(self.editor_stack)
Exemple #10
0
    def test_dock_standalone(self):
        widget = QWidget()
        layout = QHBoxLayout()
        widget.setLayout(layout)
        layout.addStretch(1)
        widget.show()

        dock = CollapsibleDockWidget()
        layout.addWidget(dock)
        list_view = QListView()
        list_view.setModel(QStringListModel(["a", "b"], list_view))

        label = QLabel("A label. ")
        label.setWordWrap(True)

        dock.setExpandedWidget(label)
        dock.setCollapsedWidget(list_view)
        dock.setExpanded(True)

        self.app.processEvents()

        def toogle():
            dock.setExpanded(not dock.expanded())
            self.singleShot(2000, toogle)

        toogle()

        self.app.exec_()
Exemple #11
0
    def __init__(self, parent=None, signalManger=None, title="Data Sort"):
        super(OWDataSort, self).__init__(parent, signalManger, title,
                                         wantMainArea=False)

        #: Mapping (feature.name, feature.var_type) to (sort_index, sort_order)
        #: where sirt index is the position of the feature in the sortByModel
        #: and sort_order the Qt.SortOrder flag
        self.sortroles = {}

        self.autoCommit = False
        self._outputChanged = False

        box = OWGUI.widgetBox(self.controlArea, "Sort By Features")
        self.sortByView = QListView()
        self.sortByView.setItemDelegate(SortParamDelegate(self))
        self.sortByView.setSelectionMode(QListView.ExtendedSelection)
        self.sortByView.setDragDropMode(QListView.DragDrop)
        self.sortByView.setDefaultDropAction(Qt.MoveAction)
        self.sortByView.viewport().setAcceptDrops(True)

        self.sortByModel = VariableListModel(
            flags=Qt.ItemIsEnabled | Qt.ItemIsSelectable |
                  Qt.ItemIsDragEnabled | Qt.ItemIsEditable
        )
        self.sortByView.setModel(self.sortByModel)

        box.layout().addWidget(self.sortByView)

        box = OWGUI.widgetBox(self.controlArea, "Unused Features")
        self.unusedView = QListView()
        self.unusedView.setSelectionMode(QListView.ExtendedSelection)
        self.unusedView.setDragDropMode(QListView.DragDrop)
        self.unusedView.setDefaultDropAction(Qt.MoveAction)
        self.unusedView.viewport().setAcceptDrops(True)

        self.unusedModel = VariableListModel(
            flags=Qt.ItemIsEnabled | Qt.ItemIsSelectable |
                  Qt.ItemIsDragEnabled
        )
        self.unusedView.setModel(self.unusedModel)

        box.layout().addWidget(self.unusedView)

        box = OWGUI.widgetBox(self.controlArea, "Output")
        cb = OWGUI.checkBox(box, self, "autoCommit", "Auto commit")
        b = OWGUI.button(box, self, "Commit", callback=self.commit)
        OWGUI.setStopper(self, b, cb, "_outputChanged", callback=self.commit)
Exemple #12
0
    def _setup_gui_values(self):
        self.values_edit = QListView()
        self.values_edit.setEditTriggers(QTreeView.CurrentChanged)
        self.values_model = itemmodels.PyListModel(flags=Qt.ItemIsSelectable | \
                                        Qt.ItemIsEnabled | Qt.ItemIsEditable)
        self.values_edit.setModel(self.values_model)

        self.values_model.dataChanged.connect(self.on_values_changed)
        self.main_form.addRow("Values", self.values_edit)
Exemple #13
0
 def test_drop_shadow_old(self):
     w = dropshadow._DropShadowWidget()
     w.setContentsMargins(20, 20, 20, 20)
     w.setLayout(QHBoxLayout())
     w.layout().setContentsMargins(0, 0, 0, 0)
     w.layout().addWidget(QListView())
     w.show()
     QTimer.singleShot(1500, lambda: w.setRadius(w.radius + 5))
     self.app.exec_()
Exemple #14
0
 def __init__(self, parent=None):
     super(MainWindow, self).__init__(parent)
     view = QListView()
     view.setDragEnabled(True)
     view.setAcceptDrops(True)
     view.setDropIndicatorShown(True)
     view.setSelectionMode(view.ExtendedSelection)
     self.model = ListModel(view)
     view.setModel(self.model)
     self.setCentralWidget(view)
Exemple #15
0
    def __init__(self, window):
        super(NameList, self).__init__('Current Plots')
        self.namelist_model = QStandardItemModel()
        self.namelist_view = QListView()
        self.namelist_view.setModel(self.namelist_model)
        self.setWidget(self.namelist_view)
        self.window = window
        self.plot_dict = {}

        self.namelist_view.doubleClicked.connect(self.activate_item)
    def __init__(self, parent=None):
        super().__init__(self, parent)

        self.data = None
        self.partitions = []
        self.matrix = None
        self.split_groups = []
        self._disable_updates = False

        ########
        # GUI
        ########

        box = gui.widgetBox(self.controlArea, "Input")

        self.info_box = gui.widgetLabel(box, "No data on input\n")

        box = gui.widgetBox(self.controlArea, "Separate By", addSpace=True)

        self.separate_view = QListView(selectionMode=QListView.MultiSelection)
        box.layout().addWidget(self.separate_view)

        box = gui.widgetBox(self.controlArea, "Sort By", addSpace=True)
        self.relevant_view = QListView(selectionMode=QListView.MultiSelection)

        box.layout().addWidget(self.relevant_view)

        self.distance_view = gui.comboBox(
            self.controlArea,
            self,
            "distance_measure",
            box="Distance Measure",
            items=[name for name, _ in self.DISTANCE_FUNCTIONS])

        gui.rubber(self.controlArea)

        gui.auto_commit(self.controlArea, self, "auto_commit", "Commit")
        self.groups_box = gui.widgetBox(self.mainArea, "Groups")
        self.groups_scroll_area = QScrollArea()
        self.groups_box.layout().addWidget(self.groups_scroll_area)
    def __init__(self, words):
        super(CompleteLineEdit, self).__init__(None)

        self.words = words                # QStringList  整个完成列表的单词
        self.listView = QListView(self)
        self.model = QStringListModel(self)
        self.listView.setWindowFlags(Qt.ToolTip)

        self.connect(self, SIGNAL("textChanged(const QString &)"),
                     self, SLOT("setCompleter(const QString &)"))

        self.connect(self.listView, SIGNAL("clicked(const QModelIndex &)"),
                     self, SLOT("completeText(const QModelIndex &)"))
Exemple #18
0
    def __init__(self, window):
        super(NameList, self).__init__('Current Plots')
        self.namelist_model = QStandardItemModel()
        self.namelist_view = QListView()
        self.namelist_view.setModel(self.namelist_model)
        self.setWidget(self.namelist_view)
        self.window = window
        self.plot_dict = {}

        self.namelist_view.doubleClicked.connect(self.activate_item)
        self.namelist_view.setContextMenuPolicy(QtConst.ActionsContextMenu)
        delete_action = QAction("Delete Selected", self.namelist_view)
        delete_action.triggered.connect(self.delete_item)
        self.namelist_view.addAction(delete_action)
Exemple #19
0
    def __init_widgets__(self):
        """ Initialise the widgets of the window. """
        # The Address/Attachment portion of the window
        self.attach_model = MessageAttachmentModel()

        attach_list = QListView()
        attach_list.setModel(self.attach_model)

        tab_bar_pxm = QPixmap('res/msg_tabbar_r.png')
        self.tab_bar = QTabWidget()
        self.tab_bar.setTabPosition(2)
        self.tab_bar.setIconSize(QSize(16, 16))
        self.tab_bar.addTab(QWidget(), QIcon(tab_bar_pxm.copy(0, 0, 16, 16)),
                            '')
        self.tab_bar.addTab(attach_list, QIcon(tab_bar_pxm.copy(0, 16, 16,
                                                                16)), '')

        # The Composition Properties portion of the window
        self.subject_line = QLineEdit()
        self.subject_line.setPlaceholderText('Subject')
        QObject.connect(self.subject_line, SIGNAL('textEdited(QString)'),
                        self.update_title)
        priority_label = QLabel('Priority:')
        priority_dropdown = QComboBox(self)
        priority_dropdown.addItems(
            ['Highest', 'High', 'Normal', 'Low', 'Lowest'])

        subject_prio_layout = QHBoxLayout()
        subject_prio_layout.addWidget(self.subject_line)
        #        subject_prio_layout.addStretch(1)
        subject_prio_layout.addWidget(priority_label)
        subject_prio_layout.addWidget(priority_dropdown)

        # The actual Composition portion of the window
        self.message = MessageTextEdit(self)

        # The bottom pane
        bottom_pane_layout = QVBoxLayout()
        bottom_pane_layout.addLayout(subject_prio_layout)
        bottom_pane_layout.addWidget(self.message)
        bottom_pane = QWidget()
        bottom_pane.setLayout(bottom_pane_layout)

        # Central widget is the splitter
        splitter = QSplitter()
        splitter.setOrientation(2)
        splitter.addWidget(self.tab_bar)
        splitter.addWidget(bottom_pane)

        self.setCentralWidget(splitter)
Exemple #20
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.parent = parent
     try:
         self.setAttribute(Qt.WA_Maemo5AutoOrientation, True)
     except AttributeError:
         pass
     self.list_view = QListView()
     self.list_model = ResultModel()
     self.list_view.setViewMode(QListView.ListMode)
     self.list_view.setWordWrap(True)
     self.list_view.setResizeMode(QListView.Adjust)
     self.list_view.setModel(self.list_model)
     self.setCentralWidget(self.list_view)
Exemple #21
0
    def checkablePopup(self):
        """
        Returns the popup if this widget is checkable.
        
        :return     <QListView> || None
        """
        if (not self._checkablePopup and self.isCheckable()):
            popup = QListView(self)
            popup.setSelectionMode(QListView.NoSelection)
            popup.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
            popup.setWindowFlags(Qt.Popup)
            popup.installEventFilter(self)
            popup.doubleClicked.connect(self.checkModelIndex)
            self._checkablePopup = popup

        return self._checkablePopup
Exemple #22
0
    def __init__(self, owwidget, ax, varmodel):
        super().__init__(owwidget)
        self.ax = ax
        self.view = view = QListView(
            self,
            selectionMode=QTreeWidget.ExtendedSelection,
        )
        view.setModel(varmodel)
        selection = view.selectionModel()
        selection.selectionChanged.connect(self.selection_changed)

        box = QVBoxLayout(self)
        box.setContentsMargins(0, 0, 0, 0)
        self.setLayout(box)

        hbox = gui.hBox(self)
        gui.comboBox(hbox,
                     self,
                     'plot_type',
                     label='Type:',
                     orientation='horizontal',
                     items=('line', 'step line', 'column', 'area', 'spline'),
                     sendSelectedValue=True,
                     callback=lambda: self.sigType.emit(ax, self.plot_type))
        gui.rubber(hbox)
        self.button_close = button = QPushButton('×',
                                                 hbox,
                                                 visible=False,
                                                 minimumSize=QSize(20, 20),
                                                 maximumSize=QSize(20, 20),
                                                 styleSheet='''
                                                     QPushButton {
                                                         font-weight: bold;
                                                         font-size:14pt;
                                                         margin:0;
                                                         padding:0;
                                                     }''')
        button.clicked.connect(lambda: self.sigClosed.emit(ax, self))
        hbox.layout().addWidget(button)
        gui.checkBox(
            self,
            self,
            'is_logarithmic',
            'Logarithmic axis',
            callback=lambda: self.sigLogarithmic.emit(ax, self.is_logarithmic))
        box.addWidget(view)
Exemple #23
0
    def __init__(self, parent):
        QFrame.__init__(self, parent)
        self.setFrameStyle(QFrame.Box | QFrame.Sunken)
        self.setStyleSheet("QListView {background: transparent; }")
        self.setLayout(QHBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.listView = QListView(self)
        self.layout().addWidget(self.listView)

        self.listView.setModel(self.window().quickAccessModel)
        self.listView.setMovement(QListView.Snap)
        self.listView.setFlow(QListView.LeftToRight)
        self.listView.setResizeMode(QListView.Adjust)
        gridSize = self.logicalDpiX() / 96 * 60
        self.listView.setGridSize(QSize(gridSize, gridSize))
        self.listView.setViewMode(QListView.IconMode)

        self.listView.activated.connect(self.listView.model().runShortcut)
Exemple #24
0
    def __init__(self, parent=None):
        super(MainForm, self).__init__(parent)

        self.model = BarGraphModel()
        self.barGraphView = BarGraphView()
        self.barGraphView.setModel(self.model)
        self.listView = QListView()
        self.listView.setModel(self.model)
        self.listView.setItemDelegate(BarGraphDelegate(0, 1000, self))
        self.listView.setMaximumWidth(100)
        self.listView.setEditTriggers(QListView.DoubleClicked
                                      | QListView.EditKeyPressed)
        layout = QHBoxLayout()
        layout.addWidget(self.listView)
        layout.addWidget(self.barGraphView, 1)
        self.setLayout(layout)

        self.setWindowTitle("Bar Grapher")
        QTimer.singleShot(0, self.initialLoad)
Exemple #25
0
 def __init__(self):
     self.data = None
     box = gui.vBox(self.controlArea, 'Seasonal Adjustment')
     gui.spin(box, self, 'n_periods', 2, 1000,
              label='Season period:',
              callback=self.on_changed,
              tooltip='The expected length of full cycle. E.g., if you have '
                      'monthly data and the apparent season repeats every '
                      'year, you put in 12.')
     gui.radioButtons(box, self, 'decomposition', self.DECOMPOSITION_MODELS,
                      label='Decomposition model:',
                      orientation=Qt.Horizontal,
                      callback=self.on_changed)
     self.view = view = QListView(self,
                                  selectionMode=QListView.ExtendedSelection)
     self.model = model = VariableListModel(parent=self)
     view.setModel(model)
     view.selectionModel().selectionChanged.connect(self.on_changed)
     box.layout().addWidget(view)
     gui.auto_commit(box, self, 'autocommit', '&Apply')
Exemple #26
0
    def test_tool_box(self):
        w = toolbox.ToolBox()
        style = self.app.style()
        icon = QIcon(style.standardPixmap(style.SP_FileIcon))
        p1 = QLabel("A Label")
        p2 = QListView()
        p3 = QLabel("Another\nlabel")
        p4 = QSpinBox()

        i1 = w.addItem(p1, "T1", icon)
        i2 = w.addItem(p2, "Tab " * 10, icon, "a tab")
        i3 = w.addItem(p3, "t3")
        i4 = w.addItem(p4, "t4")

        self.assertSequenceEqual([i1, i2, i3, i4], range(4))
        self.assertEqual(w.count(), 4)

        for i, item in enumerate([p1, p2, p3, p4]):
            self.assertIs(item, w.widget(i))
            b = w.tabButton(i)
            a = w.tabAction(i)
            self.assertIsInstance(b, QAbstractButton)
            self.assertIs(b.defaultAction(), a)

        w.show()
        w.removeItem(2)

        self.assertEquals(w.count(), 3)
        self.assertIs(w.widget(2), p4)

        p3 = QLabel("Once More Unto the Breach")

        w.insertItem(2, p3, "Dear friend")

        self.assertEquals(w.count(), 4)

        self.assertIs(w.widget(1), p2)
        self.assertIs(w.widget(2), p3)
        self.assertIs(w.widget(3), p4)

        self.app.exec_()
Exemple #27
0
 def __init__(self):
     self.data = None
     box = gui.vBox(self.controlArea, 'Differencing')
     self.order_spin = gui.spin(
         box,
         self,
         'diff_order',
         1,
         2,
         label='Differencing order:',
         callback=self.on_changed,
         tooltip='The value corresponds to n-th order numerical '
         'derivative of the series. \nThe order is fixed to 1 '
         'if the shift period is other than 1.')
     gui.spin(box,
              self,
              'shift_period',
              1,
              100,
              label='Shift:',
              callback=self.on_changed,
              tooltip='Set this to other than 1 if you don\'t want to '
              'compute differences for subsequent values but for '
              'values shifted number of spaces apart. \n'
              'If this value is different from 1, differencing '
              'order is fixed to 1.')
     gui.checkBox(box,
                  self,
                  'invert_direction',
                  label='Invert differencing direction',
                  callback=self.on_changed,
                  tooltip='Influences where the series is padded with nan '
                  'values — at the beginning or at the end.')
     self.view = view = QListView(self,
                                  selectionMode=QListView.ExtendedSelection)
     self.model = model = VariableListModel(parent=self)
     view.setModel(model)
     view.selectionModel().selectionChanged.connect(self.on_changed)
     box.layout().addWidget(view)
     gui.auto_commit(box, self, 'autocommit', '&Apply')
Exemple #28
0
    def _init_ui(self):
        # Draw UI widgets
        layout = QVBoxLayout()

        # Add layout for notification bar
        self.vl_notif = QVBoxLayout()
        layout.addLayout(self.vl_notif)
        self.lbl_info = QLabel()
        self.lbl_info.setObjectName('lbl_info')
        self.lbl_info.setText(self.tr(
            'The selected document types have been found in the directory, '
            'check/uncheck to specify which ones to upload.'
        ))
        self.lbl_info.setWordWrap(True)
        layout.addWidget(self.lbl_info)
        self.lst_docs = QListView()
        layout.addWidget(self.lst_docs)
        self.lbl_warning = QLabel()
        self.lbl_warning.setTextFormat(Qt.RichText)
        self.lbl_warning.setText(self.tr(
            '<html><head/><body><p><span style=" font-style:italic;">'
            '* Previously uploaded documents will be replaced.</span></p>'
            '</body></html>'
        ))
        self.lbl_warning.setWordWrap(True)
        layout.addWidget(self.lbl_warning)
        self.btn_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        )
        layout.addWidget(self.btn_box)
        self.setLayout(layout)

        # Connect signals
        self.btn_box.accepted.connect(
            self.set_selected_document_types
        )
        self.btn_box.rejected.connect(
            self.reject
        )
Exemple #29
0
    def __init__(self):
        QWidget.__init__(self)

        self.__filter_popup = FilterPopup(self)
        self.__filter_popup.filterSettingsChanged.connect(self.onItemChanged)

        layout = QVBoxLayout()

        self.model = DataTypeKeysListModel()
        self.filter_model = DataTypeProxyModel(self.model)

        filter_layout = QHBoxLayout()

        self.search_box = SearchBox()
        self.search_box.filterChanged.connect(self.setSearchString)
        filter_layout.addWidget(self.search_box)

        filter_popup_button = QToolButton()
        filter_popup_button.setIcon(util.resourceIcon("ide/cog_edit.png"))
        filter_popup_button.clicked.connect(self.showFilterPopup)
        filter_layout.addWidget(filter_popup_button)
        layout.addLayout(filter_layout)

        self.data_type_keys_widget = QListView()
        self.data_type_keys_widget.setModel(self.filter_model)
        self.data_type_keys_widget.selectionModel().selectionChanged.connect(
            self.itemSelected)

        layout.addSpacing(15)
        layout.addWidget(self.data_type_keys_widget, 2)
        layout.addStretch()

        # layout.addWidget(Legend("Default types", DataTypeKeysListModel.DEFAULT_DATA_TYPE))
        layout.addWidget(
            Legend("Observations available",
                   DataTypeKeysListModel.HAS_OBSERVATIONS))

        self.setLayout(layout)
Exemple #30
0
    def __init__(self, parent):
        QFrame.__init__(self, parent)
        self.setFrameStyle(QFrame.Box | QFrame.Sunken)
        self.setStyleSheet("QListView{background:transparent;}")

        self.listView = QListView(self)
        self.setLayout(QHBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().addWidget(self.listView)

        self.listView.setContextMenuPolicy(Qt.CustomContextMenu)
        self.listView.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.listView.setMovement(QListView.Snap)
        self.listView.setFlow(QListView.LeftToRight)
        self.listView.setResizeMode(QListView.Adjust)
        self.listView.setGridSize(QSize(self.logicalDpiX() / 96 * 70,
                                        self.logicalDpiY() / 96 * 70))
        self.listView.setViewMode(QListView.IconMode)

        self.quickDesktopModel = QuickDesktopModel(self.window().platform.databaseFile)
        self.listView.setModel(self.quickDesktopModel)
        self.createActions()
        self.makeConnections()