def initUI(self): self.setGeometry(100, 100, 300, 300) self.vlayout = QtGui.QVBoxLayout(self) self.imgContainer = QtGui.QLabel(self) img = QtGui.QPixmap(':/europe.png') self.imgContainer.setPixmap(img) size = img.size() self.imgContainer.resize(size.width(), self.height()) self.vlayout.addWidget(self.imgContainer) self.vlayout.addWidget(QtGui.QLabel('FOOO', self)) threads = [] worker1 = ExampleWorker('foo', 10) worker2 = ExampleWorker('bar', 13) worker3 = ExampleWorker('spam', 25) workers = [worker1, worker2, worker3] for worker in workers: thread = createThread(self, worker) threads.append(thread) worker.finished.connect(self.debugPrint) self.pgFrame = OverlayProgressWidget(self.imgContainer, workers=workers) for t in threads: t.start()
def initUi(self): self.setModal(True) self.resize(303, 168) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) self.setSizePolicy(sizePolicy) self.verticalLayout = QtGui.QVBoxLayout(self) self.dialogHeading = QtGui.QLabel( self.tr('Add a new attribute column'), self) self.gridLayout = QtGui.QGridLayout() self.columnNameLineEdit = QtGui.QLineEdit(self) self.columnNameLabel = QtGui.QLabel(self.tr('Name'), self) self.dataTypeComboBox = QtGui.QComboBox(self) self.dataTypeComboBox.addItems(SupportedDtypes.names()) self.columnTypeLabel = QtGui.QLabel(self.tr('Type'), self) self.defaultValueLineEdit = QtGui.QLineEdit(self) self.lineEditValidator = DefaultValueValidator(self) self.defaultValueLineEdit.setValidator(self.lineEditValidator) self.defaultValueLabel = QtGui.QLabel(self.tr('Inital Value(s)'), self) self.gridLayout.addWidget(self.columnNameLabel, 0, 0, 1, 1) self.gridLayout.addWidget(self.columnNameLineEdit, 0, 1, 1, 1) self.gridLayout.addWidget(self.columnTypeLabel, 1, 0, 1, 1) self.gridLayout.addWidget(self.dataTypeComboBox, 1, 1, 1, 1) self.gridLayout.addWidget(self.defaultValueLabel, 2, 0, 1, 1) self.gridLayout.addWidget(self.defaultValueLineEdit, 2, 1, 1, 1) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.dialogHeading) self.verticalLayout.addLayout(self.gridLayout) self.verticalLayout.addWidget(self.buttonBox) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.dataTypeComboBox.currentIndexChanged.connect( self.updateValidatorDtype) self.updateValidatorDtype(self.dataTypeComboBox.currentIndex())
def initUi(self): self.setWindowTitle(self.tr('Remove Attributes')) self.setModal(True) self.resize(366, 274) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) self.setSizePolicy(sizePolicy) self.gridLayout = QtGui.QGridLayout(self) self.dialogHeading = QtGui.QLabel( self.tr('Select the attribute column(s) which shall be removed'), self) self.listView = QtGui.QListView(self) model = QtGui.QStandardItemModel() for column in self.columns: item = QtGui.QStandardItem(column) model.appendRow(item) self.listView.setModel(model) self.listView.setSelectionMode(QtGui.QListView.MultiSelection) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.gridLayout.addWidget(self.dialogHeading, 0, 0, 1, 1) self.gridLayout.addWidget(self.listView, 1, 0, 1, 1) self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject)
def _addProgressBar(self, worker): progressBar = QtGui.QProgressBar(self) progressBar.setMinimumHeight(self._pbHeight - 5) progressBar.setMaximumHeight(self._pbHeight - 5) label = QtGui.QLabel(worker.name, self) if not self.toggleButton.isChecked(): progressBar.hide() label.hide() row = self._addedBars + 1 self.glayout.addWidget(progressBar, row, 0, 1, 1) self.glayout.addWidget(label, row, 1, 1, 1) self._addedBars += 1 self._detailProgressBars.append((progressBar, label)) worker.progressChanged.connect(progressBar.setValue) worker.progressChanged.connect(self.calculateTotalProgress) worker.progressChanged.connect(self.debugProgressChanged)
def _initUI(self): """Initiates the user interface with a grid layout and several widgets. """ self.setModal(self._modal) self.setWindowTitle(self._windowTitle) layout = QtGui.QGridLayout() self._filenameLabel = QtGui.QLabel(u'Output File', self) self._filenameLineEdit = QtGui.QLineEdit(self) chooseFileButtonIcon = QtGui.QIcon( QtGui.QPixmap(':/icons/document-save-as.png')) self._chooseFileAction = QtGui.QAction(self) self._chooseFileAction.setIcon(chooseFileButtonIcon) self._chooseFileAction.triggered.connect(self._createFile) self._chooseFileButton = QtGui.QToolButton(self) self._chooseFileButton.setDefaultAction(self._chooseFileAction) layout.addWidget(self._filenameLabel, 0, 0) layout.addWidget(self._filenameLineEdit, 0, 1, 1, 2) layout.addWidget(self._chooseFileButton, 0, 3) self._encodingLabel = QtGui.QLabel(u'File Encoding', self) encoding_names = map(lambda x: x.upper(), sorted(list(set(_encodings.viewvalues())))) self._encodingComboBox = QtGui.QComboBox(self) self._encodingComboBox.addItems(encoding_names) self._idx = encoding_names.index('UTF_8') self._encodingComboBox.setCurrentIndex(self._idx) #self._encodingComboBox.activated.connect(self._updateEncoding) layout.addWidget(self._encodingLabel, 1, 0) layout.addWidget(self._encodingComboBox, 1, 1, 1, 1) self._hasHeaderLabel = QtGui.QLabel(u'Header Available?', self) self._headerCheckBox = QtGui.QCheckBox(self) #self._headerCheckBox.toggled.connect(self._updateHeader) layout.addWidget(self._hasHeaderLabel, 2, 0) layout.addWidget(self._headerCheckBox, 2, 1) self._delimiterLabel = QtGui.QLabel(u'Column Delimiter', self) self._delimiterBox = DelimiterSelectionWidget(self) layout.addWidget(self._delimiterLabel, 3, 0) layout.addWidget(self._delimiterBox, 3, 1, 1, 3) self._exportButton = QtGui.QPushButton(u'Export Data', self) self._cancelButton = QtGui.QPushButton(u'Cancel', self) self._buttonBox = QtGui.QDialogButtonBox(self) self._buttonBox.addButton(self._exportButton, QtGui.QDialogButtonBox.AcceptRole) self._buttonBox.addButton(self._cancelButton, QtGui.QDialogButtonBox.RejectRole) self._buttonBox.accepted.connect(self.accepted) self._buttonBox.rejected.connect(self.rejected) layout.addWidget(self._buttonBox, 5, 2, 1, 2) self._exportButton.setDefault(False) self._filenameLineEdit.setFocus() self._statusBar = QtGui.QStatusBar(self) self._statusBar.setSizeGripEnabled(False) layout.addWidget(self._statusBar, 4, 0, 1, 4) self.setLayout(layout)
def _initUI(self): """Initiates the user interface with a grid layout and several widgets. """ self.setModal(self._modal) self.setWindowTitle(self._windowTitle) layout = QtGui.QGridLayout() self._filenameLabel = QtGui.QLabel(u'Choose File', self) self._filenameLineEdit = QtGui.QLineEdit(self) self._filenameLineEdit.textEdited.connect(self._updateFilename) chooseFileButtonIcon = QtGui.QIcon( QtGui.QPixmap(':/icons/document-open.png')) self._chooseFileAction = QtGui.QAction(self) self._chooseFileAction.setIcon(chooseFileButtonIcon) self._chooseFileAction.triggered.connect(self._openFile) self._chooseFileButton = QtGui.QToolButton(self) self._chooseFileButton.setDefaultAction(self._chooseFileAction) layout.addWidget(self._filenameLabel, 0, 0) layout.addWidget(self._filenameLineEdit, 0, 1, 1, 2) layout.addWidget(self._chooseFileButton, 0, 3) self._encodingLabel = QtGui.QLabel(u'File Encoding', self) encoding_names = map(lambda x: x.upper(), sorted(list(set(_encodings.viewvalues())))) self._encodingComboBox = QtGui.QComboBox(self) self._encodingComboBox.addItems(encoding_names) self._encodingComboBox.activated.connect(self._updateEncoding) layout.addWidget(self._encodingLabel, 1, 0) layout.addWidget(self._encodingComboBox, 1, 1, 1, 1) self._hasHeaderLabel = QtGui.QLabel(u'Header Available?', self) self._headerCheckBox = QtGui.QCheckBox(self) self._headerCheckBox.toggled.connect(self._updateHeader) layout.addWidget(self._hasHeaderLabel, 2, 0) layout.addWidget(self._headerCheckBox, 2, 1) self._delimiterLabel = QtGui.QLabel(u'Column Delimiter', self) self._delimiterBox = DelimiterSelectionWidget(self) self._delimiter = self._delimiterBox.currentSelected() self._delimiterBox.delimiter.connect(self._updateDelimiter) layout.addWidget(self._delimiterLabel, 3, 0) layout.addWidget(self._delimiterBox, 3, 1, 1, 3) self._tabWidget = QtGui.QTabWidget(self) self._previewTableView = QtGui.QTableView(self) self._datatypeTableView = QtGui.QTableView(self) self._tabWidget.addTab(self._previewTableView, u'Preview') self._tabWidget.addTab(self._datatypeTableView, u'Change Column Types') layout.addWidget(self._tabWidget, 4, 0, 3, 4) self._datatypeTableView.horizontalHeader().setDefaultSectionSize(200) self._datatypeTableView.setItemDelegateForColumn( 1, DtypeComboDelegate(self._datatypeTableView)) self._loadButton = QtGui.QPushButton(u'Load Data', self) #self.loadButton.setAutoDefault(False) self._cancelButton = QtGui.QPushButton(u'Cancel', self) # self.cancelButton.setDefault(False) # self.cancelButton.setAutoDefault(True) self._buttonBox = QtGui.QDialogButtonBox(self) self._buttonBox.addButton(self._loadButton, QtGui.QDialogButtonBox.AcceptRole) self._buttonBox.addButton(self._cancelButton, QtGui.QDialogButtonBox.RejectRole) self._buttonBox.accepted.connect(self.accepted) self._buttonBox.rejected.connect(self.rejected) layout.addWidget(self._buttonBox, 9, 2, 1, 2) self._loadButton.setDefault(False) self._filenameLineEdit.setFocus() self._statusBar = QtGui.QStatusBar(self) self._statusBar.setSizeGripEnabled(False) layout.addWidget(self._statusBar, 8, 0, 1, 4) self.setLayout(layout)
def __init__(self, parent=None): super(TestWidget, self).__init__(parent) self.resize(1680, 756) self.move(0, 0) self.df = pandas.DataFrame() self.dataModel = None # init the data view's self.dataTableView = DataTableWidget(self) # self.dataTableView.setSortingEnabled(True) # self.dataTableView.setAlternatingRowColors(True) self.dataListView = QtGui.QListView(self) self.dataListView.setAlternatingRowColors(True) self.dataComboBox = QtGui.QComboBox(self) # make combobox to choose the model column for dataComboBox and dataListView self.chooseColumnComboBox = QtGui.QComboBox(self) self.buttonCsvData = QtGui.QPushButton("load csv data") self.buttonRandomData = QtGui.QPushButton("load random data") importDialog = CSVImportDialog(self) importDialog.load.connect(self.updateModel) self.buttonCsvData.clicked.connect(lambda: importDialog.show()) self.buttonRandomData.clicked.connect( lambda: self.setDataFrame(getRandomData(rows=100, columns=100))) self.exportDialog = CSVExportDialog(self) self.buttonCSVExport = QtGui.QPushButton("export to csv") self.buttonCSVExport.clicked.connect(self._exportModel) self.buttonLayout = QtGui.QHBoxLayout() self.buttonLayout.addWidget(self.buttonCsvData) self.buttonLayout.addWidget(self.buttonCSVExport) self.buttonLayout.addWidget(self.buttonRandomData) self.mainLayout = QtGui.QVBoxLayout() self.setLayout(self.mainLayout) self.mainLayout.addLayout(self.buttonLayout) self.mainLayout.addWidget(self.dataTableView) self.spinbox = QtGui.QSpinBox() self.mainLayout.addWidget(self.spinbox) self.spinbox.setMaximum(99999999999) self.spinbox.setValue(99999999999) self.rightLayout = QtGui.QVBoxLayout() self.chooseColumLayout = QtGui.QHBoxLayout() self.mainLayout.addLayout(self.rightLayout) self.rightLayout.addLayout(self.chooseColumLayout) self.chooseColumLayout.addWidget(QtGui.QLabel("Choose column:")) self.chooseColumLayout.addWidget(self.chooseColumnComboBox) self.rightLayout.addWidget(self.dataListView) self.rightLayout.addWidget(self.dataComboBox) self.tableViewColumnDtypes = QtGui.QTableView(self) self.rightLayout.addWidget(QtGui.QLabel('dtypes')) self.rightLayout.addWidget(self.tableViewColumnDtypes) self.buttonGoToColumn = QtGui.QPushButton("go to column") self.rightLayout.addWidget(self.buttonGoToColumn) self.buttonGoToColumn.clicked.connect(self.goToColumn) self.buttonSetFilter = QtGui.QPushButton("set filter") self.rightLayout.addWidget(self.buttonSetFilter) self.buttonSetFilter.clicked.connect(self.setFilter) self.buttonClearFilter = QtGui.QPushButton("clear filter") self.rightLayout.addWidget(self.buttonClearFilter) self.buttonClearFilter.clicked.connect(self.clearFilter) self.lineEditFilterCondition = QtGui.QLineEdit("freeSearch('am')") self.rightLayout.addWidget(self.lineEditFilterCondition) self.chooseColumnComboBox.currentIndexChanged.connect( self.setModelColumn) self.dataListView.mouseReleaseEvent = self.mouseReleaseEvent self.dropLineEdit = DropLineEdit("drop data from table here", self) self.rightLayout.addWidget(self.dropLineEdit) self.dropWidget = ComplexDropWidget(self) self.dropWidget.dropRecieved.connect(self.processDataDrops) self.rightLayout.addWidget(self.dropWidget)