def __init__(self): super().__init__(QPixmap(":/sheep_baby.png")) self.mimetext = "application/x-sheep"
def targetStopped(self, _): self.ui.statusLabel.setText("Stopped") self.ui.statusIcon.setPixmap(QPixmap(":/icons/images/22x22/stopped.png")) self.enableButtons() self.act.Interrupt.setEnabled(False)
def set_widgets(self): """Set widgets on the Disjoint Layers tab""" self.lblIconDisjoint_1.setPixmap( QPixmap(resources_path('img', 'wizard', 'icon-stop.svg')))
def updateModificationState(self): modified = self.document().isModified() pixmap = icons.get('document-save').pixmap(16) if modified else QPixmap() self.status.state.setPixmap(pixmap)
def __init__(self, parent=None): QWidget.__init__(self, parent) icon = QIcon() icon.addPixmap(QPixmap(":/freeseer/logo.png"), QIcon.Normal, QIcon.Off) self.setWindowIcon(icon) self.resize(400, 400) self.mainLayout = QVBoxLayout() self.setLayout(self.mainLayout) boldFont = QFont() boldFont.setBold(True) # Control bar self.controlRow = QHBoxLayout() self.mainLayout.addLayout(self.controlRow) self.standbyIcon = QIcon.fromTheme("system-shutdown") recordFallbackIcon = QIcon(":/multimedia/record.png") self.recordIcon = QIcon.fromTheme("media-record", recordFallbackIcon) stopFallbackIcon = QIcon(":/multimedia/stop.png") self.stopIcon = QIcon.fromTheme("media-playback-stop", stopFallbackIcon) self.pauseIcon = QIcon.fromTheme("media-playback-pause") self.resumeIcon = QIcon.fromTheme("media-playback-start") self.headphoneIcon = QIcon() self.headphoneIcon.addPixmap(QPixmap(":/multimedia/headphones.png"), QIcon.Normal, QIcon.Off) self.standbyPushButton = QPushButton("Standby") self.standbyPushButton.setToolTip("Standby") self.standbyPushButton.setMinimumSize(QSize(0, 40)) self.standbyPushButton.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.standbyPushButton.setIcon(self.standbyIcon) self.standbyPushButton.setCheckable(True) self.standbyPushButton.setObjectName("standbyButton") self.controlRow.addWidget(self.standbyPushButton) self.recordPushButton = QPushButton("Record") self.recordPushButton.setToolTip("Record") self.recordPushButton.setMinimumSize(QSize(0, 40)) self.recordPushButton.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.recordPushButton.setIcon(self.recordIcon) self.recordPushButton.setHidden(True) self.recordPushButton.setEnabled(False) self.recordPushButton.setCheckable(True) self.recordPushButton.setObjectName("recordButton") self.controlRow.addWidget(self.recordPushButton) self.connect(self.recordPushButton, SIGNAL("toggled(bool)"), self.setRecordIcon) self.pauseToolButton = QToolButton() self.pauseToolButton.setText("Pause") self.pauseToolButton.setToolTip("Pause") self.pauseToolButton.setIcon(self.pauseIcon) self.pauseToolButton.setMinimumSize(QSize(40, 40)) self.pauseToolButton.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.pauseToolButton.setHidden(True) self.pauseToolButton.setEnabled(False) self.pauseToolButton.setCheckable(True) self.controlRow.addWidget(self.pauseToolButton) self.connect(self.pauseToolButton, SIGNAL("toggled(bool)"), self.setPauseIcon) playbackIcon = QIcon.fromTheme("video-x-generic") self.playPushButton = QPushButton() self.playPushButton.setText("Play Video") self.playPushButton.setToolTip("Play last recorded Video") self.playPushButton.setIcon(playbackIcon) self.playPushButton.setMinimumSize(QSize(40, 40)) self.playPushButton.setMaximumSize(QSize(120, 40)) self.playPushButton.setHidden(True) self.playPushButton.setEnabled(False) self.playPushButton.setCheckable(True) self.controlRow.addWidget(self.playPushButton) # Filter bar self.filterBarLayout = QVBoxLayout() self.mainLayout.addLayout(self.filterBarLayout) self.filterBarLayoutRow_1 = QHBoxLayout() self.filterBarLayout.addLayout(self.filterBarLayoutRow_1) self.eventLabel = QLabel("Event") self.eventLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.eventComboBox = QComboBox() self.eventLabel.setBuddy(self.eventComboBox) self.roomLabel = QLabel("Room") self.roomLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.roomComboBox = QComboBox() self.roomLabel.setBuddy(self.roomComboBox) self.dateLabel = QLabel("Date") self.dateLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.dateComboBox = QComboBox() self.dateLabel.setBuddy(self.dateComboBox) self.filterBarLayoutRow_1.addWidget(self.eventLabel) self.filterBarLayoutRow_1.addWidget(self.eventComboBox) self.filterBarLayoutRow_1.addWidget(self.roomLabel) self.filterBarLayoutRow_1.addWidget(self.roomComboBox) self.filterBarLayoutRow_1.addWidget(self.dateLabel) self.filterBarLayoutRow_1.addWidget(self.dateComboBox) self.filterBarLayoutRow_2 = QHBoxLayout() self.filterBarLayout.addLayout(self.filterBarLayoutRow_2) self.talkLabel = QLabel("Talk ") self.talkLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.talkComboBox = QComboBox() self.talkComboBox.setFont(boldFont) self.talkComboBox.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) self.talkComboBox.setSizeAdjustPolicy( QComboBox.AdjustToMinimumContentsLength) self.filterBarLayoutRow_2.addWidget(self.talkLabel) self.filterBarLayoutRow_2.addWidget(self.talkComboBox) # Preview Layout self.previewLayout = QHBoxLayout() self.mainLayout.addLayout(self.previewLayout) self.previewWidget = QWidget() self.audioSlider = QSlider() self.audioSlider.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.audioSlider.setEnabled(False) self.previewLayout.addWidget(self.previewWidget) self.previewLayout.addWidget(self.audioSlider) self.statusLabel = QLabel() self.mainLayout.addWidget(self.statusLabel) # Audio Feedback Checkbox self.audioFeedbackCheckbox = QCheckBox() self.audioFeedbackCheckbox.setLayoutDirection(Qt.RightToLeft) self.audioFeedbackCheckbox.setIcon(self.headphoneIcon) self.audioFeedbackCheckbox.setToolTip("Enable Audio Feedback") self.mainLayout.addWidget(self.audioFeedbackCheckbox)
def set_widgets(self): """Set widgets on the Aggregation Layer Disjoint tab.""" self.lblIconDisjoint_2.setPixmap( QPixmap(resources_path('img', 'wizard', 'icon-stop.svg')))
def slotClearIcon(self): self.icon.setPixmap(QPixmap(0, 0))
def paintEvent(self, event): page_bottom = self.edit.viewport().height() font_metrics = QFontMetrics(self.edit.document().defaultFont()) current_block = self.edit.document().findBlock( self.edit.textCursor().position()) pattern = self.pat if self.edit.lang == "python" else self.patNotPython painter = QPainter(self) background = resources.CUSTOM_SCHEME.get('sidebar-background', resources.COLOR_SCHEME['sidebar-background']) foreground = resources.CUSTOM_SCHEME.get('sidebar-foreground', resources.COLOR_SCHEME['sidebar-foreground']) painter.fillRect(self.rect(), QColor(background)) block = self.edit.firstVisibleBlock() viewport_offset = self.edit.contentOffset() line_count = block.blockNumber() painter.setFont(self.edit.document().defaultFont()) while block.isValid(): line_count += 1 # The top left position of the block in the document position = self.edit.blockBoundingGeometry(block).topLeft() + \ viewport_offset # Check if the position of the block is outside of the visible area if position.y() > page_bottom: break # Set the Painter Pen depending on special lines painter.setPen(QColor(foreground)) error = False checkers = sorted(self._neditable.registered_checkers, key=lambda x: x[2], reverse=True) for items in checkers: checker, color, _ = items if (line_count - 1) in checker.checks: painter.setPen(QColor(color)) font = painter.font() font.setItalic(True) font.setUnderline(True) painter.setFont(font) error = True break # We want the line number for the selected line to be bold. bold = False if block == current_block: bold = True font = painter.font() font.setBold(True) painter.setFont(font) # Draw the line number right justified at the y position of the # line. 3 is a magic padding number. drawText(x, y, text). if block.isVisible(): painter.drawText(self.width() - self.foldArea - font_metrics.width(str(line_count)) - 3, round(position.y()) + font_metrics.ascent() + font_metrics.descent() - 1, str(line_count)) # Remove the bold style if it was set previously. if bold: font = painter.font() font.setBold(False) painter.setFont(font) if error: font = painter.font() font.setItalic(False) font.setUnderline(False) painter.setFont(font) block = block.next() self.highest_line = line_count #Code Folding xofs = self.width() - self.foldArea painter.fillRect(xofs, 0, self.foldArea, self.height(), QColor(resources.CUSTOM_SCHEME.get('fold-area', resources.COLOR_SCHEME['fold-area']))) if self.foldArea != self.rightArrowIcon.width(): polygon = QPolygonF() self.rightArrowIcon = QPixmap(self.foldArea, self.foldArea) self.rightArrowIcon.fill(Qt.transparent) self.downArrowIcon = QPixmap(self.foldArea, self.foldArea) self.downArrowIcon.fill(Qt.transparent) polygon.append(QPointF(self.foldArea * 0.4, self.foldArea * 0.25)) polygon.append(QPointF(self.foldArea * 0.4, self.foldArea * 0.75)) polygon.append(QPointF(self.foldArea * 0.8, self.foldArea * 0.5)) iconPainter = QPainter(self.rightArrowIcon) iconPainter.setRenderHint(QPainter.Antialiasing) iconPainter.setPen(Qt.NoPen) iconPainter.setBrush(QColor( resources.CUSTOM_SCHEME.get('fold-arrow', resources.COLOR_SCHEME['fold-arrow']))) iconPainter.drawPolygon(polygon) polygon.clear() polygon.append(QPointF(self.foldArea * 0.25, self.foldArea * 0.4)) polygon.append(QPointF(self.foldArea * 0.75, self.foldArea * 0.4)) polygon.append(QPointF(self.foldArea * 0.5, self.foldArea * 0.8)) iconPainter = QPainter(self.downArrowIcon) iconPainter.setRenderHint(QPainter.Antialiasing) iconPainter.setPen(Qt.NoPen) iconPainter.setBrush(QColor( resources.CUSTOM_SCHEME.get('fold-arrow', resources.COLOR_SCHEME['fold-arrow']))) iconPainter.drawPolygon(polygon) self.calculate_docstring_block_fold() block = self.edit.firstVisibleBlock() while block.isValid(): position = self.edit.blockBoundingGeometry( block).topLeft() + viewport_offset #Check if the position of the block is outside of the visible area if position.y() > page_bottom: break if pattern.match(block.text()) and block.isVisible(): can_fold = True if self.patComment.match(block.text()) and \ (block.blockNumber() in self._endDocstringBlocks): can_fold = False if can_fold: if block.blockNumber() in self.foldedBlocks: painter.drawPixmap(xofs, round(position.y()), self.rightArrowIcon) else: painter.drawPixmap(xofs, round(position.y()), self.downArrowIcon) #Add Bookmarks and Breakpoint if block.blockNumber() in self.breakpoints: linear_gradient = QLinearGradient( xofs, round(position.y()), xofs + self.foldArea, round(position.y()) + self.foldArea) linear_gradient.setColorAt(0, QColor(255, 11, 11)) linear_gradient.setColorAt(1, QColor(147, 9, 9)) painter.setRenderHints(QPainter.Antialiasing, True) painter.setPen(Qt.NoPen) painter.setBrush(QBrush(linear_gradient)) painter.drawEllipse( xofs + 1, round(position.y()) + 6, self.foldArea - 1, self.foldArea - 1) elif block.blockNumber() in self.bookmarks: linear_gradient = QLinearGradient( xofs, round(position.y()), xofs + self.foldArea, round(position.y()) + self.foldArea) linear_gradient.setColorAt(0, QColor(13, 62, 243)) linear_gradient.setColorAt(1, QColor(5, 27, 106)) painter.setRenderHints(QPainter.Antialiasing, True) painter.setPen(Qt.NoPen) painter.setBrush(QBrush(linear_gradient)) painter.drawRoundedRect( xofs + 1, round(position.y()) + 6, self.foldArea - 2, self.foldArea - 1, 3, 3) block = block.next() painter.end() QWidget.paintEvent(self, event)
def set_widgets(self): """Set widgets on the Aggregation Layer From Browser tab.""" self.tvBrowserAggregation_selection_changed() # Set icon self.lblIconIFCWAggregationFromBrowser.setPixmap(QPixmap(None))
def start(listener, filenames=None, projects_path=None, extra_plugins=None): app = QApplication(sys.argv) QCoreApplication.setOrganizationName('NINJA-IDE') QCoreApplication.setOrganizationDomain('NINJA-IDE') QCoreApplication.setApplicationName('NINJA-IDE') app.setWindowIcon(QIcon(resources.IMAGES['icon'])) # Create and display the splash screen splash_pix = QPixmap(resources.IMAGES['splash']) splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() # Set the cursor to unblinking app.setCursorFlashTime(0) #Set the codec for strings (QString) QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8')) #Translator qsettings = QSettings() language = QLocale.system().language() lang = unicode( qsettings.value('preferences/interface/language', language).toString()) + '.qm' lang_path = file_manager.create_path(resources.LANGS, unicode(lang)) if file_manager.file_exists(lang_path): settings.LANGUAGE = lang_path elif file_manager.file_exists( file_manager.create_path(resources.LANGS_DOWNLOAD, unicode(lang))): settings.LANGUAGE = file_manager.create_path(resources.LANGS_DOWNLOAD, unicode(lang)) translator = QTranslator() if settings.LANGUAGE: translator.load(settings.LANGUAGE) app.installTranslator(translator) #Loading Syntax splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black) json_manager.load_syntax() #Read Settings splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop, Qt.black) settings.load_settings() #Loading Themes splash.showMessage("Loading Themes", Qt.AlignRight | Qt.AlignTop, Qt.black) scheme = unicode( qsettings.value('preferences/editor/scheme', "default").toString()) if scheme != 'default': scheme = file_manager.create_path(resources.EDITOR_SKINS, scheme + '.color') if file_manager.file_exists(scheme): resources.CUSTOM_SCHEME = json_manager.parse(open(scheme)) #Loading Shortcuts resources.load_shortcuts() #Loading GUI splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black) ide = IDE() #Showing GUI ide.show() #Connect listener signals ide.connect(listener, SIGNAL("fileOpenRequested(QString)"), ide.open_file) ide.connect(listener, SIGNAL("projectOpenRequested(QString)"), ide.open_project) #Loading Session Files splash.showMessage("Loading Files and Projects", Qt.AlignRight | Qt.AlignTop, Qt.black) #Files in Main Tab mainFiles = qsettings.value('openFiles/mainTab', []).toList() tempFiles = [] for file_ in mainFiles: fileData = file_.toList() tempFiles.append( (unicode(fileData[0].toString()), fileData[1].toInt()[0])) mainFiles = tempFiles #Files in Secondary Tab secondaryFiles = qsettings.value('openFiles/secondaryTab', []).toList() tempFiles = [] for file_ in secondaryFiles: fileData = file_.toList() tempFiles.append( (unicode(fileData[0].toString()), fileData[1].toInt()[0])) secondaryFiles = tempFiles #Projects projects = qsettings.value('openFiles/projects', []).toList() projects = [unicode(project.toString()) for project in projects] #Include files received from console args if filenames: mainFiles += [(f, 0) for f in filenames] #Include projects received from console args if projects_path: projects += projects_path ide.load_session_files_projects(mainFiles, secondaryFiles, projects) #Load external plugins if extra_plugins: ide.load_external_plugins(extra_plugins) splash.finish(ide) ide.notify_plugin_errors() sys.exit(app.exec_())
def data(self, index, role): """ \reimp Nodes' pointers are encapsulated in QStandardItem (role : Qt.UserRole + 1). Most of the data can only be retrieved only if the node is retrieved: * The node name * The node icon * ... To do so, the TreeModel.data() method calls the QStandardItemModel.data() method by passing the `index` parameter and `Qt.UserRole + 1` or `Qt.UserRole + 2` to it. In the second case, it retrieves a boolean used to know if the node is already expended and returns directly. \param index the index of the data we want to get \param role the role of the data we want to retrieve \return a QVariant containing the data, or an invalid QVariant if the data could not be retrieved. """ if not index.isValid(): return QVariant() # Qt.UserRole + 2 contain a boolean indicating if the node has already been expanded # in the tree. if role == Qt.UserRole + 3: return QStandardItemModel.data(self, index, role) if role == Qt.UserRole + 2: return QStandardItemModel.data(self, index, role) # call QStandardItemModel.data method with a Qt.UserRole + 1 to get the pointer on the node # (returns a invalid QVariant if the node or the data is None) data = QStandardItemModel.data(self, index, Qt.UserRole + 1) if not data.isValid(): return data # getting the node or returning an invalid QVariant() if the node is not valid node = self.VFS.getNodeFromPointer(data.toULongLong()[0]) if node == None: return QVariant() # if role == UserRole + 1, it means that the node itself must be returned (the pointer # on the node, encapsulated in a QVariant() if role == (Qt.UserRole + 1): return data # in other cases, returns the requires data : icon, color, etc. or an invalid QVariant() # if the role does not correpond to anything. if role == Qt.DisplayRole : return QVariant(QString.fromUtf8(node.name())) if role == Qt.DecorationRole: pixmap = QPixmap(node.icon()) if node.hasChildren(): try: pfsobj = node.children()[0].fsobj().this except AttributeError: pfsobj = None try: nfsobj = node.fsobj().this except AttributeError: nfsobj = None if pfsobj != nfsobj: pixmap = pixmap.scaled(QSize(128, 128), Qt.KeepAspectRatio) painter = QPainter(pixmap) rootPixmap = QPixmap(":root") painter.drawPixmap(0, 0, rootPixmap) painter.end() return QVariant(QIcon(pixmap)) if role == Qt.BackgroundRole: if index == self.currentIndex: palette = QPalette().color(QPalette.Highlight) return QVariant(QColor(palette)) if role == Qt.ForegroundRole: if (index == self.currentIndex) and not node.isDeleted(): palette = QPalette().color(QPalette.HighlightedText) return QVariant(QColor(palette)) if node.isDeleted(): return QVariant(QColor(Qt.red)) if self.ch == True: if role == Qt.CheckStateRole: if index.column() == 0: if long(node.this) in self.selection.get(): return Qt.Checked else: return Qt.Unchecked return QVariant()
def __init__(self, image): QLabel.__init__(self) itab_item.ITabItem.__init__(self) pixmap = QPixmap(image) self.setPixmap(pixmap) self._id = image
def _set_zoomout_view(self, view): view.setInteractive(True) view.setDragMode(QGraphicsView.NoDrag) view.setCursor(QCursor(QPixmap(":/icons/gtk-zoom-out.png")))
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(1500, 842) MainWindow.setAutoFillBackground(False) MainWindow.setStyleSheet(_fromUtf8("background-color: rgb(197, 197, 197)")) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.stackedWidget = QtGui.QStackedWidget(self.centralwidget) self.stackedWidget.setGeometry(QtCore.QRect(0, 0, 1500, 842)) self.stackedWidget.setObjectName(_fromUtf8("stackedWidget")) self.page1 = QtGui.QWidget() self.page1.setObjectName(_fromUtf8("page")) self.lineEdit1 = QtGui.QLineEdit(self.page1) self.lineEdit1.setGeometry(QtCore.QRect(810, 340, 129, 27)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit1.sizePolicy().hasHeightForWidth()) self.lineEdit1.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily(_fromUtf8("URW Chancery L")) font.setPointSize(18) #self.lineEdit1.setStyleSheet(_fromUtf8("background-color: rgb(166, 166, 166)")) self.lineEdit1.setFont(font) self.lineEdit1.setAutoFillBackground(True) self.lineEdit1.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase) self.lineEdit1.setObjectName(_fromUtf8("lineEdit1")) self.label1 = QtGui.QLabel(self.page1) self.label1.setGeometry(QtCore.QRect(600, 320, 191, 71)) font = QtGui.QFont() font.setFamily(_fromUtf8("URW Palladio L")) font.setPointSize(24) self.label1.setFont(font) self.label1.setAutoFillBackground(False) self.label1.setObjectName(_fromUtf8("label1")) self.lineEdit1_2 = QtGui.QLineEdit(self.page1) self.lineEdit1_2.setGeometry(QtCore.QRect(810, 420, 129, 27)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit1_2.sizePolicy().hasHeightForWidth()) self.lineEdit1_2.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily(_fromUtf8("URW Chancery L")) font.setPointSize(18) self.lineEdit1_2.setFont(font) #self.lineEdit1_2.setStyleSheet(_fromUtf8("background-color: rgb(166, 166, 166)")) self.lineEdit1_2.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase) self.lineEdit1_2.setObjectName(_fromUtf8("lineEdit1_2")) self.label1_2 = QtGui.QLabel(self.page1) self.label1_2.setGeometry(QtCore.QRect(600, 390, 191, 81)) font = QtGui.QFont() font.setFamily(_fromUtf8("URW Palladio L")) font.setPointSize(24) self.label1_2.setFont(font) self.label1_2.setAutoFillBackground(True) self.label1_2.setObjectName(_fromUtf8("label1_2")) self.label = QtGui.QLabel(self.page1) self.pixmap = QPixmap('small_400.jpg') self.label.setPixmap(self.pixmap) self.label.setGeometry(QtCore.QRect(560, 70, 400, 233)) self.label.setAutoFillBackground(True) self.label.setObjectName(_fromUtf8("label")) self.proceed = QtGui.QPushButton(self.page1) #self.proceed.setStyleSheet(_fromUtf8("background-color: rgb(166, 166, 166)")) self.proceed.setGeometry(QtCore.QRect(730, 490, 121, 31)) self.proceed.setObjectName(_fromUtf8("proceed")) self.proceed.clicked.connect(self.getInterface) self.stackedWidget.addWidget(self.page1) self.page2 = QtGui.QWidget() self.page2.setObjectName(_fromUtf8("page")) self.verticalLayout = QtGui.QVBoxLayout(self.page2) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setSizeConstraint(QtGui.QLayout.SetMaximumSize) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.horizontalLayout_2.setContentsMargins(-1, -1, -1, 10) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setContentsMargins(-1, 0, -1, -1) self.verticalLayout_4.setSpacing(30) self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.w = QtGui.QWidget() self.b = QtGui.QLabel(self.w) self.b.setText("Sniffing on interface:") self.c = QtGui.QLabel(self.w) self.c.setText("Timeout Limit") self.d = QtGui.QLabel(self.w) self.d.setText("ARP Table is Clean.\t\t") self.e = QtGui.QLabel(self.w) self.e.setText(".\t\t\t\t") self.listViewbtn = QtGui.QPushButton(self.w) self.listViewbtn.setGeometry(QtCore.QRect(40, 110, 75, 23)) self.listViewbtn.setObjectName(_fromUtf8("List_View")) self.listViewbtn.clicked.connect(self.switchView) self.c.move(2,30) self.d.move(2,60) self.e.move(2,80) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.w.sizePolicy().hasHeightForWidth()) self.verticalLayout_4.addWidget(self.w) self.fig5 = Figure(figsize=(1,1)) #self.fig5.patch.set_alpha(0.5) #self.ax = self.fig5.add_subplot(111) #self.ax.patch.set_facecolor('#ababab') #self.ax.patch.set_alpha(0.5) self.canvas5 = FigureCanvas(self.fig5) self.canvas5.setStyleSheet(_fromUtf8("background-color: transparent")) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.canvas5.sizePolicy().hasHeightForWidth()) clickable(self.canvas5).connect(lambda: self.swap(5)) self.canvas5.setSizePolicy(sizePolicy) self.verticalLayout_4.addWidget(self.canvas5) self.horizontalLayout_2.addLayout(self.verticalLayout_4) self.fig6 = Figure() self.canvas6 = FigureCanvas(self.fig6) self.canvas6.setStyleSheet("background-color: transparent;") sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.canvas6.sizePolicy().hasHeightForWidth()) self.canvas6.setSizePolicy(sizePolicy) #self.canvas6.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) #clickable(self.canvas6).connect(lambda: self.swap(5)) self.horizontalLayout_2.addWidget(self.canvas6) self.horizontalLayout_2.setStretch(0, 24) self.horizontalLayout_2.setStretch(1, 76) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setSpacing(25) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.fig1 = Figure(figsize=(1,1)) self.canvas1 = FigureCanvas(self.fig1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.canvas1.sizePolicy().hasHeightForWidth()) self.canvas1.setSizePolicy(sizePolicy) self.canvas1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) clickable(self.canvas1).connect(lambda: self.swap(1)) self.horizontalLayout.addWidget(self.canvas1) self.fig2 = Figure(figsize=(1,1)) self.canvas2 = FigureCanvas(self.fig2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.canvas2.sizePolicy().hasHeightForWidth()) self.canvas2.setSizePolicy(sizePolicy) self.canvas2.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) clickable(self.canvas2).connect(lambda: self.swap(2)) self.horizontalLayout.mouseReleaseEvent = print("hey") self.horizontalLayout.addWidget(self.canvas2) self.fig3 = Figure(figsize=(1,1)) self.canvas3 = FigureCanvas(self.fig3) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.canvas3.sizePolicy().hasHeightForWidth()) self.canvas3.setSizePolicy(sizePolicy) self.canvas3.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) clickable(self.canvas3).connect(lambda: self.swap(3)) self.horizontalLayout.addWidget(self.canvas3) self.fig4 = Figure(figsize=(1,1)) self.canvas4 = FigureCanvas(self.fig4) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.canvas4.sizePolicy().hasHeightForWidth()) self.canvas4.setSizePolicy(sizePolicy) self.canvas4.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) clickable(self.canvas4).connect(lambda: self.swap(4)) self.horizontalLayout.addWidget(self.canvas4) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.setStretch(0, 10) self.verticalLayout.setStretch(1, 4) self.stackedWidget.addWidget(self.page2) #List view: self.page3 = QtGui.QWidget() self.page3.setObjectName(_fromUtf8("page")) self.verticalLayout_List = QtGui.QVBoxLayout(self.page3) self.verticalLayout_List.setObjectName(_fromUtf8("verticalLayout_List")) self.tableWidget = QtGui.QTableWidget(self.centralwidget) self.tableWidget.setObjectName(_fromUtf8("tableWidget")) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.tableWidget.sizePolicy().hasHeightForWidth()) self.tableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableWidget.setSizePolicy(sizePolicy) self.tableWidget.setColumnCount(6) self.tableWidget.setAlternatingRowColors(True) self.tableWidget.cellClicked.connect(lambda:self.updateListView(self.tableWidget.currentRow())) print(dir(self.tableWidget.scroll)) self.tableWidget.setColumnWidth(0,220) self.tableWidget.setColumnWidth(1,220) self.tableWidget.setColumnWidth(2,220) self.tableWidget.setColumnWidth(3,220) self.tableWidget.setColumnWidth(4,220) self.tableWidget.setColumnWidth(5,220) self.tableWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.tableWidget.scrollToBottom() self.tableWidget.setRowCount(0) self.verticalLayout_List.addWidget(self.tableWidget) self.info = QtGui.QWidget() self.b1 = QtGui.QLabel(self.info) self.b1.setText("Sniffing on interface:") self.b2 = QtGui.QLabel(self.info) self.b2.setText("Sniffing on interface:") self.b2.move(0,30) self.b3 = QtGui.QLabel(self.info) self.b3.setText("Sniffing on interface:") self.b3.move(0,60) self.verticalLayout_List.addWidget(self.info) self.verticalLayout_List.setStretch(0, 4) self.verticalLayout_List.setStretch(1, 2) self.stackedWidget.addWidget(self.page3) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 25)) self.menubar.setObjectName(_fromUtf8("menubar")) self.view = QtGui.QMenu(self.menubar) self.view.setObjectName(_fromUtf8("view")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.change_View = QtGui.QAction(MainWindow) self.change_View.setObjectName(_fromUtf8("change_view")) self.change_View.triggered.connect(self.switchView) self.view.addAction(self.change_View) self.menubar.addAction(self.view.menuAction()) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, model_name, rali_mode, total_images, batch_size, container_logo, parent=None): super(inference_viewer, self).__init__(parent) self.model_name = model_name self.rali_mode = rali_mode self.total_images = total_images self.batch_size = batch_size self.imgCount = 0 self.frameCount = 9 self.container_index = (int)(container_logo) # self.origImageQueue = Queue.Queue() # self.augImageQueue = Queue.Queue() self.graph = None self.totalCurve = None self.augCurve = None self.x = [0] self.y = [0] self.augAccuracy = [] self.pen = pg.mkPen('w', width=4) self.time = QTime.currentTime() self.runState = False self.pauseState = False self.progIndex = 0 self.augIntensity = 0.0 self.lastIndex = self.frameCount - 1 self.AMD_Radeon_pixmap = QPixmap("./data/images/AMD_Radeon.png") self.AMD_Radeon_white_pixmap = QPixmap( "./data/images/AMD_Radeon-white.png") self.MIVisionX_pixmap = QPixmap("./data/images/MIVisionX-logo.png") self.MIVisionX_white_pixmap = QPixmap( "./data/images/MIVisionX-logo-white.png") self.EPYC_pixmap = QPixmap("./data/images/EPYC-blue.png") self.EPYC_white_pixmap = QPixmap("./data/images/EPYC-blue-white.png") self.docker_pixmap = QPixmap("./data/images/Docker.png") self.singularity_pixmap = QPixmap("./data/images/Singularity.png") self.rali_pixmap = QPixmap("./data/images/RALI.png") self.rali_white_pixmap = QPixmap("./data/images/RALI-white.png") self.graph_image_pixmap = QPixmap("./data/images/Graph-image.png") self.graph_image_white_pixmap = QPixmap( "./data/images/Graph-image-white.png") self.initUI() self.show()
desc, portrait = self.db.query_novel_info(selected_novel.title) self.descBrowser.setPlainText(desc) self.portraitView.scene().set_file(portrait) @staticmethod def update_input_text(input_): dialog = QFileDialog() dir_path = unicode(dialog.getExistingDirectory()) if dir_path: input_.setText(dir_path) dialog.destroy() if __name__ == '__main__': app = QApplication(sys.argv) splash_pix = QPixmap("resources/splash.png") splash = QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) progressBar = QProgressBar(splash) progressBar.setAlignment(QtCore.Qt.AlignCenter) progressBar.setFixedWidth(splash_pix.width()) splash.setMask(splash_pix.mask()) splash.show() t = QtCore.QElapsedTimer() t.start() progressBar.setMaximum(1000) while (t.elapsed() < 1000): progressBar.setValue(t.elapsed()) window = MainWindow() splash.finish(window)
def __init__(self, config, db): FreeseerApp.__init__(self) self.config = config self.db = db icon = QIcon() icon.addPixmap(QPixmap(':/freeseer/logo.png'), QIcon.Normal, QIcon.Off) self.setWindowIcon(icon) self.resize(960, 600) # # Setup Layout # self.mainWidget = QWidget() self.mainLayout = QVBoxLayout() self.mainWidget.setLayout(self.mainLayout) self.setCentralWidget(self.mainWidget) self.mainLayout.setAlignment(QtCore.Qt.AlignTop) # Add the Title Row (Use BOLD / Big Font) #self.titleLayout = QHBoxLayout() #self.backButton = QPushButton('Back to Recorder') #if backButton: # Only show the back button if requested by caller # self.titleLayout.addWidget(self.backButton) #self.titleLayout.addStretch() # Add custom widgets self.commandButtons = CommandButtons() self.tableView = QTableView() self.tableView.setSortingEnabled(True) self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) self.talkDetailsWidget = TalkDetailsWidget() self.importTalksWidget = ImportTalksWidget() self.mainLayout.addWidget(self.importTalksWidget) #self.mainLayout.addLayout(self.titleLayout) self.mainLayout.addWidget(self.commandButtons) self.mainLayout.addWidget(self.tableView) self.mainLayout.addWidget(self.talkDetailsWidget) self.mainLayout.addWidget(self.importTalksWidget) # --- End Layout # Initialize geometry, to be used for restoring window positioning. self.geometry = None # # Setup Menubar # self.actionExportCsv = QAction(self) self.actionExportCsv.setObjectName('actionExportCsv') self.actionRemoveAll = QAction(self) self.actionRemoveAll.setObjectName('actionRemoveAll') # Actions self.menuFile.insertAction(self.actionExit, self.actionExportCsv) self.menuFile.insertAction(self.actionExit, self.actionRemoveAll) # --- End Menubar # # TableView Connections # self.connect(self.tableView, SIGNAL('activated(const QModelIndex)'), self.talk_selected) self.connect(self.tableView, SIGNAL('selected(const QModelIndex)'), self.talk_selected) self.connect(self.tableView, SIGNAL('clicked(const QModelIndex)'), self.talk_selected) # Import Widget self.connect(self.importTalksWidget.csvRadioButton, SIGNAL('toggled(bool)'), self.toggle_import) self.connect(self.importTalksWidget.importButton, SIGNAL('clicked()'), self.import_talks) self.connect(self.importTalksWidget.cancelButton, SIGNAL('clicked()'), self.hide_import_talks_widget) self.importTalksWidget.setHidden(True) self.connect(self.importTalksWidget.csvFileSelectButton, QtCore.SIGNAL('clicked()'), self.csv_file_select) self.connect(self.importTalksWidget.csvLineEdit, QtCore.SIGNAL('returnPressed()'), self.importTalksWidget.importButton.click) self.connect(self.importTalksWidget.rssLineEdit, QtCore.SIGNAL('returnPressed()'), self.importTalksWidget.importButton.click) self.connect(self.actionExportCsv, QtCore.SIGNAL('triggered()'), self.export_talks_to_csv) self.connect(self.actionRemoveAll, QtCore.SIGNAL('triggered()'), self.confirm_reset) # Command Buttons self.connect(self.commandButtons.removeButton, SIGNAL('clicked()'), self.remove_talk) self.connect(self.commandButtons.removeAllButton, SIGNAL('clicked()'), self.confirm_reset) self.connect(self.commandButtons.importButton, SIGNAL('clicked()'), self.show_import_talks_widget) self.connect(self.commandButtons.exportButton, SIGNAL('clicked()'), self.export_talks_to_csv) self.connect(self.commandButtons.searchButton, SIGNAL('clicked()'), self.search_talks) self.connect(self.commandButtons.searchLineEdit, SIGNAL('textEdited(QString)'), self.search_talks) self.connect(self.commandButtons.searchLineEdit, SIGNAL('returnPressed()'), self.search_talks) # Talk Details Buttons self.connect(self.talkDetailsWidget.addButton, SIGNAL('clicked()'), self.confirm_add) self.connect(self.talkDetailsWidget.saveButton, SIGNAL('clicked()'), self.add_talk) # Load default language actions = self.menuLanguage.actions() for action in actions: if action.data().toString() == self.config.default_language: action.setChecked(True) self.translate(action) break # Load Talk Database self.load_presentations_model() # Setup Autocompletion self.update_autocomple_fields()
def __init__(self): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.setWindowTitle("AFD mínimo") self.setWindowIcon(QtGui.QIcon(QPixmap("logoapp.png"))) self.setFixedSize(self.size()) self.imagen.setPixmap(QPixmap("AFD minimo.png")) self.play.setIcon(QtGui.QIcon(QPixmap('play.png'))) self.stop.setIcon(QtGui.QIcon('Stop1NormalBlue_26947.ico')) self.validar.setIcon(QtGui.QIcon('check_ok_accept_apply_1582.ico')) self.limpiar.setIcon(QtGui.QIcon('delete_delete_exit_1577.ico')) self.label.setText("") self.limpiar.setFocus() self.play.setEnabled(False) self.stop.setEnabled(False) self.limpiar.clicked.connect(self.limpiarLine) self.validar.clicked.connect(self.funcion) self.play.clicked.connect(self.pasos) self.stop.clicked.connect(self.parar) self.opciones() self.andar = False self.lineEdit.textChanged.connect(self.proteccion) self.permitido = ["a", "b"] self.func = { (1, 'a'): 2, (1, 'b'): 3, (2, 'a'): 4, (2, 'b'): 5, (3, 'a'): 4, (3, 'b'): 6, (4, 'a'): 7, (4, 'b'): 8, (5, 'a'): 10, (5, 'b'): 3, (6, 'a'): 7, (6, 'b'): 3, (7, 'a'): 4, (7, 'b'): 5, (8, 'a'): 9, (8, 'b'): 6, (9, 'a'): 10, (9, 'b'): 10, (10, 'a'): 9, (10, 'b'): 9 } self.finales = [10]
def __init__(self, parent=None): super(ViewDataTools, self).__init__(parent) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # DATATOOLS WINDOWS: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.setWindowTitle(ui_strings.DATATOOLS_TITLE) self._width = 680 self._height = 560 self._left_margin = 10 self.resize(self._width, self._height) size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) size_policy.setHorizontalStretch(0) size_policy.setVerticalStretch(0) size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(size_policy) self.setMinimumSize(QtCore.QSize(self._width, self._height)) self.setMaximumSize(QtCore.QSize(self._width, self._height)) self.setWindowIcon(QIcon(resources.ICON_LOGO)) # central widget self.central_widget = QWidget(self) # DataTools description self.lbl_description = QLabel(self.central_widget) self.lbl_description.setGeometry(QtCore.QRect(0, 0, self._width, 30)) self.lbl_description.setAlignment(QtCore.Qt.AlignCenter) self.lbl_description.setText(ui_strings.DATATOOLS_DESCRIPTION) # group input files self.group_input_file = QGroupBox(self.central_widget) self.group_input_file.setGeometry( QtCore.QRect(self._left_margin, 30, 660, 80)) self.group_input_file.setTitle(ui_strings.DATATOOLS_GROUP_INPUT) # frame input files self.frame_inputs = QFrame(self.group_input_file) self.frame_inputs.setGeometry( QtCore.QRect(self._left_margin, 0, 270, 80)) self.frame_inputs.setFrameShape(QFrame.StyledPanel) self.frame_inputs.setFrameShadow(QFrame.Raised) # label input type self.lbl_input_type = QLabel(self.frame_inputs) self.lbl_input_type.setGeometry(QtCore.QRect(20, 20, 60, 15)) self.lbl_input_type.setText(ui_strings.DATATOOLS_INPUT_TYPE) # button xls self.btn_xls = QToolButton(self.frame_inputs) self.btn_xls.setGeometry(QtCore.QRect(20, 35, 35, 35)) icon_xls = QIcon() icon_xls.addPixmap(QPixmap(resources.ICON_XLS), QIcon.Normal, QIcon.Off) self.btn_xls.setIcon(icon_xls) self.btn_xls.setIconSize(QtCore.QSize(24, 24)) self.btn_xls.setCheckable(True) self.btn_xls.setAutoExclusive(True) self.btn_xls.setObjectName("xls_button") # button csv self.btn_csv = QToolButton(self.frame_inputs) self.btn_csv.setGeometry(QtCore.QRect(60, 35, 35, 35)) icon_csv = QIcon() icon_csv.addPixmap(QPixmap(resources.ICON_CSV), QIcon.Normal, QIcon.Off) self.btn_csv.setIcon(icon_csv) self.btn_csv.setIconSize(QtCore.QSize(24, 24)) self.btn_csv.setCheckable(True) self.btn_csv.setAutoExclusive(True) self.btn_csv.setObjectName("csv_button") # checkbox csv with headers self.chk_csv_headers = QCheckBox(ui_strings.DATATOOLS_WITH_HEADERS, self.frame_inputs) self.chk_csv_headers.setGeometry(QtCore.QRect(100, 45, 110, 15)) self.chk_csv_headers.setEnabled(False) # TextEdit + PushButton (FindFolder) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # lbl sheet name self.lbl_file_path = QLabel(self.group_input_file) self.lbl_file_path.setGeometry(QtCore.QRect(250, 20, 120, 15)) self.lbl_file_path.setText(ui_strings.DATATOOLS_SELECT_FILE) self.txt_file = QLineEdit(self.group_input_file) self.txt_file.setGeometry(QtCore.QRect(250, 35, 160, 20)) self.txt_file.setReadOnly(True) self.btn_path = QPushButton(self.group_input_file) self.btn_path.setGeometry(QtCore.QRect(410, 34, 50, 22)) self.btn_path.setText(ui_strings.DATATOOLS_SELECT_BUTTON) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # lbl sheet name self.lbl_sheet_name = QLabel(self.group_input_file) self.lbl_sheet_name.setGeometry(QtCore.QRect(500, 20, 120, 15)) self.lbl_sheet_name.setText(ui_strings.DATATOOLS_SHEET_NAME) # Combobox select sheet - initially does not contain values self.cbo_sheet = QComboBox(self.group_input_file) self.cbo_sheet.setGeometry(QtCore.QRect(500, 35, 130, 20)) # data grid to visualize error messages self.tbl_errors = QTableWidget(self.central_widget) self.tbl_errors.setGeometry( QtCore.QRect(self._left_margin, 420, 660, 100)) # data grid to visualize those records with errors. self.tbl_uploaded_data = QTableWidget(self.central_widget) self.tbl_uploaded_data.setGeometry( QtCore.QRect(self._left_margin, 120, 500, 220)) # group run options self.group_run_options = QGroupBox(self.central_widget) self.group_run_options.setGeometry(QtCore.QRect(520, 120, 150, 220)) self.group_run_options.setTitle(ui_strings.DATATOOLS_GROUP_RUN) # Errors summary: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # group summary errors self.group_errors = QGroupBox(self.central_widget) self.group_errors.setGeometry( QtCore.QRect(self._left_margin, 350, 660, 60)) self.group_errors.setTitle(ui_strings.DATATOOLS_HEADER_ERRORS) # lbl records self.lbl_records = QLabel(self.group_errors) self.lbl_records.setGeometry(QtCore.QRect(165, 15, 80, 15)) self.lbl_records.setAlignment(QtCore.Qt.AlignCenter) self.lbl_records.setText(ui_strings.DATATOOLS_RECORDS) self.txt_records = QLineEdit(self.group_errors) self.txt_records.setGeometry(QtCore.QRect(165, 30, 80, 20)) self.txt_records.setAlignment(QtCore.Qt.AlignCenter) self.txt_records.setReadOnly(True) # lbl errors self.lbl_errors = QLabel(self.group_errors) self.lbl_errors.setGeometry(QtCore.QRect(275, 15, 80, 15)) self.lbl_errors.setAlignment(QtCore.Qt.AlignCenter) self.lbl_errors.setText(ui_strings.DATATOOLS_ERRORS) self.txt_errors = QLineEdit(self.group_errors) self.txt_errors.setGeometry(QtCore.QRect(275, 30, 80, 20)) self.txt_errors.setAlignment(QtCore.Qt.AlignCenter) self.txt_errors.setReadOnly(True) # lbl time self.lbl_time = QLabel(self.group_errors) self.lbl_time.setGeometry(QtCore.QRect(385, 15, 80, 15)) self.lbl_time.setAlignment(QtCore.Qt.AlignCenter) self.lbl_time.setText(ui_strings.DATATOOLS_TIME) self.txt_time = QLineEdit(self.group_errors) self.txt_time.setGeometry(QtCore.QRect(385, 30, 80, 20)) self.txt_time.setAlignment(QtCore.Qt.AlignCenter) self.txt_time.setReadOnly(True) # history button self.btn_history = QToolButton(self.group_errors) self.btn_history.setGeometry(QtCore.QRect(500, 25, 100, 25)) icon_history = QIcon() icon_history.addPixmap(QPixmap(resources.ICON_HISTORY), QIcon.Normal, QIcon.Off) self.btn_history.setIcon(icon_history) self.btn_history.setIconSize(QtCore.QSize(20, 20)) self.btn_history.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.btn_history.setText(ui_strings.DATATOOLS_HISTORY) self.btn_history.setCheckable(True) self.btn_history.setAutoExclusive(True) self.btn_history.setObjectName("history_button") # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # btn data uploader self.btn_data_uploader = QPushButton( ui_strings.DATATOOLS_DATA_UPLOADER, self.group_run_options) self.btn_data_uploader.setGeometry(QtCore.QRect(10, 120, 90, 25)) self.btn_data_uploader.setCheckable(True) self.btn_data_uploader.setAutoExclusive(True) self.btn_data_uploader.setFlat(False) # btn data testing self.btn_data_testing = QPushButton(ui_strings.DATATOOLS_DATA_TESTING, self.group_run_options) self.btn_data_testing.setEnabled(False) self.btn_data_testing.setGeometry(QtCore.QRect(10, 150, 90, 25)) self.btn_data_testing.setCheckable(True) self.btn_data_testing.setAutoExclusive(True) # btn data to database self.btn_data_db = QPushButton(ui_strings.DATATOOLS_DATA_DB, self.group_run_options) self.btn_data_db.setEnabled(False) self.btn_data_db.setGeometry(QtCore.QRect(10, 179, 91, 23)) self.btn_data_db.setCheckable(True) self.btn_data_db.setAutoExclusive(True) # frame run options self.frame_run = QFrame(self.group_run_options) self.frame_run.setGeometry(QtCore.QRect(10, 30, 130, 80)) self.frame_run.setFrameShape(QFrame.StyledPanel) self.frame_run.setFrameShadow(QFrame.Raised) # option process until first error self.rbtn_process_error = QRadioButton( ui_strings.DATATOOLS_PROCESS_ERROR, self.frame_run) self.rbtn_process_error.setGeometry(QtCore.QRect(0, 0, 150, 20)) # option process all data self.rbtn_process_all = QRadioButton(ui_strings.DATATOOLS_PROCESS_ALL, self.frame_run) self.rbtn_process_all.setGeometry(QtCore.QRect(0, 20, 150, 30)) # checkbox to filter by records with errors. #self.chk_filter_errors = QCheckBox(ui_strings.DATATOOLS_FILTER_ERRORS, self.frame_run) #self.chk_filter_errors.setGeometry(QtCore.QRect(0, 50, 100, 15)) #self.chk_filter_errors.setEnabled(False) # icons -> pass - error: Initially are empty labels # if not started -> ICON_MINI_WAIT # if error -> ICON_DELETE # if pass -> ICON_CHECK # state icon data uploader self.lbl_state_du = QLabel(self.group_run_options) self.lbl_state_du.setGeometry(QtCore.QRect(110, 120, 20, 20)) self.lbl_state_du.setPixmap(QPixmap(resources.ICON_MINI_WAIT)) self.lbl_state_du.setScaledContents(True) # state icon data to database self.lbl_state_dt = QLabel(self.group_run_options) self.lbl_state_dt.setGeometry(QtCore.QRect(110, 150, 20, 20)) self.lbl_state_dt.setPixmap(QPixmap(resources.ICON_MINI_WAIT)) self.lbl_state_dt.setScaledContents(True) # state icon data testing self.lbl_state_db = QLabel(self.group_run_options) self.lbl_state_db.setGeometry(QtCore.QRect(110, 180, 20, 20)) self.lbl_state_db.setPixmap(QPixmap(resources.ICON_MINI_WAIT)) self.lbl_state_db.setScaledContents(True) # progress bar self.progress_bar = QProgressBar(self.central_widget) self.progress_bar.setGeometry( QtCore.QRect(self._left_margin, 530, 660, 15)) self.progress_bar.setMaximum(100) self.progress_bar.setProperty("value", 0) self.progress_bar.setTextVisible(True) self.progress_bar.setOrientation(QtCore.Qt.Horizontal) self.progress_bar.setInvertedAppearance(False) self.progress_bar.setTextDirection(QProgressBar.TopToBottom) self.setCentralWidget(self.central_widget)
def dispSingleEvent(self, row, column): box = QDialog() main_layout = QHBoxLayout(box) main_widget = QWidget() main_layout.addWidget(main_widget) layout = QVBoxLayout(main_widget) node_ptr = self.item(row, 4).text() index = int(self.item(row, 5).text()) processus_manager = ModuleProcessusManager() evt = processus_manager.get('evt') record = evt.evts[long(node_ptr)][index] self.label1 = QLabel("Date : " + record.getTimeGenerated()) self.label2 = QLabel("Source : " + record.sourceName()) self.label3 = QLabel("Type : " + record.getSingleType()) self.lab_icon = QLabel() self.lab_icon.setPixmap( QPixmap(record.getIcon()).scaled(32, 32, Qt.KeepAspectRatio)) weed = QWidget() l = QHBoxLayout(weed) l.addWidget(self.lab_icon) l.addWidget(self.label3) self.label4 = QLabel("Category : " + str(record.EventCategory)) self.label5 = QLabel("EventId : " + str(record.EventID)) self.label6 = QLabel("Computer : " + record.computerName()) layout.addWidget(self.subWidget(self.label1, self.label2)) layout.addWidget(self.subWidget(weed, self.label4)) layout.addWidget(self.subWidget(self.label5, self.label6)) layout.addWidget(QLabel('Messages :')) self.log_strings = QTextEdit('') self.log_strings.setReadOnly(True) self.log_strings.setLineWrapMode(QTextEdit.WidgetWidth) for log in record.getStrings(): if log is not None: self.log_strings.setPlainText(self.log_strings.toPlainText() + log + "\n\n") layout.addWidget(self.log_strings) button_widget = QWidget() main_layout.addWidget(button_widget) self.next_evt = QPushButton(QIcon(":/next.png"), "") self.next_evt.setToolTip("Next record") self.prev_evt = QPushButton(QIcon(":/previous.png"), "") self.prev_evt.setToolTip("Previous record") self.next_evt.clicked.connect(self.dispNextEvent) self.prev_evt.clicked.connect(self.dispPrevEvent) if row == 0: self.prev_evt.setEnabled(False) elif row + 1 == self.rowCount(): self.next_evt.setEnabled(False) else: self.hideOrDipsButton() button_layout = QVBoxLayout(button_widget) button_layout.addWidget(self.prev_evt) button_layout.addWidget(self.next_evt) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) button_layout.addItem(spacerItem) close_button = QPushButton("Close") close_button.clicked.connect(box.done) button_layout.addWidget(close_button) box.exec_()
def __init__(self, column, parent=None, pixmap=None, host=None): """ Class constructor. :param column: Column object containing foreign key information. :type column: BaseColumn :param parent: Parent widget for the control. :type parent: QWidget :param pixmap: Pixmap to use for the line edit button. :type pixmap: QPixmap """ QLineEdit.__init__(self, parent) self.column = column self._entity = self.column.entity self.entity_dialog = host #Configure load button self.btn_load = QToolButton(parent) self.btn_load.setCursor(Qt.PointingHandCursor) self.btn_load.setFocusPolicy(Qt.NoFocus) px = QPixmap(':/plugins/stdm/images/icons/select_record.png') if not pixmap is None: px = pixmap self.btn_load.setIcon(QIcon(px)) self.btn_load.setIconSize(px.size()) self.btn_load.setStyleSheet('background: transparent; padding: 0px; ' 'border: none;') self.btn_load.clicked.connect(self.on_load_foreign_key_browser) clear_px = QPixmap(':/plugins/stdm/images/icons/clear.png') self.btn_clear = QToolButton(parent) self.btn_clear.setCursor(Qt.PointingHandCursor) self.btn_clear.setFocusPolicy(Qt.NoFocus) self.btn_clear.setIcon(QIcon(clear_px)) self.btn_clear.setIconSize(clear_px.size()) self.btn_clear.setStyleSheet('background: transparent; padding: 0px; ' 'border: none;') self.btn_clear.clicked.connect(self.clear_line_edit) frame_width = self.set_button_minimum_size(self.btn_load) self.set_button_minimum_size(self.btn_clear) # Ensure that text does not overlay button padding = self.btn_load.sizeHint().width() + frame_width + 1 self.setStyleSheet('padding-right: ' + str(padding * 2) + 'px;') # Set layout self.button_layout = QHBoxLayout(self) self.button_layout.addWidget(self.btn_clear, 0, Qt.AlignRight) self.button_layout.addWidget(self.btn_load, 0, Qt.AlignRight) self.button_layout.setSpacing(0) self.button_layout.setMargin(5) self.btn_clear.setVisible(False) # Readonly as text is loaded from the related entity self.setReadOnly(True) # Current model object self._current_item = None
def init(self, w, h, has_alpha): #TODO: repaint from old backing! #old_backing = self._backing assert w < 32768 and h < 32768, "dimensions too big: %sx%s" % (w, h) self._backing = QPixmap(w, h) self._backing.fill()
def icon(self): return QIcon(QPixmap(16,16))
def __init__(self, parent=None): QDialog.__init__(self, parent) self.resize(290, 136) self.setWindowTitle("Procedure Legs (AIXM 4.5)") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) verticalLayoutDlg = QVBoxLayout(self) verticalLayoutDlg.setObjectName(("verticalLayoutDlg")) self.gbAll = GroupBox(self, "HL") self.gbAll.Caption = "Legs" verticalLayoutDlg.addWidget(self.gbAll) self.trvLegs = QTreeView(self.gbAll) self.trvLegsStdModel = StandardItemModel() self.trvLegs.setModel(self.trvLegsStdModel) self.gbAll.Add = self.trvLegs self.flowLayoutPanel1 = Frame(self.gbAll) self.gbAll.Add = self.flowLayoutPanel1 self.btnAdd = QPushButton(self.flowLayoutPanel1) icon = QIcon() icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off) self.btnAdd.setIcon(icon) self.flowLayoutPanel1.Add = self.btnAdd self.btnRemove = QPushButton(self.flowLayoutPanel1) icon = QIcon() icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off) self.btnRemove.setIcon(icon) self.flowLayoutPanel1.Add = self.btnRemove self.btnMoveUp = QPushButton(self.flowLayoutPanel1) icon = QIcon() icon.addPixmap(QPixmap("Resource/up.png"), QIcon.Normal, QIcon.Off) self.btnMoveUp.setIcon(icon) self.flowLayoutPanel1.Add = self.btnMoveUp self.btnMoveDown = QPushButton(self.flowLayoutPanel1) icon = QIcon() icon.addPixmap(QPixmap("Resource/down.png"), QIcon.Normal, QIcon.Off) self.btnMoveDown.setIcon(icon) self.flowLayoutPanel1.Add = self.btnMoveDown self.scrollBox = Frame(self.gbAll) self.gbAll.Add = self.scrollBox self.gbFix = GroupBox(self.scrollBox) self.gbFix.Caption = "Fix" self.scrollBox.Add = self.gbFix self.cmbFixPos = ComboBoxPanel(self.gbFix) self.cmbFixPos.Caption = "Position" self.cmbFixPos.Button = "coordinate_capture.png" self.gbFix.Add = self.cmbFixPos self.pnlCodeRoleFix = ComboBoxPanel(self.gbFix) self.pnlCodeRoleFix.Caption = "Type" self.gbFix.Add = self.pnlCodeRoleFix self.gbAttributes = GroupBox(self.scrollBox) self.gbAttributes.Caption = "Attributes" self.scrollBox.Add = self.gbAttributes self.cmbRecommendedEnt = ComboBoxPanel(self.gbAttributes) self.cmbRecommendedEnt.Caption = "Recommended Navigational Aid" self.gbAttributes.Add = self.cmbRecommendedEnt self.pnlCodePhase = ComboBoxPanel(self.gbAttributes) self.pnlCodePhase.Caption = "Fligh Phase" self.gbAttributes.Add = self.pnlCodePhase self.pnlCodeType = ComboBoxPanel(self.gbAttributes) self.pnlCodeType.Caption = "Leg Type" self.gbAttributes.Add = self.pnlCodeType self.pnlLegVOR = Frame(self.gbAttributes, "HL") self.gbAttributes.Add = self.pnlLegVOR self.cmbCodeTypeCourse = ComboBoxPanel(self.pnlLegVOR) self.cmbCodeTypeCourse.Caption = "Course Angle (" + define._degreeStr + ")" self.pnlLegVOR.Add = self.cmbCodeTypeCourse self.txtValCourse = TrackRadialBoxPanel(self.pnlLegVOR) self.txtValCourse.LabelWidth = 0 self.pnlLegVOR.Add = self.txtValCourse self.pnlCodeDirTurn = ComboBoxPanel(self.gbAttributes) self.pnlCodeDirTurn.Caption = "Turn Direction" self.gbAttributes.Add = self.pnlCodeDirTurn self.pnlTurnValid = ComboBoxPanel(self.gbAttributes) self.pnlTurnValid.Caption = "Fly-By" self.gbAttributes.Add = self.pnlTurnValid self.cmbCenter = ComboBoxPanel(self.gbAttributes) self.cmbCenter.Caption = "Center" self.cmbCenter.Button = "coordinate_capture.png" self.gbAttributes.Add = self.cmbCenter self.pnlValBankAngle = NumberBoxPanel(self.gbAttributes) self.pnlValBankAngle.Caption = "Bank Angle (" + define._degreeStr + ")" self.gbAttributes.Add = self.pnlValBankAngle self.pnlCodeDescrDistVer = ComboBoxPanel(self.gbAttributes) self.pnlCodeDescrDistVer.Caption = "Altitude Interpretation" self.gbAttributes.Add = self.pnlCodeDescrDistVer self.pnlVerDistLower = Frame(self.gbAttributes, "HL") self.gbAttributes.Add = self.pnlVerDistLower self.cmbDistVerLower = ComboBoxPanel(self.pnlVerDistLower) self.cmbDistVerLower.CaptionUnits = "ft" self.cmbDistVerLower.Caption = "Lower Altitude Limit" self.pnlVerDistLower.Add = self.cmbDistVerLower self.txtDistVerLower = AltitudeBoxPanel(self.pnlVerDistLower) self.txtDistVerLower.CaptionUnits = "ft" self.txtDistVerLower.LabelWidth = 0 self.pnlVerDistLower.Add = self.txtDistVerLower self.pnlDistVerUpper = Frame(self.gbAttributes, "HL") self.gbAttributes.Add = self.pnlDistVerUpper self.cmbDistVerUpper = ComboBoxPanel(self.pnlDistVerUpper) self.cmbDistVerUpper.CaptionUnits = "ft" self.cmbDistVerUpper.Caption = "Upper Altitude Limit" self.pnlDistVerUpper.Add = self.cmbDistVerUpper self.txtDistVerUpper = AltitudeBoxPanel(self.pnlDistVerUpper) self.txtDistVerUpper.CaptionUnits = "ft" self.txtDistVerUpper.LabelWidth = 0 self.pnlDistVerUpper.Add = self.txtDistVerUpper self.pnlValVerAngle = NumberBoxPanel(self.gbAttributes) self.pnlValVerAngle.Caption = "Climb / Descent Angle [+/-] (" + define._degreeStr + ")" self.gbAttributes.Add = self.pnlValVerAngle self.tableLayoutPanel2 = Frame(self.gbAttributes, "HL") self.gbAttributes.Add = self.tableLayoutPanel2 self.cmbCodeSpeedRef = ComboBoxPanel(self.tableLayoutPanel2) self.cmbCodeSpeedRef.CaptionUnits = "kts" self.cmbCodeSpeedRef.Caption = "Speed Restriction" self.tableLayoutPanel2.Add = self.cmbCodeSpeedRef self.txtValSpeed = SpeedBoxPanel(self.tableLayoutPanel2) self.txtValSpeed.LabelWidth = 0 self.tableLayoutPanel2.Add = self.txtValSpeed self.pnlValDist = DistanceBoxPanel(self.gbAttributes, DistanceUnits.NM) self.pnlValDist.Caption = "Segment Length" self.pnlValDist.Button = None self.gbAttributes.Add = self.pnlValDist self.pnlValDur = NumberBoxPanel(self.gbAttributes) self.pnlValDur.CaptionUnits = "min" self.pnlValDur.Caption = "Duration" self.gbAttributes.Add = self.pnlValDur self.pnlCodeRepAtc = ComboBoxPanel(self.gbAttributes) self.pnlCodeRepAtc.Caption = "ATC Reporting" self.gbAttributes.Add = self.pnlCodeRepAtc self.pnlValTheta = TrackRadialBoxPanel(self.gbAttributes) self.pnlValTheta.Caption = "Magnetic Bearing / Radial from Recommended Nav. Aid" self.pnlValTheta.LabelWidth = 350 self.gbAttributes.Add = self.pnlValTheta self.pnlValRho = DistanceBoxPanel(self.gbAttributes, DistanceUnits.NM) self.pnlValRho.Caption = "Distance from Recommended Nav. Aid" self.pnlValRho.LabelWidth = 350 self.gbAttributes.Add = self.pnlValRho self.txtRemarks = TextBoxPanel(self.gbAttributes, True) self.txtRemarks.Caption = "Remarks" self.gbAttributes.Add = self.txtRemarks self.btnBoxOkCancel = QDialogButtonBox(self) self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel")) self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg) self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject) verticalLayoutDlg.addWidget(self.btnBoxOkCancel) self.trvLegs.pressed.connect(self.trvLegs_pressed) self.data = None self.legs = None self.aerodrome = None self.magnVar = 0.0 for value in CodeIapFixAixm.Items: self.pnlCodeRoleFix.Add(value) for codeTypeProcPathAixm in CodeTypeProcPathAixm.Items: self.pnlCodeType.Add(codeTypeProcPathAixm) for codePhaseProcAixm in CodePhaseProcAixm.Items: self.pnlCodePhase.Add(codePhaseProcAixm) for codeTypeCourseAixm in CodeTypeCourseAixm.Items: self.cmbCodeTypeCourse.Add(codeTypeCourseAixm) for codeDirTurnAixm in CodeDirTurnAixm.Items: self.pnlCodeDirTurn.Add(codeDirTurnAixm) for codeDescrDistVerAixm in CodeDescrDistVerAixm.Items: self.pnlCodeDescrDistVer.Add(codeDescrDistVerAixm) for codeDistVerAixm in CodeDistVerAixm.Items: self.cmbDistVerLower.Add(codeDistVerAixm) for value1 in CodeDistVerAixm.Items: self.cmbDistVerUpper.Add(value1) for codeSpeedRefAixm in CodeSpeedRefAixm.Items: self.cmbCodeSpeedRef.Add(codeSpeedRefAixm) for codeTypeFlyByAixm in CodeTypeFlyByAixm.Items: self.pnlTurnValid.Add(codeTypeFlyByAixm) for codeRepAtcAixm in CodeRepAtcAixm.Items: self.pnlCodeRepAtc.Add(codeRepAtcAixm) self.method_6() self.connect(self.pnlValRho, SIGNAL("Event_0"), self.pnlValRho_Event_0) self.connect(self.pnlValTheta, SIGNAL("Event_0"), self.pnlValTheta_Event_0) self.connect(self.pnlCodeRepAtc, SIGNAL("Event_0"), self.pnlCodeRepAtc_Event_0) self.connect(self.pnlValDur, SIGNAL("Event_0"), self.pnlValDur_Event_0) self.connect(self.pnlValDist, SIGNAL("Event_0"), self.pnlValDist_Event_0) self.connect(self.cmbCodeSpeedRef, SIGNAL("Event_0"), self.cmbCodeSpeedRef_Event_0) self.connect(self.txtValSpeed, SIGNAL("Event_0"), self.txtValSpeed_Event_0) self.connect(self.txtDistVerUpper, SIGNAL("Event_0"), self.txtDistVerUpper_Event_0) self.connect(self.cmbDistVerUpper, SIGNAL("Event_0"), self.cmbDistVerUpper_Event_0) self.connect(self.txtDistVerLower, SIGNAL("Event_0"), self.txtDistVerLower_Event_0) self.connect(self.cmbDistVerLower, SIGNAL("Event_0"), self.cmbDistVerLower_Event_0) self.connect(self.pnlValBankAngle, SIGNAL("Event_0"), self.pnlValBankAngle_Event_0) self.connect(self.cmbCenter, SIGNAL("Event_0"), self.cmbCenter_Event_0) self.connect(self.pnlTurnValid, SIGNAL("Event_0"), self.pnlTurnValid_Event_0) self.connect(self.pnlCodeDirTurn, SIGNAL("Event_0"), self.pnlCodeDirTurn_Event_0) self.connect(self.cmbCodeTypeCourse, SIGNAL("Event_0"), self.cmbCodeTypeCourse_Event_0) self.connect(self.txtValCourse, SIGNAL("Event_0"), self.txtValCourse_Event_0) self.connect(self.pnlCodeType, SIGNAL("Event_0"), self.pnlCodeType_Event_0) self.connect(self.pnlCodePhase, SIGNAL("Event_0"), self.pnlCodePhase_Event_0) self.connect(self.pnlCodeRoleFix, SIGNAL("Event_0"), self.pnlCodeRoleFix_Event_0) self.connect(self.txtRemarks, SIGNAL("Event_0"), self.txtRemarks_Event_0) self.connect(self.cmbRecommendedEnt, SIGNAL("Event_0"), self.cmbRecommendedEnt_Event_0) self.connect(self.cmbFixPos, SIGNAL("Event_0"), self.cmbFixPos_Event_0) self.connect(self.cmbCenter, SIGNAL("Event_3"), self.method_14) self.connect(self.cmbFixPos, SIGNAL("Event_3"), self.method_13) self.btnAdd.clicked.connect(self.btnAdd_Click) self.btnMoveDown.clicked.connect(self.btnMoveDown_Click) self.btnMoveUp.clicked.connect(self.btnMoveUp_Click) self.btnRemove.clicked.connect(self.btnRemove_Click) self.trvLegs.setHeaderHidden(True) if self.trvLegsStdModel.rowCount() > 0: self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(0, 0)) self.method_8()
def targetStartedRunning(self): self.ui.statusLabel.setText("Running") self.ui.statusIcon.setPixmap(QPixmap(":/icons/images/22x22/running.png")) self.disableButtons() self.act.Interrupt.setEnabled(True)
def start(): app = QApplication(sys.argv) QCoreApplication.setOrganizationName('NINJA-IDE') QCoreApplication.setOrganizationDomain('ninja-ide.org.ar') QCoreApplication.setApplicationName('Kunai') # Create and display the splash screen splash_pix = QPixmap(resources.images['splash']) splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() loader.load_syntax() #Loading GUI splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignBottom, Qt.white) settings = QSettings() if not settings.value('preferences/skins/default', True).toBool(): selectedSkin = settings.value('preferences/skins/selectedSkin', '').toString() skins = loader.load_gui_skins() css = skins.get(str(selectedSkin), '') app.setStyleSheet(css) schemeColor = str(settings.value('preferences/editor/scheme', 'default').toString()) if schemeColor != 'default': resources.custom_scheme = loader.load_editor_skins().get(schemeColor, {}) #Editor Configuration EditorGeneric.codeCompletion = settings.value('preferences/editor/codeCompletion', True).toBool() EditorGeneric.indent = settings.value('preferences/editor/indent', 4).toInt()[0] EditorGeneric.findErrors = settings.value('preferences/editor/errors', False).toBool() EditorGeneric.checkStyle = settings.value('preferences/editor/checkStyle', True).toBool() EditorGeneric.highlightVariables = settings.value('preferences/editor/highlightWord', True).toBool() if not settings.value('preferences/editor/parentheses', True).toBool(): del EditorGeneric.braces_strings['('] if not settings.value('preferences/editor/brackets', True).toBool(): del EditorGeneric.braces_strings['['] if not settings.value('preferences/editor/keys', True).toBool(): del EditorGeneric.braces_strings['{'] if not settings.value('preferences/editor/simpleQuotes', True).toBool(): del EditorGeneric.braces_strings["'"] if not settings.value('preferences/editor/doubleQuotes', True).toBool(): del EditorGeneric.braces_strings['"'] ide = IDE() if settings.value('preferences/interface/centralRotate', False).toBool(): ide.main._splitter_central_rotate() if settings.value('preferences/interface/panelsRotate', False).toBool(): ide.main._splitter_main_rotate() if settings.value('preferences/interface/centralOrientation', False).toBool(): ide.main._splitter_central_orientation() #Settings splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignBottom, Qt.white) resources.python_path = str(settings.value('preferences/general/pythonPath', 'python').toString()) if (settings.value('preferences/general/activatePlugins', Qt.Checked) == Qt.Checked): set_plugin_access(ide) ninja_ide.core.load_plugins(ide) resources.workspace = str(settings.value('preferences/general/workspace', '').toString()) supportedExtensions = settings.value('preferences/general/extensions', []).toList() if supportedExtensions: tempExtensions = [] for se in supportedExtensions: tempExtensions.append(str(se.toString())) manage_files.supported_extensions = tuple(tempExtensions) #Load Font preference font = str(settings.value('preferences/editor/font', "Monospace, 11").toString()) EditorGeneric.font_family = font.split(', ')[0] EditorGeneric.font_size = int(font.split(', ')[1]) ide.show() splash.showMessage("Loading Projects", Qt.AlignRight | Qt.AlignBottom, Qt.white) for projectFolder in settings.value('openFiles/projects', []).toStringList(): if os.path.isdir(projectFolder): ide.main.open_project_folder(str(projectFolder), False) if (settings.value('preferences/general/loadFiles', Qt.Checked) == Qt.Checked): for openFile in settings.value('openFiles/tab1', []).toList(): if len(openFile.toList()) > 0: fileList = openFile.toList() fileName = str(fileList[0].toString()) projectPath = str(fileList[1].toString()) if len(projectPath) == 0: projectPath = None cursorPosition = fileList[2].toInt()[0] if os.path.isfile(fileName): ide.main.open_document(fileName, projectPath) ide.main._central.obtain_editor().set_cursor_position(cursorPosition) for openFile2 in settings.value('openFiles/tab2', []).toList(): #ide.main.split_tab(True) if len(openFile2.toList()) > 0: ide.main._central._tabs2.show() ide.main._central._mainTabSelected = False fileList = openFile2.toList() fileName = fileList[0].toString() projectPath = fileList[1].toString() cursorPosition = fileList[2].toInt()[0] if os.path.isfile(fileName): ide.main.open_document(str(fileName), str(projectPath)) ide.main._central.obtain_editor().set_cursor_position(cursorPosition) ide.main._central._mainTabSelected = True filenames, projects_path = ninja_ide.core.cliparser.parse() for filename in filenames: ide.main.open_document(filename) for project_path in projects_path: ide.main.open_project_folder(project_path) splash.finish(ide) sys.exit(app.exec_())
def targetExited(self): self.ui.statusLabel.setText("Not running") self.disableButtons() self.ui.statusIcon.setPixmap(QPixmap(":/icons/images/22x22/not_running.png")) logging.info("Inferior exited.")
def toPixmap(pgm): """Convert PGM data to pixmap""" pixmap = QPixmap() pixmap.loadFromData(pgm, "PGM") return pixmap
def __init__(self, parent=None, iface=None, dock=None): """Constructor for the dialog. .. note:: In QtDesigner the advanced editor's predefined keywords list should be shown in english always, so when adding entries to cboKeyword, be sure to choose :safe_qgis:`Properties<<` and untick the :safe_qgis:`translatable` property. :param parent: Parent widget of this dialog. :type parent: QWidget :param iface: QGIS QGisAppInterface instance. :type iface: QGisAppInterface :param dock: Dock widget instance that we can notify of changes to the keywords. Optional. :type dock: Dock """ QDialog.__init__(self, parent) self.setupUi(self) self.setWindowTitle('InaSAFE') # Constants self.keyword_creation_wizard_name = tr( 'InaSAFE Keywords Creation Wizard') self.ifcw_name = tr('InaSAFE Impact Function Centric Wizard') # Note the keys should remain untranslated as we need to write # english to the keywords file. # Save reference to the QGIS interface and parent self.iface = iface self.parent = parent self.dock = dock self.suppress_warning_dialog = False self.lblStep.clear() # Set icons self.lblMainIcon.setPixmap( QPixmap(resources_path('img', 'icons', 'icon-white.svg'))) self.keyword_io = KeywordIO() self.is_selected_layer_keywordless = False self.parent_step = None self.pbnBack.setEnabled(False) self.pbnNext.setEnabled(False) self.pbnCancel.released.connect(self.reject) # Initialize attributes self.existing_keywords = None self.layer = None self.hazard_layer = None self.exposure_layer = None self.aggregation_layer = None self.step_kw_purpose = StepKwPurpose(self) self.step_kw_subcategory = StepKwSubcategory(self) self.step_kw_hazard_category = StepKwHazardCategory(self) self.step_kw_band_selector = StepKwBandSelector(self) self.step_kw_layermode = StepKwLayerMode(self) self.step_kw_unit = StepKwUnit(self) self.step_kw_classification = StepKwClassification(self) self.step_kw_field = StepKwField(self) self.step_kw_multi_classifications = StepKwMultiClassifications(self) self.step_kw_classify = StepKwClassify(self) self.step_kw_threshold = StepKwThreshold(self) self.step_kw_fields_mapping = StepKwFieldsMapping(self) self.step_kw_inasafe_fields = StepKwInaSAFEFields(self) self.step_kw_default_inasafe_fields = StepKwDefaultInaSAFEFields(self) self.step_kw_inasafe_raster_default_values = \ StepKwInaSAFERasterDefaultValues(self) self.step_kw_source = StepKwSource(self) self.step_kw_title = StepKwTitle(self) self.step_kw_summary = StepKwSummary(self) self.step_fc_functions1 = StepFcFunctions1(self) self.step_fc_functions2 = StepFcFunctions2(self) self.step_fc_hazlayer_origin = StepFcHazLayerOrigin(self) self.step_fc_hazlayer_from_canvas = StepFcHazLayerFromCanvas(self) self.step_fc_hazlayer_from_browser = StepFcHazLayerFromBrowser(self) self.step_fc_explayer_origin = StepFcExpLayerOrigin(self) self.step_fc_explayer_from_canvas = StepFcExpLayerFromCanvas(self) self.step_fc_explayer_from_browser = StepFcExpLayerFromBrowser(self) self.step_fc_disjoint_layers = StepFcDisjointLayers(self) self.step_fc_agglayer_origin = StepFcAggLayerOrigin(self) self.step_fc_agglayer_from_canvas = StepFcAggLayerFromCanvas(self) self.step_fc_agglayer_from_browser = StepFcAggLayerFromBrowser(self) self.step_fc_agglayer_disjoint = StepFcAggLayerDisjoint(self) self.step_fc_extent = StepFcExtent(self) self.step_fc_extent_disjoint = StepFcExtentDisjoint(self) self.step_fc_summary = StepFcSummary(self) self.step_fc_analysis = StepFcAnalysis(self) self.wizard_help = WizardHelp(self) self.stackedWidget.addWidget(self.step_kw_purpose) self.stackedWidget.addWidget(self.step_kw_subcategory) self.stackedWidget.addWidget(self.step_kw_hazard_category) self.stackedWidget.addWidget(self.step_kw_band_selector) self.stackedWidget.addWidget(self.step_kw_layermode) self.stackedWidget.addWidget(self.step_kw_unit) self.stackedWidget.addWidget(self.step_kw_classification) self.stackedWidget.addWidget(self.step_kw_field) self.stackedWidget.addWidget(self.step_kw_multi_classifications) self.stackedWidget.addWidget(self.step_kw_classify) self.stackedWidget.addWidget(self.step_kw_threshold) self.stackedWidget.addWidget(self.step_kw_fields_mapping) self.stackedWidget.addWidget(self.step_kw_inasafe_fields) self.stackedWidget.addWidget(self.step_kw_default_inasafe_fields) self.stackedWidget.addWidget( self.step_kw_inasafe_raster_default_values) self.stackedWidget.addWidget(self.step_kw_source) self.stackedWidget.addWidget(self.step_kw_title) self.stackedWidget.addWidget(self.step_kw_summary) self.stackedWidget.addWidget(self.step_fc_functions1) self.stackedWidget.addWidget(self.step_fc_functions2) self.stackedWidget.addWidget(self.step_fc_hazlayer_origin) self.stackedWidget.addWidget(self.step_fc_hazlayer_from_canvas) self.stackedWidget.addWidget(self.step_fc_hazlayer_from_browser) self.stackedWidget.addWidget(self.step_fc_explayer_origin) self.stackedWidget.addWidget(self.step_fc_explayer_from_canvas) self.stackedWidget.addWidget(self.step_fc_explayer_from_browser) self.stackedWidget.addWidget(self.step_fc_disjoint_layers) self.stackedWidget.addWidget(self.step_fc_agglayer_origin) self.stackedWidget.addWidget(self.step_fc_agglayer_from_canvas) self.stackedWidget.addWidget(self.step_fc_agglayer_from_browser) self.stackedWidget.addWidget(self.step_fc_agglayer_disjoint) self.stackedWidget.addWidget(self.step_fc_extent) self.stackedWidget.addWidget(self.step_fc_extent_disjoint) self.stackedWidget.addWidget(self.step_fc_summary) self.stackedWidget.addWidget(self.step_fc_analysis) self.stackedWidget.addWidget(self.wizard_help) # QSetting self.setting = QSettings() # Wizard Steps self.impact_function_steps = [] self.keyword_steps = [] self.on_help = False
def __init__(self): super().__init__(QPixmap(":/potato_seed.png")) self.mimetext = "application/x-potato"