Exemplo n.º 1
0
    def insertColumns(self, position, columns, parent=QtCore.QModelIndex()):
        self.beginInsertColumns(parent, position, position + columns - 1)
        success = self.rootItem.insertColumns(position, columns)
        self.endInsertColumns()

        return success
Exemplo n.º 2
0
 def parent(self, child):
     if not child.isValid():
         return QtCore.QModelIndex()
     return QtCore.QModelIndex()
Exemplo n.º 3
0
 def index(self, row, column, parent=QtCore.QModelIndex()):
     if (parent.isValid()):
         parentItem = parent.internalPointer()
         item = parentItem.child(row)
         return self.createIndex(row, column, item)
     return self.createIndex(row, column, self.itemRoot.child(row))
Exemplo n.º 4
0
 def appendInsertRow(self):
     self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(), 1)
     self._data.append(self._db.fields(self._table).keys())
     self.endInsertRows()
Exemplo n.º 5
0
 def columnCount(self, parent=QtCore.QModelIndex()):
     return len(self._headers)
Exemplo n.º 6
0
 def rowCount (self, parent=QtCore.QModelIndex()):
     """Return number of URL items."""
     return len(self.urls)
Exemplo n.º 7
0
 def parent (self, child=QtCore.QModelIndex()):
     """Return empty QModelIndex since the URL list is not hierarchical."""
     return QtCore.QModelIndex()
Exemplo n.º 8
0
    def setParams(self, params):
        date = QtCore.QDate.currentDate().addDays(-3)
        self.chkExpandDoctorGroups.setChecked(
            params.get('expandDoctorGroups', True))
        self.edtBegDate.setDate(params.get('begDate', firstMonthDay(date)))
        self.edtEndDate.setDate(params.get('endDate', lastMonthDay(date)))
        self.cmbOrgStructure.setValue(params.get('orgStructureId', None))
        self.chkWithoutDescendants.setChecked(
            params.get('withoutDescendants', False))
        self.cmbSpeciality.setValue(params.get('specialityId', None))
        self.cmbPerson.setValue(params.get('personId', None))
        if self.cmbAssistant.isEnabled() and self._assistantAvailable:
            self.cmbAssistant.setValue(params.get('assistantId', None))
        self.chkInsurerDoctors.setChecked(params.get('chkInsurer', False))
        self.on_chkInsurerDoctors_clicked(params.get('chkInsurer', False))
        self.cmbInsurerDoctors.setValue(params.get('insurerId', None))
        self.chkPodtver.setChecked(params.get('podtver', False))
        self.edtBegDatePodtver.setDate(
            params.get('begDatePodtver', firstMonthDay(date)))
        self.edtEndDatePodtver.setDate(
            params.get('endDatePodtver', lastMonthDay(date)))
        self.cmbPodtver.setCurrentIndex(params.get('podtverType', 0))
        self.cmbRefuseType.setValue(params.get('refuseType', None))
        self.chkWithoutModernisation.setChecked(
            params.get('withoutModernisation', False))
        self.chkDetailService.setChecked(params.get('detailService', False))
        self.chkDetailService.setEnabled(
            self.chkExpandDoctorGroups.isChecked())
        self.chkDetailServiceTypes.setChecked(
            params.get('detailServiceTypes', False))
        self.chkDetailServiceTypes.setEnabled(
            self.chkExpandDoctorGroups.isChecked())
        self.chkDetailPatients.setChecked(params.get('detailPatients', False))
        self.chkDetailPatients.setEnabled(
            self.chkExpandDoctorGroups.isChecked())
        self.lstServiceTypes.setEnabled(
            self.chkDetailServiceTypes.isChecked()
            and self.chkExpandDoctorGroups.isChecked())
        self.cmbClientOrganisation.setValue(
            params.get('clientOrganisationId', None))
        self.chkFreeInputWork.setChecked(params.get('freeInputWork', False))
        self.edtFreeInputWork.setText(params.get('freeInputWorkValue', ''))
        self.rbtnByActionEndDate.setChecked(
            params.get('byActionEndDate', False))
        self.cmbGroupBy.setCurrentIndex(
            params.get('groupBy', self.groupBySpeciality))
        self.cmbFinance.setValue(params.get('typeFinanceId', None))
        self.chkGroupAssistant.setChecked(params.get('groupAssistant', False))
        self.cmbEventPurpose.setValue(params.get('eventPurposeId', None))
        self.cmbEventType.setValue(params.get('eventTypeId', None))
        self.chkByOrgStructAction.setChecked(
            params.get('byOrgStructAction', False))

        selectedServiceTypes = params.get('serviceTypes')
        if selectedServiceTypes is not None:
            flags = self.lstServiceTypes.selectionCommand(QtCore.QModelIndex())
            selectionModel = self.lstServiceTypes.selectionModel()
            model = self.lstServiceTypes.model()
            self.lstServiceTypes.clearSelection()
            for idx in selectedServiceTypes:
                selectionModel.select(model.index(idx), flags)
Exemplo n.º 9
0
    def index(self, row, column, parent=QtCore.QModelIndex()):
        if not self.hasIndex(row, column, parent):
            return QtCore.QModelIndex()

        return self.createIndex(row, column, self.children[row])
Exemplo n.º 10
0
 def reset_fields(self):
     self.object_combo.setRootModelIndex(
         self.app.collection.index(0, 0, QtCore.QModelIndex()))
     self.box_combo.setRootModelIndex(
         self.app.collection.index(0, 0, QtCore.QModelIndex()))
Exemplo n.º 11
0
 def rowCount(self, parent=QtCore.QModelIndex()):
     return self.fileCount
Exemplo n.º 12
0
    def __init__(self, app):
        FlatCAMTool.__init__(self, app)

        ## Title
        title_label = QtGui.QLabel("<font size=4><b>%s</b></font>" %
                                   self.toolName)
        self.layout.addWidget(title_label)

        ## Form Layout
        form_layout = QtGui.QFormLayout()
        self.layout.addLayout(form_layout)

        ## Layer to mirror
        self.object_combo = QtGui.QComboBox()
        self.object_combo.setModel(self.app.collection)
        self.object_combo.setRootModelIndex(
            self.app.collection.index(0, 0, QtCore.QModelIndex()))

        self.botlay_label = QtGui.QLabel("Bottom Layer:")
        self.botlay_label.setToolTip("Layer to be mirrorer.")
        # form_layout.addRow("Bottom Layer:", self.object_combo)
        form_layout.addRow(self.botlay_label, self.object_combo)

        ## Axis
        self.mirror_axis = RadioSet([{
            'label': 'X',
            'value': 'X'
        }, {
            'label': 'Y',
            'value': 'Y'
        }])
        self.mirax_label = QtGui.QLabel("Mirror Axis:")
        self.mirax_label.setToolTip(
            "Mirror vertically (X) or horizontally (Y).")
        # form_layout.addRow("Mirror Axis:", self.mirror_axis)
        form_layout.addRow(self.mirax_label, self.mirror_axis)

        ## Axis Location
        self.axis_location = RadioSet([{
            'label': 'Point',
            'value': 'point'
        }, {
            'label': 'Box',
            'value': 'box'
        }])
        self.axloc_label = QtGui.QLabel("Axis Location:")
        self.axloc_label.setToolTip(
            "The axis should pass through a <b>point</b> or cut "
            "a specified <b>box</b> (in a Geometry object) in "
            "the middle.")
        # form_layout.addRow("Axis Location:", self.axis_location)
        form_layout.addRow(self.axloc_label, self.axis_location)

        ## Point/Box
        self.point_box_container = QtGui.QVBoxLayout()
        self.pb_label = QtGui.QLabel("Point/Box:")
        self.pb_label.setToolTip(
            "Specify the point (x, y) through which the mirror axis "
            "passes or the Geometry object containing a rectangle "
            "that the mirror axis cuts in half.")
        # form_layout.addRow("Point/Box:", self.point_box_container)
        form_layout.addRow(self.pb_label, self.point_box_container)

        self.point = EvalEntry()
        self.point_box_container.addWidget(self.point)
        self.box_combo = QtGui.QComboBox()
        self.box_combo.setModel(self.app.collection)
        self.box_combo.setRootModelIndex(
            self.app.collection.index(0, 0, QtCore.QModelIndex()))
        self.point_box_container.addWidget(self.box_combo)
        self.box_combo.hide()

        ## Alignment holes
        self.alignment_holes = EvalEntry()
        self.ah_label = QtGui.QLabel("Alignment Holes:")
        self.ah_label.setToolTip("Alignment holes (x1, y1), (x2, y2), ... "
                                 "on one side of the mirror axis.")
        form_layout.addRow(self.ah_label, self.alignment_holes)

        ## Drill diameter for alignment holes
        self.drill_dia = LengthEntry()
        self.dd_label = QtGui.QLabel("Drill diam.:")
        self.dd_label.setToolTip("Diameter of the drill for the "
                                 "alignment holes.")
        form_layout.addRow(self.dd_label, self.drill_dia)

        ## Buttons
        hlay = QtGui.QHBoxLayout()
        self.layout.addLayout(hlay)
        hlay.addStretch()
        self.create_alignment_hole_button = QtGui.QPushButton(
            "Create Alignment Drill")
        self.create_alignment_hole_button.setToolTip(
            "Creates an Excellon Object containing the "
            "specified alignment holes and their mirror "
            "images.")
        self.mirror_object_button = QtGui.QPushButton("Mirror Object")
        self.mirror_object_button.setToolTip(
            "Mirrors (flips) the specified object around "
            "the specified axis. Does not create a new "
            "object, but modifies it.")
        hlay.addWidget(self.create_alignment_hole_button)
        hlay.addWidget(self.mirror_object_button)

        self.layout.addStretch()

        ## Signals
        self.create_alignment_hole_button.clicked.connect(
            self.on_create_alignment_holes)
        self.mirror_object_button.clicked.connect(self.on_mirror)

        self.axis_location.group_toggle_fn = self.on_toggle_pointbox

        ## Initialize form
        self.mirror_axis.set_value('X')
        self.axis_location.set_value('point')
Exemplo n.º 13
0
 def columnCount(self, parent=QtCore.QModelIndex()):
     return self.rootItem.columnCount()
Exemplo n.º 14
0
    def rowCount(self, parent=QtCore.QModelIndex()):
        parentItem = self.getItem(parent)

        return parentItem.childCount()
Exemplo n.º 15
0
 def rowCount(self, index=QtCore.QModelIndex()):
     return self.df.shape[0]
Exemplo n.º 16
0
 def parent(self, child):  # pylint: disable=unused-argument,no-self-use
     return QtCore.QModelIndex()
Exemplo n.º 17
0
 def columnCount(self, index=QtCore.QModelIndex()):
     return self.df.shape[1]
Exemplo n.º 18
0
 def columnCount(self, parent=QtCore.QModelIndex()):
     return len(self.__column_names)
Exemplo n.º 19
0
 def columnCount (self, parent=QtCore.QModelIndex()):
     """Return number of header columns."""
     return len(Headers)
Exemplo n.º 20
0
 def hasChildren(self, index=QtCore.QModelIndex()):
     parent_item = index.internalPointer()
     return parent_item is None
Exemplo n.º 21
0
 def index (self, row, column, parent=QtCore.QModelIndex()):
     """Return index of URL item in given row and column."""
     return self.createIndex(row, column)
 def rowCount(self, parent=QtCore.QModelIndex()):
     return len(self.datatable.index)
Exemplo n.º 23
0
 def rowCount(self, parent=QtCore.QModelIndex()):
     return len(self._data)
 def columnCount(self, parent=QtCore.QModelIndex()):
     return len(self.datatable.columns.values)
Exemplo n.º 25
0
 def index(self, row, column, parent):
     if row < 0 or column < 0 or row >= self.rowCount(
             parent) or column >= self.columnCount(parent):
         return QtCore.QModelIndex()
     print "Index: %s: %s" % (row, column)
     return self.createIndex(row, column, row)
Exemplo n.º 26
0
Arquivo: main.py Projeto: acoat/vacumm
 def autosize_treeview_config(self):
     #self.treeview_config.setColumnWidth(0, 400)
     for column in range(self.model_config.columnCount(
             QtCore.QModelIndex())):
         self.treeview_config.resizeColumnToContents(column)
Exemplo n.º 27
0
Arquivo: phynx.py Projeto: rh66/praxes
 def __init__(self, parent=None):
     super(FileModel, self).__init__(parent)
     self.rootItem = RootItem(
         ['File/Group/Dataset', 'Description', 'Shape', 'Data Type'])
     self._idMap = {QtCore.QModelIndex().internalId(): self.rootItem}
Exemplo n.º 28
0
	def removeRow(self, row, parentIndex = QtCore.QModelIndex()):
		return self.removeRows(row, 1, parentIndex)
Exemplo n.º 29
0
 def rowCount(self, parent=QtCore.QModelIndex()):
     if (parent.isValid()):
         return parent.internalPointer().rowCount()
     return self.itemRoot.rowCount()
Exemplo n.º 30
0
 def flags(self, index=QtCore.QModelIndex()):
     if self.isEditable():
         return QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
     else:
         return QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled