def set_gain_mu(self, gain): self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain))
def paintEvent(self, event=None): ''' draws the book - recalled at any point by instance.update() ''' red_pen = QtGui.QPen(QtCore.Qt.red, 2) blue_pen = QtGui.QPen(QtCore.Qt.blue, 2) painter = QtGui.QPainter(self) currentSlot = 0 painter.setFont(self.font) # define and draw the white boundary painter.setBrush(colours.APPT_Background) painter.setPen(QtGui.QPen(colours.APPT_Background, 1)) top = (self.firstSlot - 1) * self.slotHeight bottom = (self.lastSlot + 1 - self.firstSlot) * self.slotHeight colwidth = self.width() - self.timeWidth rect = QtCore.QRectF(self.timeWidth, top, colwidth, bottom) painter.drawRect(rect) # DRAW HORIZONTAL LINES AND TIMES while currentSlot < self.slotNo: textneeded = False if currentSlot % self.textDetail == 0: textneeded = True y = currentSlot * self.slotHeight #- code to check if within the appointment hours if self.firstSlot <= currentSlot <= self.lastSlot: painter.setPen(QtGui.QPen(LINECOLOR, 1)) painter.drawLine(self.timeWidth + 1, y, self.width() - 1, y) if textneeded: trect = QtCore.QRectF(0, y, self.timeWidth, y + self.textDetail * self.slotHeight) painter.setPen(QtGui.QPen(QtCore.Qt.black, 1)) painter.drawLine(0, y, self.timeWidth, y) painter.drawText(trect, QtCore.Qt.AlignLeft, (QtCore.QString( self.humanTime(self.dayStartTime + (currentSlot * self.slotDuration))))) currentSlot += 1 # layout appts painter.save() painter.setPen(QtCore.Qt.black) option = QtGui.QTextOption(QtCore.Qt.AlignCenter) option.setWrapMode(QtGui.QTextOption.WordWrap) for appt in self.appts: painter.save() (startcell, endcell, start, fin, name, sno, trt1, trt2, trt3, memo, flag, cset, modtime) = appt rect = QtCore.QRectF(self.timeWidth, startcell * self.slotHeight, self.width() - self.timeWidth, (endcell - startcell) * self.slotHeight) if sno != 0 and sno == self.pWidget.selected_serialno: painter.setBrush(QtGui.QColor("orange")) elif self.pWidget.mode == self.pWidget.SCHEDULING_MODE: painter.setBrush(APPTCOLORS["BUSY"]) painter.setPen(GREY_PEN) elif self.selected_rows == (startcell, endcell): painter.setBrush(QtGui.QColor("#AAAAAA")) elif cset in APPTCOLORS: painter.setBrush(APPTCOLORS[cset]) elif name.upper() in APPTCOLORS: painter.setBrush(APPTCOLORS[name.upper()]) elif flag == -128: painter.setBrush(APPTCOLORS["BUSY"]) else: painter.setBrush(APPTCOLORS["default"]) if not (sno == 0 and (endcell < self.firstSlot or startcell > self.lastSlot)): painter.drawRect(rect) mytext = "%s %s %s %s %s" % (name.title(), trt1, trt2, trt3, memo) painter.drawText(rect, mytext, option) # highlight any appointments booked today if (sno != 0 and modtime and modtime.date() == localsettings.currentDay()): rect = QtCore.QRectF(self.width() - self.timeWidth / 2, startcell * self.slotHeight, self.timeWidth / 2, rect.height()).adjusted(2, 2, -2, -2) painter.setPen(colours.BOOKED_TODAY) painter.setBrush(colours.BOOKED_TODAY) painter.drawEllipse(rect) painter.restore() for appt in self.doubleAppts: (startcell, endcell, start, fin, name, sno, trt1, trt2, trt3, memo, flag, cset, modtime) = appt rect = QtCore.QRectF(self.width() - self.timeWidth, startcell * self.slotHeight, self.width() - self.timeWidth, self.slotHeight) painter.setBrush(APPTCOLORS["DOUBLE"]) painter.drawRect(rect) painter.setPen(QtGui.QColor("red")) for slot in self.freeslots: startcell, endcell = slot rect = QtCore.QRectF(self.timeWidth, startcell * self.slotHeight, self.width() - self.timeWidth, (endcell - startcell) * self.slotHeight) if slot == self.active_slot: if self.blink_on: painter.setBrush(APPTCOLORS["ACTIVE_SLOT_BOLD"]) else: painter.setBrush(APPTCOLORS["ACTIVE_SLOT"]) if self.ensure_slot_visible: self.ensure_visible(0, startcell * self.slotHeight) else: brush = APPTCOLORS["SLOT"] if self.enabled_slots: painter.setOpacity(1) else: painter.setOpacity(0.4) # brush.setAlpha(40) painter.setBrush(brush) painter.drawRect(rect) slot_duration = (endcell - startcell) * self.slotDuration painter.drawText(rect, "%s mins" % slot_duration, option) painter.restore() # highlight current time if self.setTime: cellno = self.getCell_from_time(self.setTime) painter.setPen(blue_pen) painter.setBrush(QtCore.Qt.blue) corner1 = [self.timeWidth * 1.4, cellno * self.slotHeight] corner2 = [self.timeWidth, (cellno - 0.5) * self.slotHeight] corner3 = [self.timeWidth, (cellno + 0.5) * self.slotHeight] triangle = corner1 + corner2 + corner3 painter.drawPolygon(QtGui.QPolygon(triangle)) corner1 = [ self.width() - self.timeWidth * 0.4, cellno * self.slotHeight ] corner2 = [self.width(), (cellno - 0.5) * self.slotHeight] corner3 = [self.width(), (cellno + 0.5) * self.slotHeight] triangle = corner1 + corner2 + corner3 painter.drawPolygon(QtGui.QPolygon(triangle)) if self.dragging: painter.setPen(red_pen) y = self.drag_startrow * self.slotHeight y2 = self.drag_endrow * self.slotHeight painter.drawLine(0, y, self.width(), y) painter.setBrush(QtGui.QColor("yellow")) trect = QtCore.QRectF(self.timeWidth, y, self.width() - self.timeWidth, y2 - y) painter.drawRect(trect) droptime = self.drop_time.strftime("%H:%M") trect = QtCore.QRectF(0, y, self.timeWidth, y2 - y) painter.drawRect(trect) painter.drawText(trect, QtCore.Qt.AlignHCenter, droptime)
def _highlightCurrentKeyHead(self): headText = self._shortcutMemo.getShortcutText(self._currentKey) self.currentHeadsChanged.emit(QtCore.QString(headText))
def __init__ (self, value): super(QCustomTableWidgetItem, self).__init__(QtCore.QString('%s' % value))
def __init__(self, value, data): super(vQlistWidgetItem, self).__init__(QtCore.QString('%s' % value)) self.data = data
def attach_signal2(self, signal): self.signal2 = signal self.freq2Edit.setText( QtCore.QString("%1").arg(self.signal2.frequency())) self.amp2Edit.setText( QtCore.QString("%1").arg(self.signal2.amplitude()))
def compile(self, file_path): self.current_file_path = file_path self.progress.show() arduino_path = self.main.settings.arduino_path() if not arduino_path: self.set_error("Arduino root path not found", "..nothing to do ..") return ## Set Envoironment env = QtCore.QStringList() env << QtCore.QString("ARDUINO_DIR=").append() env << QtCore.QString("ARDUINO_BOARD=").append("atmega328") env << QtCore.QString("ARDUINO_sPORT=").append("s/ssdev/ttyUSB0") self.process.setEnvironment(env) print "----------------------------------------" ## Set working dir sketch_dir = QtCore.QFileInfo(self.current_file_path).absolutePath() self.process.setWorkingDirectory(sketch_dir) command = QtCore.QString("sh ") ## Create command sh arduinp_make.sh #command.append("pwd ") #.append(QtCore.QFileInfo(self.current_file_path).dir().path()) #args = QtCore.QStringList() command.append(self.main.settings.app_path()).append("/etc/arduino_make.sh compile ") #command.append(QtCore.QFileInfo(self.current_file_path).dir().path()) print "command=", command self.process.start(command) if self.process.waitForStarted(): self.process.waitForFinished() result = self.process.readAllStandardOutput() #print type(result), result error = self.process.readAllStandardError() #print type(error), error if error: print "is error" self.actionIcon.setIcon(Icon(Ico.CompileError)) self.statusLabel.setText("Error") self.textWidget.setPlainText(QtCore.QString(error)) else: print "is ok" self.statusLabel.setText("OK") self.actionIcon.setIcon(Icon(Ico.CompileOk)) self.textWidget.setPlainText(QtCore.QString(result)) self.progress.hide() return command = QtCore.QString() ## Create command sh arduinp_make.sh command.append("pwd") # sh ").append(self.main.settings.app_path()).append("/etc/arduino_make.sh compile") #args = QtCore.QStringList() #command.append(self.main.settings.app_path()).append("/etc/arduino_make.sh compile ") #command.append(QtCore.QFileInfo(self.current_file_path).dir().path()) print "command=", command process = QtCore.QProcess(self) process.start(command) if process.waitForStarted(): process.waitForFinished(); result = process.readAllStandardOutput() #print type(result), result error = process.readAllStandardError() #print type(error), error if error: self.textWidget.setPlainText(QtCore.QString(error)) else: self.textWidget.setPlainText(QtCore.QString(result))
def newFile(self): if self.maybeSave(): self.ui.textEdit.clear() self.setCurrentFile(QtCore.QString())
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(480, 327) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setGeometry(QtCore.QRect(130, 280, 341, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.comboBox = QtGui.QComboBox(Dialog) self.comboBox.setGeometry(QtCore.QRect(10, 10, 201, 27)) self.comboBox.setObjectName("comboBox") self.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(int)"), self.changeEdit) self.addIcon = QtGui.QIcon("Icons/edit-add.png") self.addButton = QtGui.QPushButton(self.addIcon, "Add", Dialog) self.addButton.setGeometry(QtCore.QRect(220, 10, 92, 28)) self.addButton.setObjectName("addButton") self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addAttachment) self.line = QtGui.QFrame(Dialog) self.line.setGeometry(QtCore.QRect(10, 50, 261, 16)) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName("line") self.typeBox = QtGui.QComboBox(Dialog) self.typeBox.setGeometry(QtCore.QRect(20, 70, 100, 27)) self.typeBox.setObjectName("typeBox") for i in range(50): self.typeBox.addItem(QtCore.QString()) self.label = QtGui.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(20, 110, 62, 18)) self.label.setObjectName("label") self.xEdit = QtGui.QLineEdit(Dialog) self.xEdit.setGeometry(QtCore.QRect(20, 130, 50, 26)) self.xEdit.setObjectName("xEdit") self.yEdit = QtGui.QLineEdit(Dialog) self.yEdit.setGeometry(QtCore.QRect(80, 130, 50, 26)) self.yEdit.setObjectName("yEdit") self.zEdit = QtGui.QLineEdit(Dialog) self.zEdit.setGeometry(QtCore.QRect(140, 130, 50, 26)) self.zEdit.setObjectName("zEdit") self.boneBox = QtGui.QComboBox(Dialog) self.boneBox.setGeometry(QtCore.QRect(20, 170, 100, 27)) self.boneBox.setObjectName("boneBox") self.enabledIcon = QtGui.QIcon("Icons/edit-enabled.png") self.enabledButton = QtGui.QPushButton(self.enabledIcon, "Edit Enabled", Dialog) self.enabledButton.setGeometry(QtCore.QRect(20, 200, 140, 28)) self.enabledButton.setObjectName("enabledButton") self.connect(self.enabledButton, QtCore.SIGNAL("clicked()"), self.editEnabled) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.finalizeMe) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) self.DEV = True # TODO - User customisable style QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('Cleanlooks')) ## Set the title text format self.title_text = "Arduino IDE - %s" ## Sets up the settings and other global classes self.settings = app.settings.Settings(self) self.ut = app.util.Util() self.api = app.API.API(self) ## Set Window Properties self.setWindowTitle(self.title_text % "") self.setWindowIcon(Icon(Ico.Arduino)) self.setMinimumWidth(800) self.setMinimumHeight(600) self.setDockNestingEnabled(True) self.setDockOptions(QtGui.QMainWindow.ForceTabbedDocks | QtGui.QMainWindow.VerticalTabs) self.topToolBar = QtGui.QToolBar() self.topToolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.addToolBar(self.topToolBar) #if self.DEV: #self.topToolBar.addAction("Load Keywords", self.on_dev_load_keywords) ############################################################## ## File Menu ############################################################## menuFile = self.menuBar().addMenu("File") menuSettings = menuFile.addAction(Icon(Ico.Settings), "Settings", self.on_settings_dialog) menuFile.addSeparator() # TODO: Connect this to something menuQuit = menuFile.addAction(Icon(Ico.Quit), "Quit") #self.topToolBar.addAction(menuSettings) ############################################################## ## View Menu ############################################################## menuView = self.menuBar().addMenu("View") self.groupViewActions = QtGui.QActionGroup(self) self.connect(self.groupViewActions, QtCore.SIGNAL("triggered (QAction *)"), self.on_action_view) views = [] views.append(['sketches', Ico.Sketches, "Sketches"]) views.append(['api_browser', Ico.Function, "API Browser"]) views.append(['help', Ico.Help, "Help"]) views.append( ['file_system_browser', Ico.FileSystemBrowser, "Files Browser"]) for ki, ico, caption in views: act = menuView.addAction(Icon(ico), caption) act.setProperty("ki", ki) self.topToolBar.addAction(act) self.groupViewActions.addAction(act) self.topToolBar.addSeparator() ############################################################## ## Sketch Menu ############################################################## menuSketch = self.menuBar().addMenu("Sketches") ############################################################## ## Hardware Menu ############################################################## menuHardware = self.menuBar().addMenu("Hardware") ## Boards self.actionGroupBoards = QtGui.QActionGroup(self) self.actionGroupBoards.setExclusive(True) self.connect(self.actionGroupBoards, QtCore.SIGNAL("triggered(QAction *)"), self.on_action_select_board) self.menuBoards = menuHardware.addMenu(Icon( Ico.Board), "-- No Board Selected --") # populates later act = menuHardware.addAction(Icon(Ico.Boards), "Boards", self.on_action_boards) self.topToolBar.addAction(act) menuHardware.addSeparator() ## Bootloaders self.actionGroupBootLoaders = QtGui.QActionGroup(self) self.actionGroupBootLoaders.setExclusive(True) self.connect(self.actionGroupBootLoaders, QtCore.SIGNAL("triggered(QAction *)"), self.on_action_bootloader_burn) self.menuBootLoaders = menuHardware.addMenu(Icon( Ico.BootLoaderBurn), "Burn Bootloader") # populates later act = menuHardware.addAction(Icon(Ico.BootLoaders), "Bootloaders", self.on_action_bootloaders) self.topToolBar.addAction(act) self.topToolBar.addSeparator() ############################################################## ## Websites Menu ############################################################## self.menuWebSites = self.menuBar().addMenu("Websites") self.menuWebSites.addSeparator() self.actionEditWebsites = self.menuWebSites.addAction( "Edit Sites", self.on_websites_dialog) ############################################################## ## Help Menu ############################################################## menuHelp = self.menuBar().addMenu("Help") #################################### ## Dock Widgets #################################### helpDockWidget = HelpDockWidget("Help", self, self) self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, helpDockWidget) apiDockWidget = APIDockWidget("API", self, self) self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, apiDockWidget) #self.tabifyDockWidget(helpDockWidget, apiDockWidget) ########################################################## ## Central Widget ########################################################## self.mainTabWidget = QtGui.QTabWidget(self) self.mainTabWidget.setTabsClosable(True) self.mainTabWidget.setMovable(True) self.setCentralWidget(self.mainTabWidget) self.connect(self.mainTabWidget, QtCore.SIGNAL("tabCloseRequested (int)"), self.on_close_tab_requested) self.connect(self.mainTabWidget, QtCore.SIGNAL("currentChanged (int)"), self.on_tab_change) ## Load sketches and Welcome self.on_action_view(QtCore.QString("welcome")) self.on_action_view(QtCore.QString("sketches")) self.mainTabWidget.setCurrentIndex(0) ########################################################## ## Status Bar ########################################################## self.statusBar().addPermanentWidget(QtGui.QLabel("Board:")) self.lblBoard = QtGui.QLabel("-- none --") self.statusBar().addPermanentWidget(self.lblBoard) self.statusBar().addPermanentWidget(QtGui.QLabel("Bootloader:")) self.lblBootloader = QtGui.QLabel("-- none --") self.statusBar().addPermanentWidget(self.lblBootloader) ########################################################## ## Globally Shared Widgets ########################################################## ## Borads self.boards = app.Boards.Boards(self) self.connect(self.boards, QtCore.SIGNAL("board_selected"), self.on_board_selected) self.boards.load_current( ) ## THIS actually sets current as event above is not fired in constructor ## API #self.connect(self.api, QtCore.SIGNAL("some_signal_here"), self.p) #print self.api.html_index() #print self.api.tree() if not self.settings.value("virginity"): self.on_settings_dialog() self.settings.restore_window("main_window", self) self.on_refresh_settings()
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(890, 550) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(10, 10, 320, 510)) self.tabWidget.setObjectName(_fromUtf8("tabWidget")) self.tab_items = QtGui.QWidget() self.tab_items.setObjectName(_fromUtf8("tab_items")) self.formLayoutWidget = QtGui.QWidget(self.tab_items) self.formLayoutWidget.setGeometry(QtCore.QRect(10, 10, 304, 471)) self.formLayoutWidget.setObjectName(_fromUtf8("formLayoutWidget")) self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) self.formLayout.setObjectName(_fromUtf8("formLayout")) self.label_from = QtGui.QLabel(self.formLayoutWidget) self.label_from.setObjectName(_fromUtf8("label_from")) self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_from) self.label_to = QtGui.QLabel(self.formLayoutWidget) self.label_to.setObjectName(_fromUtf8("label_to")) self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_to) self.label_item = QtGui.QLabel(self.formLayoutWidget) self.label_item.setObjectName(_fromUtf8("label_item")) self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_item) self.comboBox_item = QtGui.QComboBox(self.formLayoutWidget) self.comboBox_item.setObjectName(_fromUtf8("comboBox_item")) self.setItemCode() # self.comboBox_item.addItem(_fromUtf8("120400001")) # self.comboBox_item.addItem(_fromUtf8("120400001A")) # self.comboBox_item.addItem(_fromUtf8("120400002")) # self.comboBox_item.addItem(_fromUtf8("120400002A")) # self.comboBox_item.addItem(_fromUtf8("120400002B")) self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.comboBox_item) self.label_mount = QtGui.QLabel(self.formLayoutWidget) self.label_mount.setObjectName(_fromUtf8("label_mount")) self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_mount) self.spinBox_mount = QtGui.QSpinBox(self.formLayoutWidget) self.spinBox_mount.setValue(6) self.spinBox_mount.setObjectName(_fromUtf8("spinBox_mount")) self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.spinBox_mount) self.pushButton = QtGui.QPushButton(self.formLayoutWidget) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.pushButton) self.calendarWidget_from = QtGui.QCalendarWidget(self.formLayoutWidget) self.calendarWidget_from.setSelectedDate(QtCore.QDate(2015, 5, 28)) self.calendarWidget_from.setObjectName( _fromUtf8("calendarWidget_from")) self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.calendarWidget_from) self.calendarWidget_to = QtGui.QCalendarWidget(self.formLayoutWidget) self.calendarWidget_to.setObjectName(_fromUtf8("calendarWidget_to")) self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.calendarWidget_to) self.tabWidget.addTab(self.tab_items, _fromUtf8("")) self.tab_others = QtGui.QWidget() self.tab_others.setObjectName(_fromUtf8("tab_others")) self.tabWidget.addTab(self.tab_others, _fromUtf8("")) self.tableWidget = QtGui.QTableWidget(self.centralwidget) self.tableWidget.setGeometry(QtCore.QRect(340, 30, 540, 490)) self.tableWidget.setObjectName(_fromUtf8("tableWidget")) self.setTableFieldsByItem() # self.tableWidget.setColumnCount(4) self.tableWidget.setRowCount(0) # item = QtGui.QTableWidgetItem() # self.tableWidget.setHorizontalHeaderItem(0, item) # item = QtGui.QTableWidgetItem() # self.tableWidget.setHorizontalHeaderItem(1, item) # item = QtGui.QTableWidgetItem() # self.tableWidget.setHorizontalHeaderItem(2, item) # item = QtGui.QTableWidgetItem() # self.tableWidget.setHorizontalHeaderItem(3, item) MainWindow.setCentralWidget(self.centralwidget) self.toolBar = QtGui.QToolBar(MainWindow) self.setdb = QtGui.QAction(QtCore.QString("SetDB"), self.toolBar) self.toolBar.addAction(self.setdb) self.setItem = QtGui.QAction(QtCore.QString("SetItem"), self.toolBar) self.toolBar.addAction(self.setItem) self.saveCsv = QtGui.QAction(QtCore.QString("SaveCSV"), self.toolBar) self.saveCsv.setEnabled(False) self.toolBar.addAction(self.saveCsv) self.toolBar.setObjectName(_fromUtf8("toolBar")) MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.setdb, QtCore.SIGNAL(_fromUtf8("triggered ()")), self.showDlgSetdb) QtCore.QObject.connect(self.setItem, QtCore.SIGNAL(_fromUtf8("triggered ()")), self.showDlgSetItem) QtCore.QObject.connect(self.saveCsv, QtCore.SIGNAL(_fromUtf8("triggered ()")), self.saveFileCsv) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("pressed ()")), self.searchByItem) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def populateOneRegionBlockCellSizesTable(self): pass # 152 prrint "SIZE SIZE SIZE self.blockCellDimTable.height() =", self.blockCellDimTable.height() pass # 152 prrint "SIZE SIZE SIZE self.blockCellDimTable.parentWidget().height() =", self.blockCellDimTable.parentWidget().height() pass # 152 prrint "SIZE SIZE SIZE self.blockCellDimTable.width() =", self.blockCellDimTable.width() pass # 152 prrint "SIZE SIZE SIZE self.blockCellDimTable.parentWidget().width() =", self.blockCellDimTable.parentWidget().width() pass # 152 prrint "___ - DEBUG ----- CDTableOfBlockCellSizes: populateOneRegionBlockCellSizesTable() = ", self.blockCellDimTable.rowCount() # prevent blockCellDimTable from emitting any "cellChanged" signals when # updating its content programmatically: self.blockCellDimTable.blockSignals(True) pass # 152 prrint "self.oneBlockCellSizesList =", self.oneBlockCellSizesList pass # 152 prrint "self.oneBlockCellSizesList[0] =", self.oneBlockCellSizesList[0] pass # 152 prrint "self.oneBlockCellSizesList[1] =", self.oneBlockCellSizesList[1] pass # 152 prrint "self.oneBlockCellSizesList[2] =", self.oneBlockCellSizesList[2] # create a first QTableWidgetItem and place text (i.e. the "x" cell size) from oneBlockCellSizesList in it: lItem = QtGui.QTableWidgetItem( \ QtCore.QString("%1").arg( self.oneBlockCellSizesList[0] ) ) # this goes to column 1 in the table: self.blockCellDimTable.setItem(0, 0, lItem) # create a first QTableWidgetItem and place text (i.e. the "y" cell size) from oneBlockCellSizesList in it: lItem = QtGui.QTableWidgetItem( \ QtCore.QString("%1").arg(self.oneBlockCellSizesList[1]) ) # this goes to column 1 in the table: self.blockCellDimTable.setItem(1, 0, lItem) # create a first QTableWidgetItem and place text (i.e. the "z" cell size) from oneBlockCellSizesList in it: lItem = QtGui.QTableWidgetItem( \ QtCore.QString("%1").arg(self.oneBlockCellSizesList[2]) ) # this goes to column 1 in the table: self.blockCellDimTable.setItem(2, 0, lItem) # # # # distribute the available space according to the space requirement of each column or row: # # TODO TODO: all this widget layout semi/auto/resizing still @#$@*Y@ does not work... # w = 0 # for i in xrange(self.blockCellDimTable.columnCount()): # # print "column", i, "has width", self.blockCellDimTable.columnWidth(i) # w = w + self.blockCellDimTable.columnWidth(i) # w = w + self.blockCellDimTable.verticalHeader().width() # w = w + self.blockCellDimTable.verticalScrollBar().width() # # print "column and everything is", w # # h = 0 # for i in xrange(self.blockCellDimTable.rowCount()): # # print "row", i, "has height", self.blockCellDimTable.rowHeight(i) # h = h + self.blockCellDimTable.rowHeight(i) # h = h + self.blockCellDimTable.horizontalHeader().height() # h = h + self.blockCellDimTable.horizontalScrollBar().height() # # print "column and everything is", h # # self.blockCellDimTable.resize(w + 4, h + 4) # # self.blockCellDimTable.parentWidget().resize(w + 4, h + 4) # self.blockCellDimTable.resizeRowsToContents() self.blockCellDimTable.resizeColumnsToContents() # print "SIZE SIZE SIZE self.blockCellDimTable.height() =", self.blockCellDimTable.height() # print "SIZE SIZE SIZE self.blockCellDimTable.parentWidget().height() =", self.blockCellDimTable.parentWidget().height() # print "SIZE SIZE SIZE self.blockCellDimTable.width() =", self.blockCellDimTable.width() # print "SIZE SIZE SIZE self.blockCellDimTable.parentWidget().width() =", self.blockCellDimTable.parentWidget().width() # start with no table cell selected, and the user can then click to select: self.blockCellDimTable.setCurrentCell(-1, -1) # self.blockCellDimTable.parentWidget().resize(self.blockCellDimTable.width(),self.blockCellDimTable.height()) # allow blockCellDimTable to emit "cellChanged" signals now that we're done # updating its content programmatically: self.blockCellDimTable.blockSignals(False)
def __init__(self, *args, **kwargs): self.monitor = kwargs[MONITOR_KEY.KWARG] del kwargs[MONITOR_KEY.KWARG] self.pv_dict = kwargs['pv_dict'] del kwargs['pv_dict'] super(PvListWindow, self).__init__(*args, **kwargs) # Set up the user interface from Designer. self.load_ui("windows/pv_list_window.ui") self.setWindowTitle(settings.APP_NAME) self.label_map = {} self.cainfo_map = {} pv_list = [] self.drag_text_mixin_initialize() for k, v in self.pv_dict.iteritems(): pv_list.append((k, v)) pv_list.sort(key=lambda item: item[1]) item_count = len(pv_list) grid = self.gridLayout cols = 2 rows = int(math.ceil(float(len(pv_list)) / float(cols))) font = QtGui.QFont('Courier', 10) # font.setWeight(QtGui.QFont.Light) index = 0 for x in xrange(cols): for y in xrange(rows): if index >= item_count: break item = pv_list[index] index += 1 print "Adding PV", item label0 = QtGui.QLabel() label0.setText(QtCore.QString(item[0])) label0.setFont(font) label1 = QtGui.QLabel() pv_name = item[1] # label1.setText(QtCore.QString(item[0])) label1.setText(QtCore.QString(pv_name)) label1.setToolTip(QtCore.QString(pv_name)) label1.setFont(font) self.set_drag_text(label1, pv_name) label2 = QtGui.QLabel() label2.setText(QtCore.QString(pv_name)) label2.setToolTip(QtCore.QString(pv_name)) label2.setFont(font) self.set_drag_text(label2, pv_name) self.label_map[pv_name] = (label1, label2) grid.addWidget(label0, y, x * 4) grid.addWidget(label1, y, x * 4 + 1) grid.addWidget(label2, y, x * 4 + 2) if not self.monitor.is_local(pv_name): pushButton = QtGui.QPushButton('cainfo') pushButton.setMaximumWidth(50) pushButton.setMaximumHeight(20) grid.addWidget(pushButton, y, x * 4 + 3) pushButton.clicked.connect(lambda arg, pv_name=pv_name: self.handle_pushButton(pv_name)) self.monitor.connect(pv_name, self.handle_pv) self.handle_pv(pv_name)
def set_loop_bw(self, bw): self.gui.alphaEdit.setText(QtCore.QString("%1").arg(bw))
def make_file_dialog(self, title, dir, filter): fileD = QtGui.QFileDialog(self) fileD.setWindowTitle(QtCore.QString(title)) fileD.setFilter(QtCore.QString(filter)) fileD.setDirectory(QtCore.QString(dir)) return fileD
def __init__(self, f_control, f_oPrf=None, f_parent=None): """ constructor. cria uma dialog de edição de performances. @param f_control: control manager do editor da base de dados do TrackS. @param f_oPrf: performance a editar. @param f_parent: janela vinculada. """ # logger l_log.info("__init__:>>") # verifica parâmetros de entrada assert (f_control) # init super class super(dlgPrfEditNEW, self).__init__(f_parent) # salva o control manager localmente self._control = f_control # obtém o gerente de configuração self._config = f_control.oConfig assert (self._config) # obtém o dicionário de configuração self._dctConfig = self._config.dctConfig assert (self._dctConfig) # salva a parent window localmente self._wndParent = f_parent # salva os parâmetros localmente self._oPrf = f_oPrf # pathnames self._sPN = None # monta a dialog self.setupUi(self) # configura título da dialog self.setWindowTitle(u"TrackS - Edição de Performances") # atualiza na tela os dados da performance self.updatePrfData() # configurações de conexões slot/signal self.configConnects() # configurações de títulos e mensagens da janela de edição self.configTexts() # restaura as configurações da janela de edição self.restoreSettings() # configura botões self.bbxEditPrf.button( QtGui.QDialogButtonBox.Cancel).setText("&Cancela") self.bbxEditPrf.button(QtGui.QDialogButtonBox.Ok).setFocus() # força uma passgem pela edição de chave self.on_qleInd_textEdited(QtCore.QString()) # logger l_log.info("__init__:<<")
def attach_signal1(self, signal): self.signal1 = signal self.freq1Edit.setText( QtCore.QString("%1").arg(self.signal1.frequency())) self.amp1Edit.setText( QtCore.QString("%1").arg(self.signal1.amplitude()))
def __init__(self): """ Class constructor >>> 1 + 1 2 >>> """ super(DySMainWindow, self).__init__() # self.setAttribute(QtCore.Qt.WA_TranslucentBackground, 90) # minimum size self.setMinimumSize(500, 500) # computer information self._hostname = socket.gethostname() print "self._hostname =", self._hostname # style # self.setStyle("windows") # plastique # cde # motif # sgi # windows # cleanlooks # mac # icon self.setWindowIcon(QtGui.QIcon(":/application.png")) QtGui.QSystemTrayIcon(QtGui.QIcon(":/application.png")) # location of window on self.screen_geometry self.window_offset_x = 250 self.window_offset_y = 50 # language settings self.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) # window name self.setWindowTitle("DyS") # font self.font = QtGui.QFont("Consolas", 10) # mouse tracking self.setMouseTracking(True) # context menu self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # main window flags self.flags = QtCore.Qt.Window __main_dir = current_working_directory self._working_directory = QtCore.QString(os.path.abspath(__main_dir).replace("/", "\\")) # get screen geometry size self.screen_geometry = QtGui.QDesktopWidget().screenGeometry() # move # self.move(self.window_offset_x, self.window_offset_y) dy = .05*self.screen_geometry.height() # size of application # position main widget on self.screen_geometry self.setGeometry(.25*self.screen_geometry.width(), dy, .5*self.screen_geometry.width(), .5*self.screen_geometry.width()) # MBD system MBD_folder_name_ = None self.MBD_file_abs_path = None # self.MBD_filename = "0_0_0_double_pendulum.dprj" # MBD_folder_name_ = "dynamic_systems\\0_0_0_double_pendulum" # self.MBD_filename = "dys_0_.dprj" # MBD_folder_name_ = "dynamic_systems\\0_" # self.MBD_filename = "dys_0_2_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_2_1" # self.MBD_filename = "dys_0_3_prismatic_joint.dprj" # MBD_folder_name_ = "dynamic_systems\\0_3_prismatic_joint" # self.MBD_filename = "dys_0_4.dprj" # MBD_folder_name_ = "dynamic_systems\\0_4" # self.MBD_filename = "dys_0_5.dprj" # MBD_folder_name_ = "dynamic_systems\\0_5" # self.MBD_filename = "dys_0_6_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_6_1" # self.MBD_filename = "dys_0_6_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_6_2" # self.MBD_filename = "dys_0_7_0_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_0_1" # self.MBD_filename = "dys_0_7_0_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_0_2" # self.MBD_filename = "0_7_3_3_kinematic_analysis_1arm.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_1arm" # self.MBD_filename = "0_7_3_3_kinematic_analysis_2arm.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_2arm" # self.MBD_filename = "0_7_3_3_kinematic_analysis_slider_crank.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_slider_crank" # self.MBD_filename = "0_7_3_3_kinematic_analysis_4bar.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_4bar" # self.MBD_filename = "0_7_3_3_kinematic_analysis_efi.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_efi" # self.MBD_filename = "0_7_3_3_dynamic_analysis_efi.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_dynamic_analysis_efi" # self.MBD_filename = "0_7_3_3_dynamic_analysis_efi_V2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_dynamic_analysis_efi_V2" # self.MBD_filename = "dys_0_7_3_0.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_0" # self.MBD_filename = "0_7_3_0_plane_sphere.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_0_plane_sphere" # self.MBD_filename = "dys_0_7_2_revolute_clearence_joint.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_2_revolute_clearence_joint" # self.MBD_filename = "0_7_2_revolute_clearance_joint_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_2_revolute_clearance_joint_1" # self.MBD_filename = "0_7_3_0_contact_models.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_0_contact_models" self.MBD_filename = "0_7_3_0_contact_models_cylinder.dprj" MBD_folder_name_ = "dynamic_systems\\0_7_3_0_contact_models_cylinder" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_2" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_paper.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_paper" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_paper_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_paper_1" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_paper_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_paper_2" # self.MBD_filename = "0_7_1_0_spring_translational.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_1_0_spring_translational" # self.MBD_filename = "0_8_0_surface_roughness.dprj" # MBD_folder_name_ = "dynamic_systems\\0_8_0_surface_roughness" # self.MBD_filename = "0_9_0_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_0_brush_slip-ring" # self.MBD_filename = "0_9_1_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_1_brush_slip-ring" # self.MBD_filename = "0_9_2_multiple_contacts.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_2_multiple_contacts" # self.MBD_filename = "0_9_3_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_3_brush_slip-ring" # self.MBD_filename = "0_9_4_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_4_brush_slip-ring" # self.MBD_filename = "0_9_5_brush_energy.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_5_brush_energy" # self.MBD_filename = "0_9_6_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_6_brush_slip-ring" # self.MBD_filename = "1_0_0_ancf-beam.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-beam" # self.MBD_filename = "1_0_0_ancf-cantilever_1element.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_1element" # self.MBD_filename = "1_0_0_ancf-cantilever_2elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_2elements" # self.MBD_filename = "1_0_0_ancf-cantilever_2elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_2elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_4elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_4elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_8elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_8elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_16elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_16elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_32elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_32elements" # self.MBD_filename = "1_0_0_ancf-free_falling_flexible_pendulum.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-free_falling_flexible_pendulum" # self.MBD_filename = "1_0_0_ancf-cantilever_M.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_M" # self.MBD_filename = "1_0_0_ancf-beam_contact.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-beam_contact" # self.MBD_filename = "1_0_1_ancf_frame.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_ancf_frame" # self.MBD_filename = "1_0_1_geometry_test.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_geometry_test" # self.MBD_filename = "1_0_1_external_force.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_external_force" # self.MBD_filename = "1_0_1_paper_2_eigenfrequencies.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_eigenfrequencies" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_point_mass.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_point_mass" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_sub.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_sub" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_y_spring=-1mm.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_y_spring=-1mm" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_y_spring=+1mm.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_y_spring=+1mm" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_prestress_2x.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_prestress_2x" #self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_prestress_params_2x.dprj" #MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_prestress_params_2x" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_prestress_0.5x.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_prestress_0.5x" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_rigid.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_rigid" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_rigid_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_rigid_2" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_testing.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_testing" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_rigid_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_rigid_flexible" # self.MBD_filename = "1_0_1_paper_2_revolute_joint_flexible_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_revolute_joint_flexible_flexible" # self.MBD_filename = "1_0_1_paper_2_revolute_joint_rigid_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_revolute_joint_rigid_flexible" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_point_mass_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_point_mass_flexible" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_point_mass_flexible_offset.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_point_mass_flexible_offset" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_rigid_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_rigid_flexible" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_rigid_flexible_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_rigid_flexible_2" # predefine attributes self.simulation_control_widget = None self._visualization_widget = "vtk" # file is not defined if MBD_folder_name_ is None: self.MBD_folder_abs_path = os.getcwd() self.MBD_filename = project_filename = "Model_1" print "File is not defined" # file is defined else: self._working_directory = os.path.join(os.getcwd(), "..") self.MBD_file_abs_path = os.path.abspath(os.path.join(self._working_directory, MBD_folder_name_, self.MBD_filename)) self.MBD_folder_abs_path = os.path.join(self._working_directory, MBD_folder_name_) project_filename = os.path.basename(self.MBD_folder_abs_path) self._file_types = "Dynamic System Project File (*.dprj);;Multibody System File (*.mbd)" self.project = MBD_system_items.MBDsystemItem("MBDProject", parent=None) self.project.dys = self # print "self.MBD_folder_abs_path =", self.MBD_folder_abs_path self.MBD_system = MBDsystem(MBD_file_abs_path=self.MBD_file_abs_path, MBD_folder_abs_path=self.MBD_folder_abs_path, MBD_filename=project_filename, dys=self, parent=self.project) # tree view widget self.tree_view_widget = TreeViewWidget(self.project, self.MBD_system, parent=self) self.tree_view_widget.setWindowFlags(self.flags) # self.tree_view_widget.show() # move self.tree_view_widget.move(.18*self.screen_geometry.width() - self.tree_view_widget.frameGeometry().width(), dy)#self.frameGeometry().width(), self.frameGeometry().height()) self.tree_view_widget.resize(.20*self.screen_geometry.width(), 0.8 * self.screen_geometry.height()) # simulation control widget self.simulation_control_widget = SimulationControlWidget(MBD_system=self.MBD_system, parent=self) self.simulation_control_widget.setWindowFlags(self.flags) # self.simulation_control_widget.show() # move self.simulation_control_widget.move(.25*self.screen_geometry.width() + self.geometry().width(), dy) # preferences widget self.preferences_widget = PreferencesWidget(self.simulation_control_widget, parent=None) # graph widget - test for measure in self.MBD_system.measures: measure.graph_widget.setWindowFlags(self.flags) measure.graph_widget.show() # set central widget self.setCentralWidget(self.simulation_control_widget.vtkWidget) # self.simulation_control_widget.vtkWidget.displayText() # print "2 =", self.simulation_control_widget.vtkWidget.vtkWidget.GetSize() # if self.simulation_control_widget.opengl_widget is not None: # self.setCentralWidget(self.simulation_control_widget.opengl_widget) # init graph widget - test # graph_widget = GraphWidget(parent=self) # graph_widget.setWindowFlags(self.flags) # graph_widget.show() # output widget # maybe put in new thread? if output will be large # self.OutputWidget = OutputWidget(parent=self) # self.OutputWidget.setWindowFlags(self.flags) # self.OutputWidget.show() # job list widget self.JobListWidget = JobListWidget(job_list_=["job1", "job2", "job3"], parent=self) self.JobListWidget.setWindowFlags(self.flags) # python console self.python_console = None#PythonConsole() # resize # self.resize(self.simulation_control_widget.opengl_widget.initial_window_width, self.simulation_control_widget.opengl_widget.initial_window_height) # create actions self.create_actions() # create menus self.create_menus() # create status bar self.create_status_bar() # signals and connections self.connect_signals()
def set_error(self, title, shell): self.actionIcon.setIcon(Icon(Ico.CompileError)) self.statusLabel.setText(title) self.textWidget.setPlainText(QtCore.QString(shell))
def run_benford(self): employeeName = str(self.getItems()[1]).strip("(PyQt4.QtCore.QString()") MySupervisor = str( self.getItems()[2:]).strip("(PyQt4.QtCore.QString() u')") valuesList = self.read_File() #check if this is not the file we wanted or if the file doesnt exist anymore if valuesList is 0 or self.getItems() is None: print "Nothing yet" else: listOfOccurances = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ] #setting digit occurance to 0 for every digit leadingValues = [] try: for value in valuesList: digit = str(value).lstrip() leadingDigit = self.finding_leading_digit(digit) leadingValues.append(leadingDigit) if leadingDigit != 0: listOfOccurances[leadingDigit - 1] += 1 except Exception as error: print error #return leadingValues,listOfOccurances # print "Occurance by digit %s"%str(Counter(leadingValues)).strip("Counter()") SumOfDigitis = 0 for i in (Counter(leadingValues)).values(): SumOfDigitis += i frequencyOfOccurance = [] myKeys = [] print "Digit\t\tFrequency of occurance" for key, item in (Counter(leadingValues)).items(): frequencyOfOccurance.append(100 * float(item) / float(SumOfDigitis)) myKeys.append(key) self.myDld = QtGui.QWidget() self.table = QtGui.QTableWidget() self.table.setRowCount(len(myKeys)) self.table.setColumnCount(5) self.table.setHorizontalHeaderLabels( QtCore.QString( "First Digit;Actual Distribution;Benford's Law Distribution;Deviation;Anomaly?" ).split(";")) self.table.verticalHeader().hide() header = self.table.horizontalHeader() header.setResizeMode( QtGui.QHeaderView.ResizeToContents ) #can be ResizeTocontents,Stretch,Interactive(default),Fixed header.setStretchLastSection(True) item = QtGui.QTableWidgetItem() Allnumbers = [float(n) for n in range(1, 10)] benfords = [log10(1 + 1 / d) for d in Allnumbers] #print "Actual Distribution and the Distribution as predicted by Benfords Law" #print "First Digit\t\tActual Distribution\t\tBenford's Distribution\t\tDeviation from the Law" flagged_result = [] for keys, values, ben in zip(myKeys, frequencyOfOccurance, benfords): self.label1 = QtGui.QLabel() self.label2 = QtGui.QLabel() self.label3 = QtGui.QLabel() self.label4 = QtGui.QLabel() self.label5 = QtGui.QLabel("Yes") self.label5.setStyleSheet( _fromUtf8( "font: 75 italic 16pt \"Century Schoolbook L\";\n" "color:rgb(0, 0, 250);\n" "background:rgb(255, 69, 0)")) print "\t%d\t\t\t %5.1f%%\t\t\t\t %5.1f%%\t\t\t\t %5.1f%%" % ( keys, values, ben * 100., abs(values - (ben * 100.))) key = keys actual = round(values, 2) law = round(ben * 100., 2) diff = round(abs(values - (ben * 100.)), 2) self.label1.setText(QtCore.QString(str(actual))) self.label2.setText(QtCore.QString(str(law))) self.label3.setText(QtCore.QString(str(diff))) self.label4.setText(QtCore.QString(str(key))) self.table.setCellWidget(key - 1, 0, self.label4) self.table.setCellWidget(key - 1, 1, self.label1) self.table.setCellWidget(key - 1, 2, self.label2) self.table.setCellWidget(key - 1, 3, self.label3) if diff > 5: #self.table.setStyleSheet(_fromUtf8("background:red")) self.table.setCellWidget(key - 1, 4, self.label5) flagged_result.append(diff) if len(flagged_result) is not 0: self.Audit_Result() else: self.info.setWindowTitle("File opened for view") self.info.setText( "We did not detect any anomaly in this file.\nYou shall proceed to view it anyway!" ) self.info.exec_() layout = QtGui.QVBoxLayout() layout.addWidget(self.table) self.myDld.setLayout(layout) self.myDld.resize(600, 400) self.myDld.setWindowTitle("Actual Observation against Benford's ") self.myDld.show()
def selectMashup(self, name): itemlist = self.mashupsList.findItems(QtCore.QString(name), QtCore.Qt.MatchExactly) if len(itemlist) == 1: item = itemlist[0] self.mashupsList.setCurrentItem(item)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(854, 644) font = QtGui.QFont() font.setPointSize(10) MainWindow.setFont(font) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/query.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setObjectName("groupBox") self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtGui.QLabel(self.groupBox) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.dateEdit_From = QtGui.QDateEdit(self.groupBox) self.dateEdit_From.setCalendarPopup(True) self.dateEdit_From.setObjectName("dateEdit_From") self.horizontalLayout.addWidget(self.dateEdit_From) self.label_2 = QtGui.QLabel(self.groupBox) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.horizontalLayout.addWidget(self.label_2) self.dateEdit_To = QtGui.QDateEdit(self.groupBox) self.dateEdit_To.setCalendarPopup(True) self.dateEdit_To.setObjectName("dateEdit_To") self.horizontalLayout.addWidget(self.dateEdit_To) self.label_3 = QtGui.QLabel(self.groupBox) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName("label_3") self.horizontalLayout.addWidget(self.label_3) self.comboBox_SearchName = QtGui.QComboBox(self.groupBox) self.comboBox_SearchName.setEditable(True) self.comboBox_SearchName.setObjectName("comboBox_SearchName") self.horizontalLayout.addWidget(self.comboBox_SearchName) self.label_4 = QtGui.QLabel(self.groupBox) self.label_4.setAlignment(QtCore.Qt.AlignCenter) self.label_4.setObjectName("label_4") self.horizontalLayout.addWidget(self.label_4) self.comboBox_SearchCategory = QtGui.QComboBox(self.groupBox) self.comboBox_SearchCategory.setEditable(True) self.comboBox_SearchCategory.setObjectName("comboBox_SearchCategory") self.horizontalLayout.addWidget(self.comboBox_SearchCategory) self.label_5 = QtGui.QLabel(self.groupBox) self.label_5.setAlignment(QtCore.Qt.AlignCenter) self.label_5.setObjectName("label_5") self.horizontalLayout.addWidget(self.label_5) self.comboBox_InOutCome = QtGui.QComboBox(self.groupBox) self.comboBox_InOutCome.setEditable(True) self.comboBox_InOutCome.setObjectName("comboBox_InOutCome") self.comboBox_InOutCome.addItem(QtCore.QString()) self.comboBox_InOutCome.setItemText(0, "") self.comboBox_InOutCome.addItem(QtCore.QString()) self.comboBox_InOutCome.addItem(QtCore.QString()) self.horizontalLayout.addWidget(self.comboBox_InOutCome) self.pushButton_Query = QtGui.QPushButton(self.groupBox) self.pushButton_Query.setObjectName("pushButton_Query") self.horizontalLayout.addWidget(self.pushButton_Query) self.verticalLayout.addWidget(self.groupBox) self.tableView = QtGui.QTableView(self.centralwidget) font = QtGui.QFont() font.setFamily("MS Shell Dlg 2") font.setPointSize(10) self.tableView.setFont(font) self.tableView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.tableView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableView.setObjectName("tableView") self.verticalLayout.addWidget(self.tableView) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 854, 20)) self.menubar.setObjectName("menubar") self.menu_F = QtGui.QMenu(self.menubar) self.menu_F.setObjectName("menu_F") self.menu_O = QtGui.QMenu(self.menubar) self.menu_O.setObjectName("menu_O") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.toolBar = QtGui.QToolBar(MainWindow) self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toolBar.setObjectName("toolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.action_Exit = QtGui.QAction(MainWindow) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/icon/exit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_Exit.setIcon(icon1) self.action_Exit.setObjectName("action_Exit") self.action_Print = QtGui.QAction(MainWindow) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/icon/print.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_Print.setIcon(icon2) self.action_Print.setObjectName("action_Print") self.action_Edit = QtGui.QAction(MainWindow) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/icon/edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_Edit.setIcon(icon3) self.action_Edit.setObjectName("action_Edit") self.action_Delete = QtGui.QAction(MainWindow) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/icon/delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_Delete.setIcon(icon4) self.action_Delete.setObjectName("action_Delete") self.menu_F.addAction(self.action_Exit) self.menu_O.addAction(self.action_Print) self.menubar.addAction(self.menu_F.menuAction()) self.menubar.addAction(self.menu_O.menuAction()) self.toolBar.addAction(self.action_Print) self.label_2.setBuddy(self.dateEdit_To) self.label_3.setBuddy(self.comboBox_SearchName) self.label_4.setBuddy(self.comboBox_SearchCategory) self.label_5.setBuddy(self.comboBox_SearchCategory) self.retranslateUi(MainWindow) QtCore.QObject.connect(self.action_Exit, QtCore.SIGNAL("activated()"), MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def settingsKeyJoin(*keys): keys = [(str(key) if isinstance(key, QtCore.QString) else key) for key in keys if key] return QtCore.QString(posixpath.join(*keys))
def addButton(self, first, type_="move", v=None, parent=None): '''Add a button that creates a target for future moves.''' c = self.c p = c.p if v is None: v = p.v sc = scriptingController(c) mb = quickMoveButton(self, v, first, type_=type_) txt = self.txts[type_] if parent: # find parent button for i in self.buttons: if i[0].target.gnx == parent: parent = i[1] break else: g.es('Move to button parent not found, placing at top level') parent = None header = v.anyAtFileNodeName() or v.h # drop @auto etc. text = txt + ":" + header if txt else header # createButton truncates text. if parent and g.app.gui.guiName() == "qt": # see qtGui.py/class leoQtFrame/class qtIconBarClass/setCommandForButton pb = parent.button rc = QtGui.QAction(text, pb) rc.connect(rc, QtCore.SIGNAL("triggered()"), mb.moveCurrentNodeToTarget) pb.insertAction(pb.actions()[0], rc) # insert at top b = None mb.has_parent = True t = QtCore.QString( c.config.getString('mod_scripting_subtext') or '') if not unicode(pb.text()).endswith(unicode(t)): pb.setText(pb.text() + t) else: b = sc.createIconButton( text, command=mb.moveCurrentNodeToTarget, statusLine='Move current node to %s child of %s' % (g.choose(first, 'first', 'last'), v.h), bg="LightBlue") if g.app.gui.guiName() == "qt": def cb_goto_target(event=None, c=c, v=v): p = c.vnode2position(v) c.selectPosition(p) c.redraw() def cb_set_parent(event=None, c=c, v=v, first=first, type_=type_): c.quickMove.set_parent(v, first, type_) def cb_permanent(event=None, c=c, v=v, type_=type_, first=first): c.quickMove.permanentButton(v=v, type_=type_, first=first) # def cb_clear(event=None, c=c, v=v): # c.quickMove.clearButton(v) for cb, txt in [ (cb_goto_target, 'Goto target'), (cb_permanent, 'Make permanent'), # (cb_clear, 'Clear permanent'), (cb_set_parent, 'Set parent'), ]: but = b.button rc = QtGui.QAction(txt, but) rc.connect(rc, QtCore.SIGNAL("triggered()"), cb) but.insertAction(but.actions()[-1], rc) # insert rc before Remove Button self.buttons.append((mb, b))
def add_yaml_function_node(self, sub_entry, folder, parentNode): api = app.utils.load_yaml(sub_entry.filePath()) #print api ## TODO Qtify if 'section' in api and api['section']: section = api['section'] else: section = "#" #print api is_fixed = 'parameters_type' in api and api[ 'parameters_type'] == 'fixed' if not is_fixed: #print "foo" s = api['function'] + "(*)" funkFileItem = QtGui.QTreeWidgetItem(parentNode) funkFileItem.setIcon(self.COLS.icon, Icon(Ico.Function)) funkFileItem.setData(self.COLS.icon, QtCore.Qt.UserRole, sub_entry.fileName()) funkFileItem.setText(self.COLS.folder, folder) font = funkFileItem.font(self.COLS.icon) font.setBold(True) funkFileItem.setFont(self.COLS.icon, font) funkFileItem.setText(self.COLS.icon, s) funkFileItem.setText(self.COLS.function, api['function']) if len(api['parameters']) > 0: #p_list = [] for ap in api['parameters']: paraSyntax = QtGui.QTreeWidgetItem(funkFileItem) paraSyntax.setIcon(self.COLS.icon, Icon(Ico.FunctionSub)) paraSyntax.setData(self.COLS.icon, QtCore.Qt.UserRole, sub_entry.fileName()) font = funkFileItem.font(self.COLS.icon) font.setBold(True) paraSyntax.setFont(self.COLS.icon, font) func_name = api['function'] if ap.keys()[0] == '': s = func_name + "()" else: s = func_name + "( " + ap.keys()[0] + " )" paraSyntax.setText(self.COLS.icon, s) paraSyntax.setText(self.COLS.description, ap.values()[0]) paraSyntax.setText(self.COLS.function, api['function']) paraSyntax.setText(self.COLS.folder, folder) else: funkFileItem = QtGui.QTreeWidgetItem(parentNode) funkFileItem.setIcon(self.COLS.icon, Icon(Ico.Function)) #funkFileItem.setText(self.COLS.icon, sub_entry.fileName()) font = funkFileItem.font(self.COLS.icon) font.setBold(True) funkFileItem.setFont(self.COLS.icon, font) #if 'syntax' in api: # funkFileItem.setText(self.COLS.icon, api['syntax']) ss = "<b><font color=#176087 >%s</font></b>" % api['function'] s = api['function'] if len(api['parameters']) > 0: p_list = [] for ap in api['parameters']: #sss = "<font color=blue><b>%s</b></font>" % ap.keys()[0] sss = ap.keys()[0] p_list.append(sss) s += "( " + ", ".join(p_list) + " )" #kidd = QtGui.QTreeWidgetItem(funkFileItem) #kidd.setIcon(self.COLS.icon, Icon(Ico.Green)) else: s += "()" #s += " - <small>%s</small>" % api['summary'] funkFileItem.setText(self.COLS.icon, s) #lbl = QtGui.QLabel(s, self.tree) #lbl.setAutoFillBackground(True) #self.tree.setItemWidget(funkFileItem, self.COLS.icon, lbl) #kidd.setText(self.COLS.description, ap.values()[0]) #kidd.setData(self.COLS.icon, QtCore.Qt.UserRole, QtCore.QVariant(sub_entry.filePath())) funkFileItem.setText(self.COLS.description, api['summary']) funkFileItem.setText(self.COLS.function, api['function']) funkFileItem.setText(self.COLS.folder, folder) #funkFileItem.setText(self.COLS.section, section) funkFileItem.setData(self.COLS.icon, QtCore.Qt.UserRole, QtCore.QVariant(sub_entry.filePath())) #self.tree.setItemExpanded(funkFileItem, True) #print api['parameters'] if 1 == 0: if len(api['parameters']) > 0: ##TODO Qt'ify python code if 'parameters_type' in api and api[ 'parameters_type'] == 'fixed': for ap in api['parameters']: kidd = QtGui.QTreeWidgetItem(funkFileItem) kidd.setIcon(self.COLS.icon, Icon(Ico.FunctionParam)) kidd.setText(self.COLS.icon, ap.keys()[0]) kidd.setText(self.COLS.description, ap.values()[0]) kidd.setData(self.COLS.icon, QtCore.Qt.UserRole, QtCore.QVariant(sub_entry.filePath())) if 'return' in api and api['return'] != '': kidd = QtGui.QTreeWidgetItem(funkFileItem) kidd.setIcon(self.COLS.icon, Icon(Ico.FunctionReturn)) lbl = QtCore.QString("Return: ").append(api['return']) kidd.setText(self.COLS.icon, lbl) kidd.setData(self.COLS.icon, QtCore.Qt.UserRole, QtCore.QVariant(sub_entry.filePath())) kidd.setFirstColumnSpanned(True)
def addInit(self,args=[]): #Convert args into str for i in range (len(args)): args[i] = QtCore.QString(str(args[i])) #Put the creautur summerty in the main display for i in range(0,len(args),2): if args[i].compare('name',False) == 0: self.creatureName = args[i+1] if args[i].compare('init',False) == 0: self.creatureInit = args[i+1] if args[i].compare('hp',False) == 0:self.creatureHP = args[i+1] self.creatureInit = number_confirmer(val=self.creatureInit,minv=0) self.creatureHP = number_confirmer(val=self.creatureHP,minv=0) self.main_text.setText(make_creautre_summery(self.creatureName, self.creatureInit, self.creatureHP)) if self.creatureName == None: # read creaure name self.msg_line.setText('Creature name') self.condition = self.READNAME return if self.creatureInit == None: # read creature initaitve value self.msg_line.setText('Creature initiative') self.condition = self.READINIT return if self.creatureHP == None: # read creature hp value self.msg_line.setText('Creature HP') self.condition = self.READHP return #Add to the init label, we need to rearange the labels for ilabel in self.init_labels: if ilabel.init_round == -1: #Reached the end of the init list, append ilabel.setInitText(self.creatureName, self.creatureInit, self.creatureHP) #Increase creature count. This will only be reached once self.creatureCount += 1 break if ilabel.init_round < self.creatureInit: #Found somebody that acts later, switch nname = ilabel.name ninit = ilabel.init_round nhp = ilabel.hp ilabel.setInitText(self.creatureName, self.creatureInit, self.creatureHP) self.creatureName = nname self.creatureInit = ninit self.creatureHP = nhp self.addInit() break #no reading data from user past this line #initializing the marker if there is none if self.cur_init < 0: self.cur_init = 0 self.init_labels[0].setStyleSheet(self.cur_init_color) self.resetCondition() return
def slide_data_rate(self, data_rate): bit_data_rate = (int)((data_rate / 100.) * (self.frame_length) * self.symbol_time / (self.frame_length - 3)) self.gui.lineEditDataRate.setText( QtCore.QString("%1").number(data_rate / 100.)) self.rpc_mgr_tx.request("set_data_rate", [bit_data_rate])
def __init__(self, figura, parent = None): QMainWindow.__init__(self, parent) self.figura = figura self.setWindowTitle(u'Exportar video...') self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setGeometry(0, 0, 370, 261) self.setMinimumSize(370, 261) #self.setMaximumSize(370, 261) self.setWindowTitle(QtCore.QString(u'Exportar gráficas a video...')) vbox = QVBoxLayout() #Groupbox gb = QGroupBox(QtCore.QString('Opciones de video'), self) gb.setGeometry(10, 10, 351, 201) vbox.addWidget(gb) #Labels l1 = QLabel(QtCore.QString('Nombre:'), gb) l1.setGeometry(20, 30, 46, 13) #self.addWidget(l1) l2 = QLabel(QtCore.QString('Alto:'), gb) l2.setGeometry(20, 60, 46, 13) #self.addWidget(l2) l3 = QLabel(QtCore.QString('Ancho:'), gb) l3.setGeometry(20, 90, 46, 13) #self.addWidget(l3) l4 = QLabel(QtCore.QString('Cuadros por segundo (FPS):'), gb) l4.setGeometry(20, 120, 136, 13) l4.setToolTip(u'Cantidad de cuadros mostrados por cada segundo de reproducción') #self.addWidget(l4) l5 = QLabel(QtCore.QString('Directorio destino:'), gb) l5.setGeometry(20, 150, 88, 13) #self.addWidget(l5) #TextBoxes self.tb1 = QLineEdit(QtCore.QString('video'), gb) self.tb1.setGeometry(200, 30, 133, 20) self.tb1.setToolTip(u'Nombre del video') #self.addWidget(tb1) self.tb2 = QLineEdit(QtCore.QString('25'), gb) self.tb2.setGeometry(200, 120, 133, 20) self.tb2.setToolTip(u'Cantidad de cuadros mostrados por cada segundo de reproducción') #self.addWidget(tb2) ## print 'dir: ' + os.path.realpath('videos') ## print 'dir?: ' + str(os.path.isdir('videos')) self.tb3 = QLineEdit(QtCore.QString(os.path.realpath('videos')), gb) self.tb3.setReadOnly(True) self.tb3.setGeometry(200, 150, 91, 20) self.tb3.setToolTip(u'Ingrese la localización final del video,si deja default, se creará el video en el directorio videos de la aplicación') #self.addWidget(tb3) self.sb2 = QSpinBox(gb) self.sb2.setMaximum(800) self.sb2.setValue(800) self.sb2.setGeometry(200, 60, 133, 20) self.sb2.setToolTip(u'Ancho del video') QtCore.QObject.connect(self.sb2, QtCore.SIGNAL("valueChanged(int)"), self.validatorw) #self.addWidget(sb2) self.sb1 = QSpinBox(gb) self.sb1.setMaximum(600) self.sb1.setValue(600) self.sb1.setGeometry(200, 90, 133, 20) self.sb1.setToolTip(u'Alto del video') QtCore.QObject.connect(self.sb1, QtCore.SIGNAL("valueChanged(int)"), self.validatorh) #self.addWidget(sb1) #PushButtons pb1 = QPushButton(QtCore.QString('...'), gb) pb1.setToolTip(u'Presione este botón para indicar la localización del video.') pb1.setGeometry(300, 150, 31, 20) QtCore.QObject.connect(pb1, QtCore.SIGNAL("clicked()"), self.dir) #self.addWidget(pb1) self.pb2 = QPushButton(QtCore.QString('Aceptar'), self) self.pb2.setGeometry(10, 220, 75, 23) #vbox.addWidget(self.pb2) QtCore.QObject.connect(self.pb2, QtCore.SIGNAL("clicked()"), self.salvar) self.pb3 = QPushButton(QtCore.QString('Cancelar'), self) self.pb3.setGeometry(280, 220, 75, 23) QtCore.QObject.connect(self.pb3, QtCore.SIGNAL("clicked()"), self.close) #vbox.addWidget(self.pb3) self.setLayout(vbox)
def load_xml(self, fs_filename): """ load xml airspace file """ # check input # assert f_model # read coordinates ls_filename = ":/data/" + fs_filename + ".xml" l_data_file = QtCore.QFile(ls_filename) assert l_data_file is not None l_data_file.open(QtCore.QIODevice.ReadOnly) if not l_data_file.isOpen(): # logger l_log = logging.getLogger("airspace::load_xml") l_log.setLevel(logging.NOTSET) l_log.fatal("<E01: failed to open {}".format(ls_filename)) # abend sys.exit(1) l_xml_doc = QtXml.QDomDocument("airspace") assert l_xml_doc is not None if not l_xml_doc.setContent(l_data_file): l_data_file.close() # logger l_log = logging.getLogger("airspace::load_xml") l_log.setLevel(logging.NOTSET) l_log.fatal("<E02: failed to parse {}".format(ls_filename)) # abend sys.exit(1) l_data_file.close() l_doc_elem = l_xml_doc.documentElement() assert l_doc_elem is not None self.__f_variation, lv_ok = l_doc_elem.attribute( QtCore.QString("variation"), QtCore.QString("0")).toDouble() self.__f_elevation, lv_ok = l_doc_elem.attribute( QtCore.QString("elevation"), QtCore.QString("0")).toDouble() l_node = l_doc_elem.firstChild() assert l_node is not None while not l_node.isNull(): l_element = l_node.toElement() assert l_element is not None if not l_element.isNull(): self.__parse_dom_element(l_element) l_node = l_node.nextSibling() assert l_node is not None
def set_time_offset(self, to): self.gui.timeEdit.setText(QtCore.QString("%1").arg(to))