Exemplo n.º 1
0
        def __init__(self, parent_widget):
            super().__init__()
            self.parent_widget = parent_widget
            self.want_control_area = False
            self.running = False
            self.progress = None
            self.k = 10

            self.projectionTable = QTableView()
            self.mainArea.layout().addWidget(self.projectionTable)
            self.projectionTable.setSelectionBehavior(QTableView.SelectRows)
            self.projectionTable.setSelectionMode(QTableView.SingleSelection)
            self.projectionTable.setSortingEnabled(True)
            self.projectionTableModel = QStandardItemModel(self)
            self.projectionTable.setModel(self.projectionTableModel)
            self.projectionTable.selectionModel().selectionChanged.connect(
                self.on_selection_changed)

            self.button = gui.button(self.mainArea,
                                     self,
                                     "Start evaluation",
                                     callback=self.toggle,
                                     default=True)
            self.resize(380, 512)
            self._initialize()
Exemplo n.º 2
0
    def __init__(self, master):
        """Initialize the attributes and set up the interface"""
        QDialog.__init__(self, windowTitle=self.captionTitle)
        WidgetMessagesMixin.__init__(self)
        self.setLayout(QVBoxLayout())

        self.insert_message_bar()
        self.layout().insertWidget(0, self.message_bar)
        self.master = master

        self.keep_running = False
        self.saved_state = None
        self.saved_progress = 0
        self.scores = []

        self.rank_model = QStandardItemModel(self)
        self.rank_table = view = QTableView(
            selectionBehavior=QTableView.SelectRows,
            selectionMode=QTableView.SingleSelection,
            showGrid=False)
        view.setItemDelegate(HorizontalGridDelegate())
        view.setModel(self.rank_model)
        view.selectionModel().selectionChanged.connect(
            self.on_selection_changed)
        view.horizontalHeader().setStretchLastSection(True)
        view.horizontalHeader().hide()
        self.layout().addWidget(view)

        self.button = gui.button(self,
                                 self,
                                 "Start",
                                 callback=self.toggle,
                                 default=True)
Exemplo n.º 3
0
 def showClusterTable(self):
     if not self.view.sampleTableView.selectedIndexes(
     ):  #not self.acTree.selectedIndexes():
         s, b = QInputDialog.getItem(
             self.view, "Select one sample", "Select one sample :",
             [spl.shortName() for spl in self.model])
         if not b:
             return
         sample = self.model.sample(str(s), fullNameEntry=False)
     else:
         idx = self.view.sampleTableView.selectedIndexes()[0]
         sample = self.model.sample(idx.data().toString(),
                                    fullNameEntry=False)
     if sample is None:
         print("sample not found...")
         return
     if not sample.mappedPeaks:
         self.view.showErrorMessage(
             "No peaks found",
             "This sample does not have peaks, please do peak picking before"
         )
     view = QTableView()
     view.setSortingEnabled(True)
     view.horizontalHeader().setStretchLastSection(True)
     view.setModel(
         MSDialogController.getSampleModel(sample, flags='cluster'))
     self.view.addMdiSubWindow(view,
                               "ClusterList of%s" % str(sample.shortName()))
Exemplo n.º 4
0
    def __init__(self, parent, states):
        super(DetailedProgressDialog, self).__init__(parent)
        self.setWindowTitle("Realization Progress")
        layout = QGridLayout(self)
        self.detailed_progress_widget = DetailedProgress(states, self)
        self.overview_label = QLabel("Realizations")

        self.single_view = QTableView()
        self.single_view.setModel(SingleProgressModel(self.single_view))
        self.single_view_label = QLabel("Realization details")

        self.detailed_progress_widget.clicked.connect(self.show_selection)

        layout.addWidget(self.single_view_label, 0, 0)
        layout.addWidget(self.overview_label, 0, 1)
        layout.addWidget(self.single_view, 1, 0)
        layout.addWidget(self.detailed_progress_widget, 1, 1)

        self.detailed_progress_widget.show()
        self.setLayout(layout)

        self.layout().setColumnStretch(0, 1)
        self.layout().setColumnStretch(1, 2)
        self.progress = None
        self.selected_realization = None
        self.resize(parent.width(), parent.height())
Exemplo n.º 5
0
    def setupUi(self):
        self.widget = MSView(
            MSQtCanvas(self.peaks,
                       "peaks@%s" % str(self.peaks[0]),
                       labels={
                           'bottom': 'RT(s)',
                           'left': 'INTENSITY'
                       },
                       flags='peak'))
        self.tableView = QTableView()
        self.tableView.horizontalHeader().setStretchLastSection(True)
        self.tableView.setSortingEnabled(True)

        self.corr = QLabel("Nan")
        self.calcCorr = QPushButton("r_coef:")
        #v = QVBoxLayout(self)
        self.addWidget(self.widget)

        self.wid = QWidget()
        vb = QVBoxLayout()
        vb.addWidget(self.calcCorr)
        vb.addWidget(self.corr)
        hb = QHBoxLayout(self.wid)
        #if self.choosenOne.formulas:
        hb.addWidget(self.tableView)
        #else:
        #    hb.addWidget(QLabel("Identification not performed yet..."))
        hb.addLayout(vb)
        self.addWidget(self.wid)
Exemplo n.º 6
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        uic.loadUi("mainwindow.ui", self)

        model = QStandardItemModel(3, 2, self)
        model.setItem(0, 0, QStandardItem(_fromUtf8("xiaoming")))
        model.setItem(0, 1, QStandardItem(_fromUtf8("0")))
        model.setItem(1, 0, QStandardItem(_fromUtf8("xiaogang")))
        model.setItem(1, 1, QStandardItem(_fromUtf8("5")))
        model.setItem(2, 0, QStandardItem(_fromUtf8("xiaohong")))
        model.setItem(2, 1, QStandardItem(_fromUtf8("0")))
        model.setItem(3, 0, QStandardItem(_fromUtf8("赵六")))
        model.setItem(3, 1, QStandardItem(_fromUtf8("8")))

        self.mapper = QDataWidgetMapper(self)
        # 设置模型
        self.mapper.setModel(model)
        # 设置窗口部件和模型中的列的映射
        self.mapper.addMapping(self.lineEdit, 0)
        self.mapper.addMapping(self.lineEdit_2, 1)
        # 显示模型中的第一行
        self.mapper.toFirst()

        #----------------------------------------------------------
        tableview = QTableView()
        tableview.setModel(model)
        tableview.show()
Exemplo n.º 7
0
    def __init__ ( self, conf, parent=None ):
        QWidget.__init__( self, parent )
        self._rowHeight = 20

        self._view = QTableView()
        self._view.setShowGrid            ( False )
        self._view.setAlternatingRowColors( True )
        self._view.setSelectionBehavior   ( QAbstractItemView.SelectRows )
       #self._view.setSortingEnabled      ( True )
       #self._view.installEventFilter     ( self )

        horizontalHeader = self._view.horizontalHeader ()
        horizontalHeader.setStretchLastSection ( True )
        horizontalHeader.setMinimumSectionSize ( 150 )
        horizontalHeader.setResizeMode         ( QHeaderView.ResizeToContents )
        horizontalHeader.setDefaultSectionSize ( 150 )

        verticalHeader = self._view.verticalHeader ();
        verticalHeader.setVisible ( False );
        verticalHeader.setDefaultSectionSize ( self._rowHeight );

        self._baseModel = ConfSettingsModel( conf )
        self._view.setModel( self._baseModel );
        self._view.horizontalHeader().setStretchLastSection( True );
        self._view.resizeColumnToContents( 0 );

        peanoDataLayout = QGridLayout();
        peanoDataLayout.addWidget( self._view, 0, 0, 1, 1 );

        self.setLayout ( peanoDataLayout );
        return
Exemplo n.º 8
0
    def createTable(self):
        # create the view
        tv = QTableView()

        self.param = self.createParam()

        # set the delegate to allow editing table entries
        self.td = SpinBoxDelegate(self.param.traits.xslot)
        tv.setItemDelegate(self.td)

        tm = ParamTableModel(self.createParam(), self)
        tv.setModel(tm)

        # set the minimum size
        tv.setMinimumSize(400, 300)

        # hide grid
        tv.setShowGrid(False)

        # set the font
        font = QFont("Courier New", 8)
        tv.setFont(font)

        # hide horizontal header
        hh = tv.horizontalHeader()
        hh.setVisible(False)

        # set vertical header properties
        vh = tv.verticalHeader()
        #vh.setStretchLastSection(True)

        # set column width to fit contents
        tv.resizeColumnsToContents()

        return tv
Exemplo n.º 9
0
 def showPeakTable(self):
     """
     TODO: write little function to check if sample is None or good
     or write exception with good code
     
     """
     if not self.view.sampleTableView.selectedIndexes(
     ):  #not self.acTree.selectedIndexes():
         s, b = QInputDialog.getItem(
             self.view, "Select one sample", "Select one sample :",
             [spl.shortName() for spl in self.model])
         if not b:
             return
         sample = self.model.sample(str(s), fullNameEntry=False)
     else:
         idx = self.view.sampleTableView.selectedIndexes()[0]
         sample = self.model.sample(idx.data().toString(),
                                    fullNameEntry=False)
     if sample is None:
         print("sample not found...")
         return
     if not sample.rawPeaks:
         self.view.showErrorMessage(
             "No peaks found",
             "This sample does not have peaks, please do peak picking before"
         )
     view = QTableView()
     view.horizontalHeader().setStretchLastSection(True)
     view.setSortingEnabled(True)
     model = MSDialogController.getSampleModel(sample, flags='peak')
     view.setModel(model)
     self.view.addMdiSubWindow(
         view, " ".join(["PeakList of",
                         str(sample.shortName())]))
Exemplo n.º 10
0
    def __init__(self, parent=None):
        super(MTestForm, self).__init__(parent)
        self.model = SnapshotTableModel()
        self.model.addSnapshot('test.h5')
        self.tablev = QTableView()
        self.tablev.setModel(self.model)
        self.tablev.setItemDelegate(SnapshotItemDelegate(self))
        #for i in range(self.model.columnCount()):
        self.tablev.resizeColumnsToContents()
        self.tablev.setColumnHidden(1, True)

        hb1 = QHBoxLayout()
        vb2 = QVBoxLayout()
        vb2.addWidget(ApPlotWidget(), 1.0)

        vb3a = QVBoxLayout()
        cb = QCheckBox("show PV")
        self.connect(cb, SIGNAL("stateChanged(int)"), self._set_pv_view)
        vb3a.addWidget(cb)
        vb3a.addStretch()

        vb3b = QVBoxLayout()
        vb3b.addWidget(QPushButton("Refresh"))
        vb3b.addWidget(QPushButton("Plot"))
        vb3b.addWidget(QPushButton("Ramp"))
        vb3b.addStretch()

        hb2 = QHBoxLayout()
        hb2.addLayout(vb3a, 1.0)
        hb2.addLayout(vb3b)

        vb2.addLayout(hb2)
        hb1.addWidget(self.tablev, .6)
        hb1.addLayout(vb2, 0.4)
        self.setLayout(hb1)
Exemplo n.º 11
0
 def emotion_initial(self):
     self.emotion_table = QTableView()
     self.emotion_table.horizontalHeader().setVisible(False)
     self.emotion_table.verticalHeader().setVisible(False)
     self.emotion_table.setMouseTracking(True)
     self.emotion_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
     self.emotion_table.verticalHeader().setDefaultSectionSize(30)
     self.emotion_table.horizontalHeader().setDefaultSectionSize(30)
     self.emotion_table.setIconSize(QSize(30,30))
     self.emotion_table.entered.connect(self.showEmotionTips)
     self.emotion_model = QStandardItemModel()
     
     emotions = os.listdir(Emotion.EMOTION_DIR)
     i = 0
     emotions_size = len(emotions)
     emotions = sorted(emotions,cmp=emotioncmp)
     while i < emotions_size:
         self.add_emotion(emotions[i:i+14])
         i = i + 14
     self.emotion_table.setModel(self.emotion_model)
     self.emotion_table.clicked.connect(self.emotion_click) 
     #
     mainLayout=QVBoxLayout()
     mainLayout.addWidget(self.emotion_table)
     self.setLayout(mainLayout)
Exemplo n.º 12
0
    def __init__(self, model, parent=None):
        super().__init__(parent)

        self._view = QTableView()
        self._view.setModel(model)

        cancelButton = QPushButton(_('cancel'))
        cancelButton.clicked.connect(self.reject)

        okButton = QPushButton(_('OK'))
        okButton.setDefault(True)
        okButton.clicked.connect(self.accept)

        addButton = QPushButton('+')
        addButton.clicked.connect(self.add)

        buttonBox = QHBoxLayout()
        buttonBox.addWidget(addButton)
        buttonBox.addStretch(1)
        buttonBox.addWidget(cancelButton)
        buttonBox.addWidget(okButton)

        layout = QVBoxLayout()
        layout.addWidget(self._view)
        layout.addLayout(buttonBox)

        self.setLayout(layout)

        self.accepted.connect(self.save)

        self.setWindowTitle(_('Admin.edit' + model.table))
        self.resize(600, 300)
        self._view.resizeColumnsToContents()
Exemplo n.º 13
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        uic.loadUi("mainwindow.ui", self)

        model = QStandardItemModel(7, 4, self)
        for row in range(7):
            for column in range(4):
                item = QStandardItem(QString("%1").arg(row * 4 + column))
                model.setItem(row, column, item)

        self.tableView = QTableView()
        self.tableView.setModel(model)
        self.setCentralWidget(self.tableView)

        # 获取视图的项目选择模型
        selectionModel = self.tableView.selectionModel()

        # 定义左上角和右下角的索引,然后使用这两个索引创建选择
        topLeft = model.index(1, 1, QModelIndex())
        bottomRight = model.index(5, 2, QModelIndex())
        selection = QItemSelection(topLeft, bottomRight)

        # 使用指定的选择模式来选择项目
        selectionModel.select(selection, QItemSelectionModel.Select)

        self.mainToolBar.addAction(_fromUtf8("当前项目"), self.getCurrentItemData)
        self.mainToolBar.addAction(_fromUtf8("切换选择"), self.toggleSelection)
Exemplo n.º 14
0
    def __init__(self):
        super().__init__()
        self.data = None
        self.progress = None

        self.infoa = gui.widgetLabel(self.controlArea, "No data loaded.")

        self.projectionTable = QTableView()
        self.controlArea.layout().addWidget(self.projectionTable)
        self.projectionTable.setSelectionBehavior(QTableView.SelectRows)
        self.projectionTable.setSelectionMode(QTableView.SingleSelection)
        self.projectionTable.setSortingEnabled(True)

        self.projectionTableModel = QStandardItemModel(self)
        self.projectionTableModel.setHorizontalHeaderLabels(
            ["P-Index", "", ""])
        self.projectionTable.setModel(self.projectionTableModel)

        self.projectionTable.setColumnWidth(0, 90)
        self.projectionTable.sortByColumn(0, Qt.DescendingOrder)
        self.projectionTable.selectionModel().selectionChanged.connect(
            self.on_selection_changed)

        gui.button(self.controlArea,
                   self,
                   "Rank Projections",
                   callback=self.rank,
                   default=True)
        self.resize(370, 600)
Exemplo n.º 15
0
 def _setupUi(self):
     self.setWindowTitle(tr("Problems!"))
     self.resize(413, 323)
     self.verticalLayout = QVBoxLayout(self)
     self.label = QLabel(self)
     msg = tr("There were problems processing some (or all) of the files. The cause of "
         "these problems are described in the table below. Those files were not "
         "removed from your results.")
     self.label.setText(msg)
     self.label.setWordWrap(True)
     self.verticalLayout.addWidget(self.label)
     self.tableView = QTableView(self)
     self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
     self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
     self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.tableView.setShowGrid(False)
     self.tableView.horizontalHeader().setStretchLastSection(True)
     self.tableView.verticalHeader().setDefaultSectionSize(18)
     self.tableView.verticalHeader().setHighlightSections(False)
     self.verticalLayout.addWidget(self.tableView)
     self.horizontalLayout = QHBoxLayout()
     self.revealButton = QPushButton(self)
     self.revealButton.setText(tr("Reveal Selected"))
     self.horizontalLayout.addWidget(self.revealButton)
     spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.horizontalLayout.addItem(spacerItem)
     self.closeButton = QPushButton(self)
     self.closeButton.setText(tr("Close"))
     self.closeButton.setDefault(True)
     self.horizontalLayout.addWidget(self.closeButton)
     self.verticalLayout.addLayout(self.horizontalLayout)
Exemplo n.º 16
0
    def __init__(self, parent=None):
        super(TableWidget, self).__init__(parent)

        # Create a simple model for storing data.
        model = CustomTableModel()

        # Create the table view and add the model to it.
        tableView = QTableView()
        tableView.setModel(model)
        tableView.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        tableView.verticalHeader().setResizeMode(QHeaderView.Stretch)

        chart = QChart()
        chart.setAnimationOptions(QChart.AllAnimations)

        # Series 1.
        series = QLineSeries()
        series.setName("Line 1")

        mapper = QVXYModelMapper(self)
        mapper.setXColumn(0)
        mapper.setYColumn(1)
        mapper.setSeries(series)
        mapper.setModel(model)
        chart.addSeries(series)

        # Get the color of the series and use it for showing the mapped area.
        seriesColorHex = '#' + hex(series.pen().color().rgb()).upper()[-6:]
        model.addMapping(seriesColorHex, QRect(0, 0, 2, model.rowCount()))

        # Series 2.
        series = QLineSeries()
        series.setName("Line 2")

        mapper = QVXYModelMapper(self)
        mapper.setXColumn(2)
        mapper.setYColumn(3)
        mapper.setSeries(series)
        mapper.setModel(model)
        chart.addSeries(series)

        # Get the color of the series and use it for showing the mapped area.
        seriesColorHex = '#' + hex(series.pen().color().rgb()).upper()[-6:]
        model.addMapping(seriesColorHex, QRect(2, 0, 2, model.rowCount()))

        chart.createDefaultAxes()
        chartView = QChartView(chart)
        chartView.setRenderHint(QPainter.Antialiasing)
        chartView.setMinimumSize(640, 480)

        # Create the main layout.
        mainLayout = QGridLayout()
        mainLayout.addWidget(tableView, 1, 0)
        mainLayout.addWidget(chartView, 1, 1)
        mainLayout.setColumnStretch(1, 1)
        mainLayout.setColumnStretch(0, 0)
        self.setLayout(mainLayout)
Exemplo n.º 17
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        uic.loadUi("mainwindow.ui", self)

        model = QStandardItemModel(7, 4, self)
        for row in range(7):
            for column in range(4):
                item = QStandardItem(QString("%1").arg(row * 4 + column))
                model.setItem(row, column, item)

        self.tableView = QTableView()
        self.tableView.setModel(model)
        self.setCentralWidget(self.tableView)

        # 获取视图的项目选择模型
        selectionModel = self.tableView.selectionModel()

        # 定义左上角和右下角的索引,然后使用这两个索引创建选择
        topLeft = model.index(1, 1, QModelIndex())
        bottomRight = model.index(5, 2, QModelIndex())
        selection = QItemSelection(topLeft, bottomRight)

        # 使用指定的选择模式来选择项目
        selectionModel.select(selection, QItemSelectionModel.Select)

        self.mainToolBar.addAction(_fromUtf8("当前项目"), self.getCurrentItemData)
        self.mainToolBar.addAction(_fromUtf8("切换选择"), self.toggleSelection)

        self.connect(selectionModel,SIGNAL("selectionChanged(QItemSelection,QItemSelection)"),
                     self.updateSelection)
        self.connect(selectionModel, SIGNAL("currentChanged(QModelIndex,QModelIndex)"),
                self.changeCurrent)

        # 多个视图共享选择
        self.tableView2 = QTableView()
        self.tableView2.setWindowTitle("tableView2")
        self.tableView2.resize(400, 300)
        self.tableView2.setModel(model)
        self.tableView2.setSelectionModel(selectionModel)
        self.tableView2.show()

        # 使用自定义委托
        delegate = SpinBoxDelegate(self)
        self.tableView.setItemDelegate(delegate)
Exemplo n.º 18
0
 def attb_table(self):
     from PyQt4.QtGui import QApplication, QTableView
     from qgis.gui import QgsAttributeTableModel
     QMessageBox.about(self.view, 'teste', str(self.view.currentLayer()))
     cache = QgsVectorLayerCache(self.view.currentLayer(), 10000)
     model = QgsAttributeTableModel(cache)
     model.loadLayer()
     table = QTableView()
     table.setModel(model)
     table.show()
Exemplo n.º 19
0
    def __init__(self):
        super().__init__()
        if isinstance(self.selected_learner, list):
            self.selected_learner = (self.selected_learner + [0])[0]

        self.data = None
        self.results = None
        self.learners = []
        self.headers = []

        box = gui.vBox(self.controlArea, "Learners")

        self.learners_box = gui.listBox(
            box, self, "selected_learner", "learners",
            callback=self._learner_changed
        )
        box = gui.vBox(self.controlArea, "Show")

        gui.comboBox(box, self, "selected_quantity", items=self.quantities,
                     callback=self._update)

        box = gui.vBox(self.controlArea, "Select")

        gui.button(box, self, "Select Correct",
                   callback=self.select_correct, autoDefault=False)
        gui.button(box, self, "Select Misclassified",
                   callback=self.select_wrong, autoDefault=False)
        gui.button(box, self, "Clear Selection",
                   callback=self.select_none, autoDefault=False)

        self.outputbox = box = gui.vBox(self.controlArea, "Output")
        gui.checkBox(box, self, "append_predictions",
                     "Predictions", callback=self._invalidate)
        gui.checkBox(box, self, "append_probabilities",
                     "Probabilities",
                     callback=self._invalidate)

        gui.auto_commit(self.controlArea, self, "autocommit",
                        "Send Selected", "Send Automatically")

        grid = QGridLayout()

        self.tablemodel = QStandardItemModel(self)
        view = self.tableview = QTableView(
            editTriggers=QTableView.NoEditTriggers)
        view.setModel(self.tablemodel)
        view.horizontalHeader().hide()
        view.verticalHeader().hide()
        view.horizontalHeader().setMinimumSectionSize(60)
        view.selectionModel().selectionChanged.connect(self._invalidate)
        view.setShowGrid(False)
        view.setItemDelegate(BorderedItemDelegate(Qt.white))
        view.clicked.connect(self.cell_clicked)
        grid.addWidget(view, 0, 0)
        self.mainArea.layout().addLayout(grid)
Exemplo n.º 20
0
    def __init__(self):
        super(MainWindow, self).__init__(None)

        self.model = QSqlQueryModel(self)
        self.model.setQuery("select * from student")
        self.model.setHeaderData(0, Qt.Horizontal, self.tr("学号"))
        self.model.setHeaderData(1, Qt.Horizontal, self.tr("姓名"))
        self.model.setHeaderData(2, Qt.Horizontal, self.tr("课程"))
        self.view = QTableView(self)
        self.view.setModel(self.model)
        self.setCentralWidget(self.view)
Exemplo n.º 21
0
    def __init__(self, parent=None):
        super(TableWidget, self).__init__(parent)

        # Create a simple model for storing data.
        model = CustomTableModel()

        # Create the table view and add the model to it.
        tableView = QTableView()
        tableView.setModel(model)
        tableView.setMinimumWidth(300)
        tableView.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        tableView.verticalHeader().setResizeMode(QHeaderView.Stretch)

        chart = QChart()
        chart.setAnimationOptions(QChart.AllAnimations)

        # Series 1.
        series = QBarSeries()

        first = 3
        count = 5
        mapper = QVBarModelMapper(self)
        mapper.setFirstBarSetColumn(1)
        mapper.setLastBarSetColumn(4)
        mapper.setFirstRow(first)
        mapper.setRowCount(count)
        mapper.setSeries(series)
        mapper.setModel(model)
        chart.addSeries(series)

        # Get the color of the series and use it for showing the mapped area.
        for i, barset in enumerate(series.barSets()):
            seriesColorHex = '#' + hex(
                barset.brush().color().rgb()).upper()[-6:]
            model.addMapping(seriesColorHex,
                             QRect(1 + i, first, 1, barset.count()))

        categories = ["April", "May", "June", "July", "August"]
        axis = QBarCategoriesAxis(chart)
        axis.append(categories)
        chart.createDefaultAxes()
        chart.setAxisX(axis, series)

        chartView = QChartView(chart)
        chartView.setRenderHint(QPainter.Antialiasing)
        chartView.setMinimumSize(640, 480)

        # Create the main layout.
        mainLayout = QGridLayout()
        mainLayout.addWidget(tableView, 1, 0)
        mainLayout.addWidget(chartView, 1, 1)
        mainLayout.setColumnStretch(1, 1)
        mainLayout.setColumnStretch(0, 0)
        self.setLayout(mainLayout)
Exemplo n.º 22
0
    def createWidget(self):
        """
        Create qt widget
        """
        
        self.screenResolutionLabel = QLabel(self)
        self.screenTapLabel = QLabel(self)
        
        
        mobileLayout = QVBoxLayout()
        
        self.mobileDockToolbar = QToolBar(self)
        self.mobileDockToolbar.setStyleSheet("QToolBar { border: 0px }");
        self.mobileDockToolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        self.mobileImageLabel = QLabel(self)
        self.mobileImageLabel.setMouseTracking(True)
        self.mobileImageLabel.installEventFilter(self)
        self.mobileImageLabel.setScaledContents(True)
        self.mobileImageLabel.mousePressEvent = self.pixelSelect

        self.refreshCheckbox = QCheckBox("Automatic Refresh", self)
        self.refreshCheckbox.setEnabled(False)
        self.refreshCheckbox.stateChanged.connect(self.onRefreshChanged)
        
        self.clickCheckbox = QCheckBox("Enable Tap", self)
        self.clickCheckbox.setEnabled(False)

        self.model = DomModel(QDomDocument(), self)
        self.mobileTreeView = QTreeView(self)
        self.mobileTreeView.setMinimumWidth(300)
        self.mobileTreeView.setModel(self.model)
        self.mobileTreeView.clicked.connect(self.onTreeViewClicked)
        
        
        header=["Attribute", "Value"]
        self.tableModel = MyTableModel(self, [], header)
        self.mobileTableView = QTableView(self)
        self.mobileTableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.mobileTableView.setModel(self.tableModel)
        self.mobileTableView.setContextMenuPolicy(Qt.CustomContextMenu)
        self.mobileTableView.customContextMenuRequested.connect( self.onContextMenuEvent )
        self.mobileTableView.setMinimumWidth(300)

        mobileViewLayout = QHBoxLayout()
        mobileViewLayout.addWidget(self.mobileImageLabel)
        mobileViewLayout.addWidget(self.mobileTreeView)
        mobileViewLayout.addWidget(self.mobileTableView)

        mobileLayout.addWidget(self.mobileDockToolbar)
        mobileLayout.addLayout(mobileViewLayout)

        
        self.setLayout(mobileLayout)
Exemplo n.º 23
0
 def setModels(self):
     """Add the model to the view when the thread ended"""
     
     if self.showDirectResult:        
         table = QTableView()
         view = MSTableView(table, model=self.buildModel(self.sampleList[0].rawPeaks[0]), selection=True)
         self.qApp.view.addMdiSubWindow(view, "identification of mapped peaks of %s"%self.sampleList[0].shortName())
     
     currentSample = self.qApp.dockControl.currentSample[2]
     if currentSample is not None:
         MSDialogController.actualizeClusterModel(currentSample)
     self.qApp.view.showInformationMessage("Job Done", "Identification is done !")
Exemplo n.º 24
0
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.resize(640, 480)
        self.setWindowTitle('Model test')

        model = SqliteTableModel(con, 'tbl_symbols')
        table = QTableView()
        table.setModel(model)

        lay = QVBoxLayout()
        lay.addWidget(table)
        self.setLayout(lay)
Exemplo n.º 25
0
    def __init__(self, dataFrame, parent=None):
        super(DataFrameWidget, self).__init__(parent)

        self.dataModel = DataFrameModel()
        self.dataTable = QTableView()
        self.dataTable.setModel(self.dataModel)

        layout = QVBoxLayout()
        layout.addWidget(self.dataTable)
        self.setLayout(layout)
        # Set DataFrame
        self.setDataFrame(dataFrame)
Exemplo n.º 26
0
    def createTable(self, header, tabledata):
        """creates a table"""
        gridlayout2 = QGridLayout(self)
        gridlayout2.setObjectName("gridlayout2")

        tableView = QTableView(self)
        tableView.setObjectName("tableView")
        gridlayout2.addWidget(tableView, 0, 0, 1, 1)

        self.__popUp = QMenu(tableView)

        self.__copyAction = QAction(self.tr("Copy data"), tableView)
        self.connect(self.__copyAction, SIGNAL("triggered()"), self.copy)
        self.__popUp.addAction(self.__copyAction)

        tableView.setContextMenuPolicy(Qt.CustomContextMenu)
        self.connect(tableView, SIGNAL('customContextMenuRequested(QPoint)'),
                     self.popUpMenu)

        # set the table model
        tm = TableModel(tabledata, header, self)

        tableView.setModel(tm)
        tableView.setAlternatingRowColors(True)

        # set the minimum size
        self.setMinimumSize(400, 300)

        # hide grid
        tableView.setShowGrid(True)

        # set the font
        #font = QFont("Courier New", 12)
        #self.tableView.setFont(font)

        # hide vertical header
        vh = tableView.verticalHeader()
        vh.setVisible(True)

        # set horizontal header properties
        hh = tableView.horizontalHeader()
        hh.setStretchLastSection(True)

        # set column width to fit contents
        tableView.resizeColumnsToContents()
        tableView.setSortingEnabled(True)
        tableView.sortByColumn(0, Qt.AscendingOrder)

        # set row height
        nrows = len(tabledata)
        for row in xrange(nrows):
            tableView.setRowHeight(row, 18)
Exemplo n.º 27
0
 def data(self):
     self.db=QSqlDatabase.addDatabase("QSQLITE")
     self.db.setDatabaseName("test.db")
     self.db.open()
     query=QtSql.QSqlQuery("select * from COMPANY2")
     self.projectModel=QtSql.QSqlTableModel()
     self.projectModel.setQuery(query)
     self.projectModel.select()
     self.projectView = QTableView(self)
     self.projectView.setGeometry(10,60,940,560)
     self.projectView.setModel(self.projectModel)
     self.projectView.show()
     self.db.close()
Exemplo n.º 28
0
 def act1(self):
     orna=self.orno.text()
     self.db=QSqlDatabase.addDatabase("QSQLITE")
     self.db.setDatabaseName("test.db")
     self.db.open()
     query=QtSql.QSqlQuery("select * from COMPANY2 WHERE ORDER_NO =+orna+")
     self.projectMode2=QtSql.QSqlTableModel()
     self.projectMode2.setQuery(query)
     self.projectMode2.select()
     self.projectView1 = QTableView(self)
     self.projectView1.setGeometry(10,60,940,560)
     self.projectView1.setModel(self.projectMode2)
     self.projectView1.show()
     self.db.close()
Exemplo n.º 29
0
 def __init__(self, parent=None):
     super(charsPanel, self).__init__(parent)
     # Do the layout: refresh button and filter popup at the top,
     # with a table below.
     mainLayout = QVBoxLayout()
     self.setLayout(mainLayout)
     topLayout = QHBoxLayout()
     mainLayout.addLayout(topLayout, 0)
     self.refreshButton = QPushButton("Refresh")
     self.filterMenu = QComboBox()
     topLayout.addWidget(self.refreshButton, 0)
     topLayout.addStretch(1)
     topLayout.addWidget(self.filterMenu, 0)
     self.view = QTableView()
     self.view.setCornerButtonEnabled(False)
     self.view.setWordWrap(False)
     self.view.setAlternatingRowColors(True)
     mainLayout.addWidget(self.view, 1)
     # Set up the table model/view. Pass to the model a pointer
     # to the view so it can query the row under the mouse.
     self.model = myTableModel(view=self.view)
     #Interpose a sort filter proxy between the view and the model.
     self.proxy = mySortFilterProxy(self)
     self.proxy.setSourceModel(self.model)
     self.view.setModel(self.proxy)
     # Hook up the refresh button clicked signal to refresh below
     self.connect(self.refreshButton, SIGNAL("clicked()"), self.refresh)
     # Populate the filter popup with rows:
     # 0 : All - no filter
     # 1 : not 7-bit - show only things not in the 7-bit code
     # 2 : not Latin-1 - show only things outside Latin-1
     self.filterMenu.addItem(QString(u"All"))
     self.filterMenu.addItem(QString(u"\u00ac" + u" 7-bit"))
     self.filterMenu.addItem(QString(u"\u00ac" + u" Latin-1"))
     # The filters refer to these properties, called with a QChar C
     self.lambdaAll = lambda C: True
     self.lambdaNotAscii = lambda C: (C.unicode() < 32) or (C.unicode() >
                                                            126)
     self.lambdaNotLatin = lambda C: (C.toLatin1() == b'\x00')
     self.filterLambda = self.lambdaAll
     # Connect a user-selection in the popup to our filter method.
     self.connect(self.filterMenu, SIGNAL("activated(int)"), self.filter)
     # Connect doubleclicked from our table view to self.findThis
     self.connect(self.view, SIGNAL("doubleClicked(QModelIndex)"),
                  self.findThis)
     # Connect the model reset signals to functions to place and clear
     # a status message.
     self.connect(self.model, SIGNAL("modelAboutToBeReset()"),
                  self.sigResetStarting)
     self.connect(self.model, SIGNAL("modelReset()"), self.sigResetOver)
Exemplo n.º 30
0
 def __init__(self, parent = None):
     
     super(ListView, self).__init__(parent=parent)
     
     self.emptyMessage = QLabel("no elements defined yet")
     self.emptyMessage.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter )
     self.emptyMessage.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.addWidget(self.emptyMessage)
     
     self._table = QTableView()
     self.addWidget(self._table)
     self._table.clicked.connect(self.tableViewCellClicked)
     self._table.doubleClicked.connect(self.tableViewCellDoubleClicked)
     self._table.verticalHeader().sectionMoved.connect(self.rowMovedTest)
     self._table.setShowGrid(False)