我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtCore.SIGNAL。
def get_coords_data(self): if self.gui_data is None: return option = None if self.listRadio.isChecked(): option = 1 else: option = 0 number = self.numberCheck.isChecked() player = self.playerCheck.isChecked() points = self.pointsCheck.isChecked() self.get_coords_thread = CoordsThread(self.gui_data, option, number, player, points) self.connect(self.get_coords_thread, QtCore.SIGNAL("update_coords(PyObject)"), self.update_coords) self.get_coords_thread.start()
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(u'Add new category') # self.categoryName = QtGui.QLineEdit('') self.categoryName.setStyleSheet('background-color:#FFF;') self.categoryDescription = QtGui.QTextEdit('') # buttons buttons = QtGui.QDialogButtonBox() buttons.setOrientation(QtCore.Qt.Vertical) buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Add", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) # lay = QtGui.QGridLayout(self) lay.addWidget(QtGui.QLabel(u'Name'), 0, 0, 1, 1) lay.addWidget(self.categoryName, 0, 1, 1, 1) lay.addWidget(QtGui.QLabel(u'Desctiption'), 1, 0, 1, 1, QtCore.Qt.AlignTop) lay.addWidget(self.categoryDescription, 1, 1, 1, 1) lay.addWidget(buttons, 0, 2, 2, 1, QtCore.Qt.AlignCenter) lay.setRowStretch(1, 10)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # self.form = self self.form.setWindowTitle(u"Export to Kerkythea v1.2") # tab = QtGui.QTabWidget() tab.addTab(self.tabGeneral(), u'General') tab.addTab(self.tabCamera(), u'Cameras') tab.addTab(self.tabLight(), u'Lights') # lay = QtGui.QVBoxLayout(self) lay.addWidget(tab) # self.connect(self.exportObjectsAs_YES, QtCore.SIGNAL("clicked ()"), self.setColors) self.connect(self.exportObjectsAs_NO, QtCore.SIGNAL("clicked ()"), self.setColors)
def sort(self, column, order): if "line_list" not in self.session.metadata: return None self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()")) self.session.metadata["line_list"].sort(self.columns[column]) if order == QtCore.Qt.DescendingOrder: self.session.metadata["line_list"].reverse() self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(self.rowCount(0), self.columnCount(0))) self.emit(QtCore.SIGNAL("layoutChanged()")) # Must update hash sorting after any modification to line list self.session.metadata["line_list_argsort_hashes"] = np.argsort( self.session.metadata["line_list"]["hash"])
def run(self): if self.incoming_file: try: file_path, file_type = self.incoming_file if file_type in ["APK", "DEX", "DEY"]: ret = self.session.add(file_path, open(file_path, 'r').read()) self.emit(QtCore.SIGNAL("loadedFile(bool)"), ret) elif file_type == "SESSION" : self.session.load(file_path) self.emit(QtCore.SIGNAL("loadedFile(bool)"), True) except Exception as e: androconf.debug(e) androconf.debug(traceback.format_exc()) self.emit(QtCore.SIGNAL("loadedFile(bool)"), False) self.incoming_file = [] else: self.emit(QtCore.SIGNAL("loadedFile(bool)"), False)
def __init__(self, obj): self.mesh_obj = obj self.form = FreeCADGui.PySideUic.loadUi(CfdTools.getModulePath() + "/TaskPanelCaeMesherGmsh.ui") self.Timer = QtCore.QTimer() self.Timer.start(100) # 100 milli seconds self.gmsh_runs = False self.console_message_gmsh = '' QtCore.QObject.connect(self.form.if_max, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.max_changed) QtCore.QObject.connect(self.form.if_min, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.min_changed) QtCore.QObject.connect(self.form.cb_dimension, QtCore.SIGNAL("activated(int)"), self.choose_dimension) QtCore.QObject.connect(self.Timer, QtCore.SIGNAL("timeout()"), self.update_timer_text) self.form.cb_dimension.addItems(_CaeMeshGmsh._CaeMeshGmsh.known_element_dimensions) self.get_mesh_params() self.get_active_analysis() self.update()
def Establish_Connections(self): # loop button and menu action to link to functions for ui_name in self.uiList.keys(): if ui_name.endswith('_btn'): QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name))) elif ui_name.endswith('_atn'): QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name))) elif ui_name.endswith('_btnMsg'): QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name))) elif ui_name.endswith('_atnMsg'): QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name))) # custom connection #======================================= # UI Response functions (custom + prebuilt functions) #======================================= #-- ui actions
def __init__(self, media, parent): super(VideoMediaView, self).__init__(media, parent) self._widget = QWidget(parent) self._process = QProcess(self._widget) self._process.setObjectName('%s-process' % self.objectName()) self._std_out = [] self._errors = [] self._stopping = False self._mute = False if 'mute' in self._options: self._mute = bool(int(self._options['mute'])) self._widget.setGeometry(media['_geometry']) self.connect(self._process, SIGNAL("error()"), self._process_error) self.connect(self._process, SIGNAL("finished()"), self.stop) self.connect(self._process, SIGNAL("readyReadStandardOutput()"), self.__grep_std_out) self.set_default_widget_prop() self._stop_timer = QTimer(self) self._stop_timer.setSingleShot(True) self._stop_timer.setInterval(1000) self._stop_timer.timeout.connect(self._force_stop)
def run(self): self.emit(QtCore.SIGNAL("reset_rows()")) for row in self.table_data: self.emit(QtCore.SIGNAL("update_table(PyObject)"), row) self.emit(QtCore.SIGNAL("get_coords_data(PyObject)"), self.table_data)
def table_function(self): self.get_table_thread = TableThread(self.gui_data) self.connect(self.get_table_thread, QtCore.SIGNAL("update_table(PyObject)"), self.update_table) self.connect(self.get_table_thread, QtCore.SIGNAL("reset_rows()"), self.reset_rows) self.connect(self.get_table_thread, QtCore.SIGNAL("get_coords_data(PyObject)"), self.get_coords_data) self.get_table_thread.start()
def download_function(self): self.downloadButton.setEnabled(False) self.downloadButton.setText("Downloading....") server = self.serverBox.currentText() world = self.worldBox.currentText() url = self.servers_dict[server][world] self.get_download_thread = DownloadThread(url) self.connect(self.get_download_thread, QtCore.SIGNAL("get_world_data(PyObject)"), self.get_world_data) self.connect(self.get_download_thread, QtCore.SIGNAL("download_error(PyObject)"), self.download_error) self.get_download_thread.start()
def run(self): speed_dict = {0: 18, 1:22, 2:18, 3:18, 4: 9, 5: 10, 6: 10, 7: 11, 8: 30, 9: 30, 10: 10, 11: 35} speed = speed_dict[self.unit] one_field_speed = speed * (1 / float(self.unit_speed)) * (1 / float(self.world_speed)) origin = self.origin.split("|") origin_x = origin[0] origin_y = origin[1] destination = self.destination.split("|") destination_x = destination[0] destination_y = destination[1] x = int(origin_x) - int(destination_x) y = int(origin_y) - int(destination_y) max_range_squared = (x ** 2) + (y ** 2) range_ = math.sqrt(max_range_squared) minutes = range_ * one_field_speed rounded_seconds = round(minutes * 60) travel_time = datetime.timedelta(seconds = rounded_seconds) arrival_time = self.arrival.toPython() backtime = arrival_time + travel_time data = [backtime, self.origin] self.emit(QtCore.SIGNAL("update_backtime(PyObject)"), data)
def backtime_function(self): if ((self.world_speed == 0) and (self.unit_speed == 0)): print("asdasd") return origin_coord = self.originEdit.text() destination_coord = self.destinationEdit.text() coord_pattern = re.compile("\d{3}\|\d{3}") origin_validity = coord_pattern.match(origin_coord) destination_validity = coord_pattern.match(destination_coord) if ((destination_validity is None) or (origin_validity is None)): QtGui.QMessageBox.critical( self, "Search Around Error", "Please enter a valid coordinate such as 556|494", QtGui.QMessageBox.Ok) self.calculateButton.setEnabled(True) return self.calculateButton.setEnabled(False) world_speed = self.world_speed unit_speed = self.unit_speed origin = self.originEdit.text() destination = self.destinationEdit.text() unit = self.unitBox.currentIndex() arrival = self.arrivalEdit.dateTime() self.get_backtime_thread = BacktimeThread(world_speed, unit_speed, origin, destination, unit, arrival) self.connect(self.get_backtime_thread, QtCore.SIGNAL("update_backtime(PyObject)"), self.update_backtime) self.get_backtime_thread.start()
def run(self): coord_pattern = re.compile("\d{3}\|\d{3}") coords_list = list(set(re.findall(coord_pattern, self.text))) coords_string = "" for coord in coords_list: coords_string = coords_string + coord + " " coords_string = coords_string[:-1] self.emit(QtCore.SIGNAL("get_coords(PyObject)"), coords_string)
def extract_function(self): self.extractButton.setEnabled(False) text = self.plainTextEdit.toPlainText() self.get_extract_thread = ExtractThread(text) self.connect(self.get_extract_thread, QtCore.SIGNAL("get_coords(PyObject)"), self.get_coords) self.get_extract_thread.start()
def generateWidget( self, idGDT, ContainerOfData ): self.idGDT = idGDT self.ContainerOfData = ContainerOfData if hasattr(FreeCADGui,"Snapper"): if FreeCADGui.Snapper.grid: FreeCAD.DraftWorkingPlane.alignToPointAndAxis(self.ContainerOfData.p1, self.ContainerOfData.Direction, 0.0) FreeCADGui.Snapper.grid.set() self.FORMAT = makeFormatSpec(0,'Length') self.uiloader = FreeCADGui.UiLoader() self.inputfield = self.uiloader.createWidget("Gui::InputField") self.inputfield.setText(self.FORMAT % 0) self.ContainerOfData.OffsetValue = 0 QtCore.QObject.connect(self.inputfield,QtCore.SIGNAL("valueChanged(double)"),self.valueChanged) return GDTDialog_hbox(self.Text,self.inputfield)
def connect(sender, signal, callback): """Connect a signal. Use this function only in cases where code should work with both Qt5 and Qt4, as it is an ugly hack. Args: sender: The Qt object emitting the signal signal: A string, containing the signal signature (as in Qt4 and PySide) callback: The function to be called upon receiving the signal """ if use_qt5: return getattr(sender, signal.split('(', 1)[0]).connect(callback) else: return sender.connect(QtCore.SIGNAL(signal), callback)
def disconnect(sender, signal, callback): """Disconnect a signal. Use this function only in cases where code should work with both Qt5 and Qt4, as it is an ugly hack. Args: sender: The Qt object emitting the signal signal: A string, containing the signal signature (as in Qt4 and PySide) callback: The function to be called upon receiving the signal """ if use_qt5: return getattr(sender, signal.split('(', 1)[0]).disconnect(callback) else: return sender.disconnect(QtCore.SIGNAL(signal), callback)
def __init__(self, categoryID, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(u'Update category') self.categoryID = categoryID categoryData = readCategories()[self.categoryID] # self.categoryName = QtGui.QLineEdit('') self.categoryName.setStyleSheet('background-color:#FFF;') self.categoryName.setText(categoryData[0]) self.categoryDescription = QtGui.QTextEdit('') self.categoryDescription.setText(categoryData[1]) # buttons buttons = QtGui.QDialogButtonBox() buttons.setOrientation(QtCore.Qt.Vertical) buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Update", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) # lay = QtGui.QGridLayout(self) lay.addWidget(QtGui.QLabel(u'Name'), 0, 0, 1, 1) lay.addWidget(self.categoryName, 0, 1, 1, 1) lay.addWidget(QtGui.QLabel(u'Desctiption'), 1, 0, 1, 1, QtCore.Qt.AlignTop) lay.addWidget(self.categoryDescription, 1, 1, 1, 1) lay.addWidget(buttons, 0, 2, 2, 1, QtCore.Qt.AlignCenter) lay.setRowStretch(1, 10)
def formatPliku(self): page = QtGui.QWizardPage() page.setSubTitle(u"<span style='font-weight:bold;font-size:13px;'>File format</span>") # self.nazwaProgramu = QtGui.QLabel() self.formatPliku = QtGui.QLabel() self.ikonaProgramu = QtGui.QLabel() self.ikonaProgramu.setFixedSize(120, 120) self.ikonaProgramu.setAlignment(QtCore.Qt.AlignCenter) # self.listaFormatow = QtGui.QListWidget() for i, j in supSoftware.items(): if j['export']: a = QtGui.QListWidgetItem(j['name']) a.setData(QtCore.Qt.UserRole, i) self.listaFormatow.addItem(a) QtCore.QObject.connect(self.listaFormatow, QtCore.SIGNAL("currentRowChanged (int)"), self.zmianaProgramu) # lay = QtGui.QGridLayout(page) lay.addWidget(self.listaFormatow, 0, 0, 4, 1) lay.addWidget(self.ikonaProgramu, 0, 1, 1, 1, QtCore.Qt.AlignCenter) lay.addWidget(self.nazwaProgramu, 1, 1, 1, 1) lay.addWidget(self.formatPliku, 2, 1, 1, 1) lay.setHorizontalSpacing(20) lay.setColumnMinimumWidth(1, 140) return page
def exportUstawienia(self): page = QtGui.QWizardPage() page.setSubTitle(u"<span style='font-weight:bold;font-size:13px;'>Settings</span>") # self.pathToFile = QtGui.QLineEdit('') #self.pathToFile.setReadOnly(True) # zmianaSciezki = QtGui.QPushButton('...') zmianaSciezki.setToolTip(u'Change path') QtCore.QObject.connect(zmianaSciezki, QtCore.SIGNAL("pressed ()"), self.zmianaSciezkiF) # self.addHoles = QtGui.QCheckBox(u'Add holes') self.addDimensions = QtGui.QCheckBox(u'Add dimensions') self.addAnnotations = QtGui.QCheckBox(u'Add annotations') self.addGluePaths = QtGui.QCheckBox(u'Export glue paths') # lay = QtGui.QGridLayout(page) lay.addWidget(QtGui.QLabel(u'Path: '), 0, 0, 1, 1) lay.addWidget(self.pathToFile, 0, 1, 1, 1) lay.addWidget(zmianaSciezki, 0, 2, 1, 1) lay.addItem(QtGui.QSpacerItem(1, 10), 1, 0, 1, 3) lay.addWidget(self.addHoles, 2, 0, 1, 3) lay.addWidget(self.addDimensions, 3, 0, 1, 3) lay.addWidget(self.addAnnotations, 4, 0, 1, 3) lay.addWidget(self.addGluePaths, 5, 0, 1, 3) lay.setColumnStretch(1, 6) return page
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # self.form = self self.form.setWindowTitle(u'Check collisions') self.form.setWindowIcon(QtGui.QIcon(":/data/img/collisions.png")) self.root = None self.obj = None self.tmpFile = None self.transaprency = {} # self.createSolid = QtGui.QCheckBox(u'Create solid on exit') # self.table1 = collisionObjectTable() # self.table2 = collisionObjectTable() # checkButton = QtGui.QPushButton(u"Check") self.connect(checkButton, QtCore.SIGNAL("released ()"), self.preview) # lay = QtGui.QGridLayout(self) lay.addWidget(checkButton, 0, 0, 1, 2) lay.addWidget(QtGui.QLabel(u'First group'), 1, 0, 1, 1) lay.addWidget(self.table1, 2, 0, 1, 1) lay.addWidget(QtGui.QLabel(u'Second group'), 1, 1, 1, 1) lay.addWidget(self.table2, 2, 1, 1, 1) lay.addWidget(self.createSolid, 3, 0, 1, 2) # self.readObjects() self.removeRoot()
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle("Convert old database to a new format") self.setMinimumWidth(500) # stary plik z modelami self.oldFilePath = QtGui.QLineEdit(os.path.join(__currentPath__, "param.py")) # nowy plik z modelami self.newFilePath = QtGui.QLineEdit(os.path.join(__currentPath__, "data/dane.cfg")) # self.pominDuplikaty = QtGui.QCheckBox(u"Skip duplicates") self.pominDuplikaty.setChecked(True) self.pominDuplikaty.setDisabled(True) # self.removeOld = QtGui.QCheckBox(u"Remove old database") self.removeOld.setChecked(True) # przyciski buttons = QtGui.QDialogButtonBox() buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Convert", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self.konwertuj) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) # self.mainLayout = QtGui.QGridLayout(self) #self.mainLayout.setContentsMargins(0, 0, 0, 0) self.mainLayout.addWidget(QtGui.QLabel(u"Old database"), 0, 0, 1, 1) self.mainLayout.addWidget(self.oldFilePath, 0, 1, 1, 1) self.mainLayout.addWidget(QtGui.QLabel(u"New database"), 1, 0, 1, 1) self.mainLayout.addWidget(self.newFilePath, 1, 1, 1, 1) self.mainLayout.addWidget(self.pominDuplikaty, 3, 0, 1, 2) self.mainLayout.addWidget(self.removeOld, 4, 0, 1, 2) self.mainLayout.addWidget(buttons, 5, 1, 1, 1, QtCore.Qt.AlignRight) self.mainLayout.setRowStretch(6, 10)
def open(self): self.form.connect(self.form.positionX, QtCore.SIGNAL('valueChanged (double)'), self.changePos) self.form.connect(self.form.positionY, QtCore.SIGNAL('valueChanged (double)'), self.changePos) self.form.connect(self.form.positionZ, QtCore.SIGNAL('valueChanged (double)'), self.changePos) self.form.connect(self.form.rotationRX, QtCore.SIGNAL('valueChanged (double)'), self.changePos) self.form.connect(self.form.rotationRY, QtCore.SIGNAL('valueChanged (double)'), self.changePos) self.form.connect(self.form.rotationRZ, QtCore.SIGNAL('valueChanged (double)'), self.changePos) self.form.connect(self.form.resetButton, QtCore.SIGNAL('pressed ()'), self.loadData) # self.readLibs() self.loadData() self.changePos(1) # self.form.connect(self.form.listaBibliotek, QtCore.SIGNAL('currentIndexChanged (int)'), self.loadData)
def __init__(self, parent=None): QtGui.QPushButton.__init__(self, parent) self.setStyleSheet(''' QPushButton { border: 1px solid #000; background-color: rgb(255, 0, 0); margin: 1px; } ''') self.setFlat(True) #self.setFixedSize(20, 20) self.kolor = [0., 0., 0.] # self.connect(self, QtCore.SIGNAL("released ()"), self.pickColor)
def defConstraintAreaF(self): ''' create constraint are dialog ''' dial = QtGui.QDialog() dial.setWindowTitle("Create constraint area") # areas list lista = QtGui.QListWidget() for i, j in PCBconstraintAreas.items(): a = QtGui.QListWidgetItem(j[0]) a.setData(QtCore.Qt.UserRole, i) lista.addItem(a) lista.sortItems() ########## # przyciski buttons = QtGui.QDialogButtonBox() buttons.setOrientation(QtCore.Qt.Vertical) buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Create", QtGui.QDialogButtonBox.AcceptRole) dial.connect(buttons, QtCore.SIGNAL("accepted()"), dial, QtCore.SLOT("accept()")) dial.connect(buttons, QtCore.SIGNAL("rejected()"), dial, QtCore.SLOT("reject()")) #### lay = QtGui.QGridLayout() lay.addWidget(lista, 0, 0, 1, 1) lay.addWidget(buttons, 0, 1, 1, 1) dial.setLayout(lay) if dial.exec_(): self.constraintAreaF(str(lista.currentItem().data(QtCore.Qt.UserRole)))
def sort(self, column, order): self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()")) self._data = sorted(self._data, key=lambda sm: getattr(sm, self.attrs[column])) if order == QtCore.Qt.DescendingOrder: self._data.reverse() self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(self.rowCount(0), self.columnCount(0))) self.emit(QtCore.SIGNAL("layoutChanged()"))
def sort(self, column, order): if "spectral_models" not in self.session.metadata: return None self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()")) sorters = { 0: lambda sm: sm.transitions["wavelength"].mean(), 1: lambda sm: sm._repr_element, 2: lambda sm: isinstance(sm, SpectralSynthesisModel), 3: lambda sm: sm.use_for_stellar_parameter_inference, 4: lambda sm: sm.use_for_stellar_composition_inference } self.session.metadata["spectral_models"].sort(key=sorters[column]) if order == QtCore.Qt.DescendingOrder: self.session.metadata["spectral_models"].reverse() self.session._spectral_model_conflicts = spectral_model_conflicts( self.session.metadata["spectral_models"], self.session.metadata["line_list"]) self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(self.rowCount(0), self.columnCount(0))) self.emit(QtCore.SIGNAL("layoutChanged()"))
def setupSession(self): self.session = Session() self.fileLoadingThread = FileLoadingThread(self.session) self.connect(self.fileLoadingThread, QtCore.SIGNAL("loadedFile(bool)"), self.loadedFile)
def signalConnection(self): self.connect(self.page().mainFrame(), QtCore.SIGNAL("javaScriptWindowObjectCleared ()"), self.javaScriptWindowObjectCleared) self.settings().setAttribute(QtWebKit.QWebSettings.WebAttribute.DeveloperExtrasEnabled, True) QtCore.QObject.connect(self.page(), QtCore.SIGNAL('selectionChanged()'), self.selectionChanged)
def setupUi(self, FileAnalyzerDialog): FileAnalyzerDialog.setObjectName("FileAnalyzerDialog") FileAnalyzerDialog.resize(904, 505) self.gridLayoutWidget = QtGui.QWidget(FileAnalyzerDialog) self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 20, 881, 471)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.gridLayout_2 = QtGui.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.btnRefresh = QtGui.QPushButton(self.gridLayoutWidget) self.btnRefresh.setObjectName("btnRefresh") self.gridLayout_2.addWidget(self.btnRefresh, 1, 0, 1, 1) self.btnExport = QtGui.QPushButton(self.gridLayoutWidget) self.btnExport.setObjectName("btnExport") self.gridLayout_2.addWidget(self.btnExport, 0, 0, 1, 1) self.btnPivot = QtGui.QPushButton(self.gridLayoutWidget) self.btnPivot.setObjectName("btnPivot") self.gridLayout_2.addWidget(self.btnPivot, 2, 0, 1, 1) self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1) self.buttonBox = QtGui.QDialogButtonBox(self.gridLayoutWidget) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 1, 1, 1, 1) self.tableView = QtGui.QTableView(self.gridLayoutWidget) self.tableView.setObjectName("tableView") self.gridLayout.addWidget(self.tableView, 0, 1, 1, 1) self.retranslateUi(FileAnalyzerDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), FileAnalyzerDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), FileAnalyzerDialog.reject) QtCore.QMetaObject.connectSlotsByName(FileAnalyzerDialog)
def setupUi(self, LineEditDialog): LineEditDialog.setObjectName("LineEditDialog") LineEditDialog.resize(294, 112) self.verticalLayoutWidget = QtGui.QWidget(LineEditDialog) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 271, 91)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label = QtGui.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.lineEdit = QtGui.QLineEdit(self.verticalLayoutWidget) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.buttonBox = QtGui.QDialogButtonBox(self.verticalLayoutWidget) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(LineEditDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), LineEditDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), LineEditDialog.reject) QtCore.QMetaObject.connectSlotsByName(LineEditDialog)
def setupUi(self, DirectoryViewDialog): DirectoryViewDialog.setObjectName("DirectoryViewDialog") DirectoryViewDialog.resize(408, 337) self.gridLayoutWidget = QtGui.QWidget(DirectoryViewDialog) self.gridLayoutWidget.setGeometry(QtCore.QRect(20, 20, 371, 301)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.gridLayout_2 = QtGui.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.btnRefresh = QtGui.QPushButton(self.gridLayoutWidget) self.btnRefresh.setObjectName("btnRefresh") self.gridLayout_2.addWidget(self.btnRefresh, 4, 0, 1, 1) self.btnUpload = QtGui.QPushButton(self.gridLayoutWidget) self.btnUpload.setObjectName("btnUpload") self.gridLayout_2.addWidget(self.btnUpload, 0, 0, 1, 1) self.btnDelete = QtGui.QPushButton(self.gridLayoutWidget) self.btnDelete.setObjectName("btnDelete") self.gridLayout_2.addWidget(self.btnDelete, 3, 0, 1, 1) self.btnDownload = QtGui.QPushButton(self.gridLayoutWidget) self.btnDownload.setObjectName("btnDownload") self.gridLayout_2.addWidget(self.btnDownload, 1, 0, 1, 1) self.btnAddFolder = QtGui.QPushButton(self.gridLayoutWidget) self.btnAddFolder.setObjectName("btnAddFolder") self.gridLayout_2.addWidget(self.btnAddFolder, 2, 0, 1, 1) self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1) self.treeView = QtGui.QTreeView(self.gridLayoutWidget) self.treeView.setObjectName("treeView") self.gridLayout.addWidget(self.treeView, 0, 1, 1, 1) self.buttonBox = QtGui.QDialogButtonBox(self.gridLayoutWidget) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 1, 1, 1, 1) self.retranslateUi(DirectoryViewDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), DirectoryViewDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), DirectoryViewDialog.reject) QtCore.QMetaObject.connectSlotsByName(DirectoryViewDialog)
def __init__(self): ui_path = os.path.dirname(__file__) + os.path.sep + "TaskPanelCfdResult.ui" self.form = FreeCADGui.PySideUic.loadUi(ui_path) #self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem") #self.restore_result_settings_in_dialog = self.fem_prefs.GetBool("RestoreResultDialog", True) # Connect Signals and Slots QtCore.QObject.connect(self.form.rb_none, QtCore.SIGNAL("toggled(bool)"), self.none_selected) QtCore.QObject.connect(self.form.rb_x_velocity, QtCore.SIGNAL("toggled(bool)"), self.x_velocity_selected) QtCore.QObject.connect(self.form.rb_y_velocity, QtCore.SIGNAL("toggled(bool)"), self.y_velocity_selected) QtCore.QObject.connect(self.form.rb_z_velocity, QtCore.SIGNAL("toggled(bool)"), self.z_velocity_selected) QtCore.QObject.connect(self.form.rb_mag_velocity, QtCore.SIGNAL("toggled(bool)"), self.mag_velocity_selected) QtCore.QObject.connect(self.form.rb_pressure, QtCore.SIGNAL("toggled(bool)"), self.pressure_selected) QtCore.QObject.connect(self.form.rb_temperature, QtCore.SIGNAL("toggled(bool)"), self.temperature_selected) QtCore.QObject.connect(self.form.rb_turbulence_energy, QtCore.SIGNAL("toggled(bool)"), self.turbulence_energy_selected) # """ # could be remove later if vector displacement will not be implemented #QtCore.QObject.connect(self.form.user_def_eq, QtCore.SIGNAL("textchanged()"), self.user_defined_text) QtCore.QObject.connect(self.form.calculate, QtCore.SIGNAL("clicked()"), self.calculate) QtCore.QObject.connect(self.form.cb_show_velocity, QtCore.SIGNAL("clicked(bool)"), self.show_velocity) QtCore.QObject.connect(self.form.hsb_velocity_factor, QtCore.SIGNAL("valueChanged(int)"), self.hsb_vel_factor_changed) QtCore.QObject.connect(self.form.sb_velocity_factor, QtCore.SIGNAL("valueChanged(int)"), self.sb_vel_factor_changed) QtCore.QObject.connect(self.form.sb_velocity_factor_max, QtCore.SIGNAL("valueChanged(int)"), self.sb_vel_factor_max_changed) """ self.update() FreeCAD.FEM_dialog = {"results_type": 'None' } self.restore_result_dialog() #if self.restore_result_settings_in_dialog: # self.restore_result_dialog()
def _action(self, name, callback=None, icon_path=None): """ Create an action and store it in self.actions. """ action = QtGui.QAction(self) action.setText(name) if icon_path: action.setIcon(icon_path) if callback: action.connect(action, QtCore.SIGNAL("triggered()"), callback) return action
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(680, 403) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName("gridLayout") self.labelVersion = QtGui.QLabel(Dialog) self.labelVersion.setObjectName("labelVersion") self.gridLayout.addWidget(self.labelVersion, 0, 0, 1, 1) self.labelSupport = QtGui.QLabel(Dialog) self.labelSupport.setObjectName("labelSupport") self.gridLayout.addWidget(self.labelSupport, 1, 0, 1, 1) self.labelLicense = QtGui.QLabel(Dialog) self.labelLicense.setObjectName("labelLicense") self.gridLayout.addWidget(self.labelLicense, 2, 0, 1, 1) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/mpowertcx icon flat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setIconSize(QtCore.QSize(256, 256)) self.pushButton.setFlat(True) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 1, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 1, 1, 1) self.licenseEdit = QtGui.QPlainTextEdit(Dialog) self.licenseEdit.setFrameShape(QtGui.QFrame.Box) self.licenseEdit.setReadOnly(True) self.licenseEdit.setObjectName("licenseEdit") self.gridLayout.addWidget(self.licenseEdit, 3, 0, 2, 1) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(756, 395) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName("gridLayout") self.labelVersion = QtGui.QLabel(Dialog) self.labelVersion.setObjectName("labelVersion") self.gridLayout.addWidget(self.labelVersion, 0, 0, 1, 1) self.labelSupport = QtGui.QLabel(Dialog) self.labelSupport.setObjectName("labelSupport") self.gridLayout.addWidget(self.labelSupport, 1, 0, 1, 1) self.labelLicense = QtGui.QLabel(Dialog) self.labelLicense.setObjectName("labelLicense") self.gridLayout.addWidget(self.labelLicense, 2, 0, 1, 1) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/mpowertcx icon flat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setIconSize(QtCore.QSize(256, 256)) self.pushButton.setFlat(True) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 1, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 1, 1, 1) self.licenseEdit = QtGui.QPlainTextEdit(Dialog) self.licenseEdit.setFrameShape(QtGui.QFrame.NoFrame) self.licenseEdit.setReadOnly(True) self.licenseEdit.setObjectName("licenseEdit") self.gridLayout.addWidget(self.licenseEdit, 3, 0, 2, 1) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def loadLang(self): self.quickMenu(['language_menu;&Language']) cur_menu = self.uiList['language_menu'] self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu) cur_menu.addSeparator() QtCore.QObject.connect( self.uiList['langDefault_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, 'default') ) # store default language self.memoData['lang']={} self.memoData['lang']['default']={} for ui_name in self.uiList: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox self.memoData['lang']['default'][ui_name] = str(ui_element.text()) elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]: # uiType: QMenu, QGroupBox self.memoData['lang']['default'][ui_name] = str(ui_element.title()) elif type(ui_element) in [ QtGui.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = [] for i in range(tabCnt): tabNameList.append(str(ui_element.tabText(i))) self.memoData['lang']['default'][ui_name]=';'.join(tabNameList) elif type(ui_element) == str: # uiType: string for msg self.memoData['lang']['default'][ui_name] = self.uiList[ui_name] # try load other language lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__)) baseName = os.path.splitext( os.path.basename(self.location) )[0] for fileName in os.listdir(lang_path): if fileName.startswith(baseName+"_lang_"): langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","") self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) ) self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu) QtCore.QObject.connect( self.uiList[langName+'_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, langName) ) # if no language file detected, add export default language option if len(self.memoData['lang']) == 1: self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu) QtCore.QObject.connect( self.uiList['langExport_atnLang'], QtCore.SIGNAL("triggered()"), self.exportLang )
def Establish_Connections(self): # loop button and menu action to link to functions for ui_name in self.uiList.keys(): if ui_name.endswith('_btn'): QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name))) if ui_name.endswith('_atn'): QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name))) if ui_name.endswith('_atnMsg') or ui_name.endswith('_btnMsg'): QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name))) QtCore.QObject.connect(self.uiList["dict_table"].horizontalHeader(), QtCore.SIGNAL("sectionDoubleClicked(int)"), self.changeTableHeader) ############################################# # UI Response functions ############################################## #-- ui actions
def setupUi(self, Zebra): Zebra.setObjectName(_fromUtf8("Zebra")) Zebra.resize(241, 302) self.verticalLayoutWidget = QtGui.QWidget(Zebra) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 221, 251)) self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget")) self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.label = QtGui.QLabel(self.verticalLayoutWidget) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label, QtCore.Qt.AlignHCenter) self.horizontalSlider = QtGui.QSlider(self.verticalLayoutWidget) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName(_fromUtf8("horizontalSlider")) self.verticalLayout.addWidget(self.horizontalSlider) self.label_2 = QtGui.QLabel(self.verticalLayoutWidget) self.label_2.setObjectName(_fromUtf8("label_2")) self.verticalLayout.addWidget(self.label_2, QtCore.Qt.AlignHCenter) self.horizontalSlider_2 = QtGui.QSlider(self.verticalLayoutWidget) self.horizontalSlider_2.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider_2.setObjectName(_fromUtf8("horizontalSlider_2")) self.verticalLayout.addWidget(self.horizontalSlider_2) self.label_3 = QtGui.QLabel(self.verticalLayoutWidget) self.label_3.setObjectName(_fromUtf8("label_3")) self.verticalLayout.addWidget(self.label_3, QtCore.Qt.AlignHCenter) self.horizontalSlider_3 = QtGui.QSlider(self.verticalLayoutWidget) self.horizontalSlider_3.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider_3.setObjectName(_fromUtf8("horizontalSlider_3")) self.verticalLayout.addWidget(self.horizontalSlider_3) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.pushButton = QtGui.QPushButton(self.verticalLayoutWidget) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.verticalLayout.addWidget(self.pushButton, QtCore.Qt.AlignHCenter) self.retranslateUi(Zebra) # QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("released()")), Zebra.close) # QtCore.QMetaObject.connectSlotsByName(Zebra)
def run(self): # Bring em in :D for i in range(336): time.sleep(0.001) self.emit(QtCore.SIGNAL('update(QString)'), "ping") # Hide u bitch :P for j in range(200): time.sleep(0.05) self.emit(QtCore.SIGNAL('vanish(QString)'), "ping") return
def createNotification(self, msg): self.lbl_mssg.setText(msg) # Start Worker self.connect(self.workThread, QtCore.SIGNAL("update(QString)"), self.animate) self.connect(self.workThread, QtCore.SIGNAL("vanish(QString)"), self.disappear) self.connect(self.workThread, QtCore.SIGNAL("finished()"), self.done) self.workThread.start() return
def setupApkLoading(self): self.apkLoadingThread = ApkLoadingThread() self.connect(self.apkLoadingThread, QtCore.SIGNAL("loadedApk(bool)"), self.loadedApk)
def run(self): if self.apk_path is not None: try: if not self.load_androguard_session(): self.a, self.d, self.x = AnalyzeAPK(self.apk_path, decompiler="dad") self.emit(QtCore.SIGNAL("loadedApk(bool)"), True) except Exception as e: androconf.debug(e) self.emit(QtCore.SIGNAL("loadedApk(bool)"), False) else: self.emit(QtCore.SIGNAL("loadedApk(bool)"), False)
def __init__(self): # set maya main window as parent or it will disappear quickly: main_window_ptr = omui.MQtUtil.mainWindow() mayaMainWindow = wrapInstance(long(main_window_ptr), QtGui.QWidget) super(GUI, self).__init__(mayaMainWindow) # Initialize with mayaMainWindow as a parent self.resize(250, 150) # Set the size of window self.center() self.setWindowTitle('Skrypt - Maya') # Set the title of window self.setWindowFlags(QtCore.Qt.Tool) # The tool window will always be kept on top of parent (maya_main_window) # Delete UI on close to avoid winEvent error # self.setAttribute(QtCore.Qt.WA_DeleteOnClose) grid = QtGui.QGridLayout() # Create a grid layout grid_internal = QtGui.QGridLayout() self.label_info = QtGui.QLabel('Uruchom skrypt wciskajac `start`') # Create a label GUI element btn_step = QtGui.QPushButton('Krok po kroku') # Create a button btn_start = QtGui.QPushButton('Wszystkie kroki') self.connect(btn_start, SIGNAL("clicked()"), self.fn_no_steps) # Connect button to function self.connect(btn_step, SIGNAL("clicked()"), self.fn_step) self.times_list = QtGui.QListWidget(self) # Create a list widget btn_save = QtGui.QPushButton('Zapisz wyniki') btn_reset = QtGui.QPushButton('Wyczysc scene') grid.addWidget(self.label_info, 0, 0) # Add the widget to the layout grid_internal.addWidget(btn_step, 0, 0) grid_internal.addWidget(btn_start, 0, 1) grid.addLayout(grid_internal, 1, 0) grid.addWidget(self.times_list, 2, 0) grid.addWidget(btn_save, 3, 0) grid.addWidget(btn_reset, 4, 0) self.data_table = DataTable() self.data_table.target_list = self.times_list self.data_table.target_label = self.label_info self.connect(btn_reset, SIGNAL("clicked()"), self.data_table.reset) self.connect(btn_save, SIGNAL("clicked()"), self.data_table.save) self.setLayout(grid) # Set the layout of the window