def keyPressEvent(self, event): key = event.key() if key == QtCore.Qt.Key_Up: self.centerNode.moveBy(0, -20) elif key == QtCore.Qt.Key_Down: self.centerNode.moveBy(0, 20) elif key == QtCore.Qt.Key_Left: self.centerNode.moveBy(-20, 0) elif key == QtCore.Qt.Key_Right: self.centerNode.moveBy(20, 0) elif key == QtCore.Qt.Key_Plus: self.scaleView(1.2) elif key == QtCore.Qt.Key_Minus: self.scaleView(1 / 1.2) elif key == QtCore.Qt.Key_Space or key == QtCore.Qt.Key_Enter: for item in self.scene().items(): if isinstance(item, Node): item.setPos(-150 + QtCore.qrand() % 300, -150 + QtCore.qrand() % 300) else: QtGui.QGraphicsView.keyPressEvent(self, event)
def paint(self, painter, option=None, widget=None): if self.validateImage(): wasSmoothPixmapTransform = painter.testRenderHint(QtGui.QPainter.SmoothPixmapTransform) painter.setRenderHint(QtGui.QPainter.SmoothPixmapTransform) if Colors.noRescale: # Let the painter scale the image for us. This may degrade # both quality and performance. if self.sharedImage.image is not None: painter.drawImage(self.pos(), self.sharedImage.image) else: painter.drawPixmap(self.pos(), self.sharedImage.pixmap) else: m = painter.worldMatrix() painter.setWorldMatrix(QtGui.QMatrix()) x = m.dx() y = m.dy() if self.noSubPixeling: x = QtCore.qRound(x) y = QtCore.qRound(y) if self.sharedImage.image is not None: painter.drawImage(QtCore.QPointF(x, y), self.sharedImage.image) else: painter.drawPixmap(QtCore.QPointF(x, y), self.sharedImage.pixmap) if not wasSmoothPixmapTransform: painter.setRenderHint(QtGui.QPainter.SmoothPixmapTransform, False)
def drawBackground(self, painter, rect): if not painter.paintEngine().type() == QtGui.QPaintEngine.OpenGL2: print painter.paintEngine().type() QtCore.qWarning('OpenGLScene: drawBackground needs a QGLWidget '\ +'to be set as viewport on the '\ +'graphics view') return painter.beginNativePainting() GL.glMatrixMode(GL.GL_PROJECTION) GL.glPushMatrix() GL.glMatrixMode(GL.GL_MODELVIEW) GL.glPushMatrix() GL.glClearColor(1.0,1.0,1.0,1.0) GL.glClear(GL.GL_COLOR_BUFFER_BIT) # OpenGL stuff goes here... GL.glMatrixMode(GL.GL_MODELVIEW) GL.glPopMatrix() GL.glMatrixMode(GL.GL_PROJECTION) GL.glPopMatrix() painter.endNativePainting()
def drawBackground(self, painter, rect): if not (painter.paintEngine().type() == QtGui.QPaintEngine.OpenGL or painter.paintEngine().type() == QtGui.QPaintEngine.OpenGL2): QtCore.qWarning('OpenGLScene: drawBackground needs a QGLWidget '\ +'to be set as viewport on the '\ +'graphics view') return painter.beginNativePainting() GL.glMatrixMode(GL.GL_PROJECTION) GL.glPushMatrix() GL.glMatrixMode(GL.GL_MODELVIEW) GL.glPushMatrix() self.renderer.render() GL.glMatrixMode(GL.GL_MODELVIEW) GL.glPopMatrix() GL.glMatrixMode(GL.GL_PROJECTION) GL.glPopMatrix() painter.endNativePainting()
def drawBackground(self, painter, rect): if not (painter.paintEngine().type() == QtGui.QPaintEngine.OpenGL or painter.paintEngine().type() == QtGui.QPaintEngine.OpenGL2): QtCore.qWarning('OpenGLScene: drawBackground needs a QGLWidget '\ +'to be set as viewport on the '\ +'graphics view') return painter.beginNativePainting() if not self.initialised: self.vertex_shader = QGLShader(QGLShader.Vertex) self.vertex_shader.compileSourceCode(vertex_shader_code) self.fragment_shader = QGLShader(QGLShader.Fragment) self.fragment_shader.compileSourceCode(frag_shader_code) self.program = QGLShaderProgram(self.context) self.program.addShader(self.vertex_shader) self.program.addShader(self.fragment_shader) self.program.link() print 'initialising' self.tex = self.loadImage('test.jpg') self.textureLocation = self.program.uniformLocation("image") self.initialised = True GL.glMatrixMode(GL.GL_PROJECTION) GL.glPushMatrix() GL.glMatrixMode(GL.GL_MODELVIEW) GL.glPushMatrix() GL.glBindTexture(GL.GL_TEXTURE_2D, self.tex) self.model.render() self.program.bind() GL.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR) GL.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR) GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE) GL.glEnableClientState(GL.GL_VERTEX_ARRAY) GL.glVertexPointer(3, GL.GL_FLOAT, 0, triangle_vertices) GL.glDrawArrays(GL.GL_TRIANGLES, 0, len(triangle_vertices)/3) GL.glDisableClientState(GL.GL_VERTEX_ARRAY) self.program.release() GL.glMatrixMode(GL.GL_MODELVIEW) GL.glPopMatrix() GL.glMatrixMode(GL.GL_PROJECTION) GL.glPopMatrix() painter.endNativePainting()
def contextMenuEvent(self,event): modelMenu = QtGui.QMenu() modelName = 'test' modelMenu.addAction(modelName) action = modelMenu.exec_(event.globalPos()) if action: QtCore.qDebug(action.text())
def setRange(self, minValue, maxValue): if minValue < 0 or maxValue > 99 or minValue > maxValue: QtCore.qWarning("LCDRange::setRange(%d, %d)\n" "\tRange must be 0..99\n" "\tand minValue must not be greater than maxValue" % (minValue, maxValue)) return self.slider.setRange(minValue, maxValue)
def drawBackgroundToPixmap(self): r = self.scene.sceneRect() self.background = QtGui.QPixmap(QtCore.qRound(r.width()), QtCore.qRound(r.height())) self.background.fill(QtCore.Qt.black) painter = QtGui.QPainter(self.background) bg = QtGui.QImage(':/images/demobg.png') painter.drawImage(0, 0, bg)
def __init__(self): super(ColorItem, self).__init__() self.color = QtGui.QColor(QtCore.qrand() % 256, QtCore.qrand() % 256, QtCore.qrand() % 256) self.setToolTip( "QColor(%d, %d, %d)\nClick and drag this color onto the robot!" % (self.color.red(), self.color.green(), self.color.blue()) ) self.setCursor(QtCore.Qt.OpenHandCursor)
def mouseMoveEvent(self, event): if QtCore.QLineF(QtCore.QPointF(event.screenPos()), QtCore.QPointF(event.buttonDownScreenPos(QtCore.Qt.LeftButton))).length() < QtGui.QApplication.startDragDistance(): return drag = QtGui.QDrag(event.widget()) mime = QtCore.QMimeData() drag.setMimeData(mime) ColorItem.n += 1 if ColorItem.n > 2 and QtCore.qrand() % 3 == 0: image = QtGui.QImage(':/images/head.png') mime.setImageData(image) drag.setPixmap(QtGui.QPixmap.fromImage(image).scaled(30,40)) drag.setHotSpot(QtCore.QPoint(15, 30)) else: mime.setColorData(self.color) mime.setText("#%02x%02x%02x" % (self.color.red(), self.color.green(), self.color.blue())) pixmap = QtGui.QPixmap(34, 34) pixmap.fill(QtCore.Qt.white) painter = QtGui.QPainter(pixmap) painter.translate(15, 15) painter.setRenderHint(QtGui.QPainter.Antialiasing) self.paint(painter, None, None) painter.end() pixmap.setMask(pixmap.createHeuristicMask()) drag.setPixmap(pixmap) drag.setHotSpot(QtCore.QPoint(15, 20)) drag.exec_() self.setCursor(QtCore.Qt.OpenHandCursor)
def _import_pyside(self): """ Imports PySide. :returns: The (binding name, binding version, modules) tuple. """ from PySide import QtCore, QtGui QtNetwork = self._import_module_by_name("PySide", "QtNetwork") QtWebKit = self._import_module_by_name("PySide", "QtWebKit") import PySide # Some old versions of PySide don't include version information # so add something here so that we can use PySide.__version__ # later without having to check! # Note: Do not remove this. It was briefly introduced so that engines # could introspec the wrapper for all sorts of things, but we've moving # away from modifying the modules themselves, so keep this is for now and # we'll be able to deprecate it at some point in the future. if not hasattr(PySide, "__version__"): PySide.__version__ = "<unknown>" # PySide stick a \n at the end of the __name__ for some reason. Strip it! return PySide.__name__.strip(), PySide.__version__, PySide, { "QtCore": QtCore, "QtGui": QtGui, "QtNetwork": QtNetwork, "QtWebKit": QtWebKit, }, self._to_version_tuple(QtCore.qVersion())
def shotRect(self): gravity = 4.0 time = self.timerCount / 40.0 velocity = self.shootForce radians = self.shootAngle * 3.14159265 / 180 velx = velocity * math.cos(radians) vely = velocity * math.sin(radians) x0 = (CannonField.barrelRect.right() + 5) * math.cos(radians) y0 = (CannonField.barrelRect.right() + 5) * math.sin(radians) x = x0 + velx * time y = y0 + vely * time - 0.5 * gravity * time * time result = QtCore.QRect(0, 0, 6, 6) result.moveCenter(QtCore.QPoint(QtCore.qRound(x), self.height() - 1 - QtCore.qRound(y))) return result
def __init__(self): super(Mouse, self).__init__() self.angle = 0.0 self.speed = 0.0 self.mouseEyeDirection = 0.0 self.color = QtGui.QColor(QtCore.qrand() % 256, QtCore.qrand() % 256, QtCore.qrand() % 256) self.rotate(QtCore.qrand() % (360 * 16)) # In the C++ version of this example, this class is also derived from # QObject in order to receive timer events. PyQt does not support # deriving from more than one wrapped class so we just create an # explicit timer instead. self.timer = QtCore.QTimer() self.timer.timeout.connect(self.timerEvent) self.timer.start(1000 / 33)
def getForm(self): self.formLoc = FreeCADGui.PySideUic.loadUi(":/panels/PageBaseLocationEdit.ui") if QtCore.qVersion()[0] == '4': self.formLoc.baseList.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch) else: self.formLoc.baseList.horizontalHeader().setSectionResizeMode(QtGui.QHeaderView.Stretch) self.getPoint = PathGetPoint.TaskPanel(self.formLoc.addRemoveEdit) return self.formLoc
def guiKitVersion(): """ Get the version of PySide that the gui kit is using. :return: """ logging.info('PySide') logging.info('Version: ' + __version__) logging.info('Compiled with: Qt ' + QtCore.__version__) logging.info('Using: Qt ' + QtCore.qVersion())
def mouseMoveEvent(self, event): if not self.barrelPressed: return pos = event.pos() if pos.x() <= 0: pos.setX(1) if pos.y() >= self.height(): pos.setY(self.height() - 1) rad = math.atan((float(self.rect().bottom()) - pos.y()) / pos.x()) self.setAngle(QtCore.qRound(rad * 180 / 3.14159265))
def register_qt_conf(qt_runtime_dir): import pyside_utils from PyQt5 import QtCore pyside_utils.QtCore = QtCore if sys.platform == 'win32': qt_runtime_dir = qt_runtime_dir.replace('\\', '/') rc_struct, rc_name, rc_data = pyside_utils._get_qt_conf_resource( prefix=qt_runtime_dir, binaries=qt_runtime_dir+"/bin", plugins=qt_runtime_dir+"/plugins", imports=qt_runtime_dir+"/imports", translations=qt_runtime_dir+"/translations") QtCore.qRegisterResourceData(0x01, rc_struct, rc_name, rc_data) prefixPath = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PrefixPath) if sys.platform == 'win32': assert os.path.normpath(prefixPath) == os.path.normpath(qt_runtime_dir) else: assert os.path.samefile(prefixPath, qt_runtime_dir)
def __init__(self): self._reads = {} self._writes = {} self._notifiers = {} self._timer = QtCore.QTimer() self._timer.setSingleShot(True) QtCore.QObject.connect(self._timer, QtCore.SIGNAL("timeout()"), self._qt_timeout) if QtCore.QCoreApplication.instance() is None: # Application Object has not been started yet self.qApp = QtCore.QCoreApplication([]) self._ownApp = True else: self.qApp = QtCore.QCoreApplication.instance() self._ownApp = False self._blockApp = None QtCore.qInstallMsgHandler(msg_blast) super(QtReactor, self).__init__()
def helpAbout(self): QtGui.QMessageBox.about(self, "About Image Changer", """<b>Image Changer</b> v {0} <p>Copyright © 2008-14 Qtrac Ltd. All rights reserved. <p>This application can be used to perform simple image manipulations. <p>Python {1} - Qt {2} - PySide {3} on {4}""".format( __version__, platform.python_version(), QtCore.qVersion(), PySide.__version__, platform.system()))
def showFrame(self, frame): """ This function must be call regularly in order to update the video frame currently shown """ qImage = self.toQImage(frame) pixmap = QtGui.QPixmap().fromImage(qImage) self.label.setPixmap(pixmap) pos = self.capture.get(0) #milliseconds #Update the slider newPos = QtCore.qRound(pos/1000) if self.slider.value() != newPos: self.slider.setValue(newPos)
def helpAbout(self): QtGui.QMessageBox.about(self, "My Movies - About", """<b>My Movies</b> v {0} <p>Copyright © 2008-14 Qtrac Ltd. All rights reserved. <p>This application can be used to view some basic information about movies and to load and save the movie data in a variety of custom file formats. <p>Python {1} - Qt {2} - PySide {3} on {4}""".\ format(__version__, platform.python_version(), QtCore.qVersion(), PySide.__version__, platform.system()))
def calculateForces(self): if not self.scene() or self.scene().mouseGrabberItem() is self: self.newPos = self.pos() return # Sum up all forces pushing this item away. xvel = 0.0 yvel = 0.0 for item in self.scene().items(): if not isinstance(item, Node): continue line = QtCore.QLineF(self.mapFromItem(item, 0, 0), QtCore.QPointF(0, 0)) dx = line.dx() dy = line.dy() l = 2.0 * (dx * dx + dy * dy) if l > 0: xvel += (dx * 150.0) / l yvel += (dy * 150.0) / l # Now subtract all forces pulling items together. weight = (len(self.edgeList) + 1) * 10.0 for edge in self.edgeList: if edge.sourceNode() is self: pos = self.mapFromItem(edge.destNode(), 0, 0) else: pos = self.mapFromItem(edge.sourceNode(), 0, 0) xvel += pos.x() / weight yvel += pos.y() / weight if QtCore.qAbs(xvel) < 0.1 and QtCore.qAbs(yvel) < 0.1: xvel = yvel = 0.0 sceneRect = self.scene().sceneRect() self.newPos = self.pos() + QtCore.QPointF(xvel, yvel) self.newPos.setX(min(max(self.newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10)) self.newPos.setY(min(max(self.newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10))
def helpAbout(self): #If multiline quote doesn't work, perhaps #http://qt-project.org/forums/viewthread/20695 #careful of parens in following... QtGui.QMessageBox.about(self, self.tr("About Image Changer"), self.tr("""<b>Image Changer</b> v {0} <p>Copyright © 2008-14 Qtrac Ltd. All rights reserved. <p>This application can be used to perform simple image manipulations. <p>Python {1} - Qt {2} - PySide {3} on {4}""").format( __version__, platform.python_version(), QtCore.qVersion(), PySide.__version__, platform.system()))
def _import_pyside2_as_pyside(self): """ Imports PySide2. :returns: The (binding name, binding version, modules) tuple. """ import PySide2 from PySide2 import QtCore, QtGui, QtWidgets from .pyside2_patcher import PySide2Patcher QtCore, QtGui = PySide2Patcher.patch(QtCore, QtGui, QtWidgets, PySide2) return "PySide2", PySide2.__version__, PySide2, { "QtCore": QtCore, "QtGui": QtGui }, self._to_version_tuple(QtCore.qVersion())
def timerEvent(self): # Don't move too far away. lineToCenter = QtCore.QLineF(QtCore.QPointF(0, 0), self.mapFromScene(0, 0)) if lineToCenter.length() > 150: angleToCenter = math.acos(lineToCenter.dx() / lineToCenter.length()) if lineToCenter.dy() < 0: angleToCenter = Mouse.TwoPi - angleToCenter; angleToCenter = Mouse.normalizeAngle((Mouse.Pi - angleToCenter) + Mouse.Pi / 2) if angleToCenter < Mouse.Pi and angleToCenter > Mouse.Pi / 4: # Rotate left. self.angle += [-0.25, 0.25][self.angle < -Mouse.Pi / 2] elif angleToCenter >= Mouse.Pi and angleToCenter < (Mouse.Pi + Mouse.Pi / 2 + Mouse.Pi / 4): # Rotate right. self.angle += [-0.25, 0.25][self.angle < Mouse.Pi / 2] elif math.sin(self.angle) < 0: self.angle += 0.25 elif math.sin(self.angle) > 0: self.angle -= 0.25 # Try not to crash with any other mice. dangerMice = self.scene().items(QtGui.QPolygonF([self.mapToScene(0, 0), self.mapToScene(-30, -50), self.mapToScene(30, -50)])) for item in dangerMice: if item is self: continue lineToMouse = QtCore.QLineF(QtCore.QPointF(0, 0), self.mapFromItem(item, 0, 0)) angleToMouse = math.acos(lineToMouse.dx() / lineToMouse.length()) if lineToMouse.dy() < 0: angleToMouse = Mouse.TwoPi - angleToMouse angleToMouse = Mouse.normalizeAngle((Mouse.Pi - angleToMouse) + Mouse.Pi / 2) if angleToMouse >= 0 and angleToMouse < Mouse.Pi / 2: # Rotate right. self.angle += 0.5 elif angleToMouse <= Mouse.TwoPi and angleToMouse > (Mouse.TwoPi - Mouse.Pi / 2): # Rotate left. self.angle -= 0.5 # Add some random movement. if len(dangerMice) > 1 and (QtCore.qrand() % 10) == 0: if QtCore.qrand() % 1: self.angle += (QtCore.qrand() % 100) / 500.0 else: self.angle -= (QtCore.qrand() % 100) / 500.0 self.speed += (-50 + QtCore.qrand() % 100) / 100.0 dx = math.sin(self.angle) * 10 self.mouseEyeDirection = [dx / 5, 0.0][QtCore.qAbs(dx / 5) < 1] self.rotate(dx) self.setPos(self.mapToParent(0, -(3 + math.sin(self.speed) * 3)))
def _create_contents ( self, parent ): label = QtGui.QLabel() if self.title == 'Dialog': title = '' if parent.parent() is not None: title = parent.parent().windowTitle() # Set the title. self.title = "About %s" % title # Load the image to be displayed in the about box: image = self.image.create_image() path = self.image.absolute_path # The additional strings: additions = '<br />'.join( self.additions ) # Get the version numbers: py_version = sys.version[ 0: sys.version.find( "(" ) ] pyside_version = PySide.__version__ qt_version = QtCore.qVersion() # Set the page contents: label.setText( _DIALOG_TEXT % ( path, additions, py_version, pyside_version, qt_version ) ) # Create the button: buttons = QtGui.QDialogButtonBox() if self.ok_label: buttons.addButton( self.ok_label, QtGui.QDialogButtonBox.AcceptRole ) else: buttons.addButton( QtGui.QDialogButtonBox.Ok ) buttons.connect( buttons, QtCore.SIGNAL( 'accepted()' ), parent, QtCore.SLOT( 'accept()' ) ) lay = QtGui.QVBoxLayout() lay.addWidget( label ) lay.addWidget( buttons ) parent.setLayout( lay ) #-- EOF ------------------------------------------------------------------------
def _import_pyside2_as_pyside(self): """ Imports PySide2. :returns: The (binding name, binding version, modules) tuple. """ import PySide2 from PySide2 import QtCore, QtGui, QtWidgets from .pyside2_patcher import PySide2Patcher QtCore, QtGui = PySide2Patcher.patch(QtCore, QtGui, QtWidgets, PySide2) QtNetwork = self._import_module_by_name("PySide2", "QtNetwork") QtWebKit = self._import_module_by_name("PySide2.QtWebKitWidgets", "QtWebKit") return "PySide2", PySide2.__version__, PySide2, { "QtCore": QtCore, "QtGui": QtGui, "QtNetwork": QtNetwork, "QtWebKit": QtWebKit, }, self._to_version_tuple(QtCore.qVersion())
def __init__(self, strength, speed, reasoner): '''Strength = [0, 100], speed = [1, 5]''' super(Mouse, self).__init__() self.strength = strength self.speed = speed self.reasoner = reasoner self.health = 100 self.angle = 0.0 self.setScale(1) self.mouseEyeDirection = 0.0 self.color = QtGui.QColor(0.0,255,0.0) self.earColor = QtCore.Qt.darkYellow self.rotate(QtCore.qrand() % (360 * 16)) # In the C++ version of this example, this class is also derived from # QObject in order to receive timer events. PyQt does not support # deriving from more than one wrapped class so we just create an # explicit timer instead. self.timer = QtCore.QTimer() self.timer.timeout.connect(self.timerEvent) self.timer.start(1000 / 33)
def GetResources(self): return {'Pixmap' : 'GDML_Polyhedra', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDML_PolyGroup',\ 'Poly Group'), 'ToolTip': \ QtCore.QT_TRANSLATE_NOOP('GDML_PolyGroup', \ 'PolyHedra Selected Object')}
def __init__(self, obj): self.result_obj = obj self.mesh_obj = self.result_obj.Mesh # task panel should be started by use of setEdit of view provider # in view provider checks: Mesh, active analysis and if Mesh and result are in active analysis self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/ResultShow.ui") self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General") self.restore_result_settings_in_dialog = self.fem_prefs.GetBool("RestoreResultDialog", True) # Connect Signals and Slots # result type radio buttons QtCore.QObject.connect(self.form.rb_none, QtCore.SIGNAL("toggled(bool)"), self.none_selected) QtCore.QObject.connect(self.form.rb_abs_displacement, QtCore.SIGNAL("toggled(bool)"), self.abs_displacement_selected) QtCore.QObject.connect(self.form.rb_x_displacement, QtCore.SIGNAL("toggled(bool)"), self.x_displacement_selected) QtCore.QObject.connect(self.form.rb_y_displacement, QtCore.SIGNAL("toggled(bool)"), self.y_displacement_selected) QtCore.QObject.connect(self.form.rb_z_displacement, QtCore.SIGNAL("toggled(bool)"), self.z_displacement_selected) QtCore.QObject.connect(self.form.rb_temperature, QtCore.SIGNAL("toggled(bool)"), self.temperature_selected) QtCore.QObject.connect(self.form.rb_vm_stress, QtCore.SIGNAL("toggled(bool)"), self.vm_stress_selected) QtCore.QObject.connect(self.form.rb_maxprin, QtCore.SIGNAL("toggled(bool)"), self.max_prin_selected) QtCore.QObject.connect(self.form.rb_minprin, QtCore.SIGNAL("toggled(bool)"), self.min_prin_selected) QtCore.QObject.connect(self.form.rb_max_shear_stress, QtCore.SIGNAL("toggled(bool)"), self.max_shear_selected) QtCore.QObject.connect(self.form.rb_massflowrate, QtCore.SIGNAL("toggled(bool)"), self.massflowrate_selected) QtCore.QObject.connect(self.form.rb_networkpressure, QtCore.SIGNAL("toggled(bool)"), self.networkpressure_selected) QtCore.QObject.connect(self.form.rb_peeq, QtCore.SIGNAL("toggled(bool)"), self.peeq_selected) # displacement QtCore.QObject.connect(self.form.cb_show_displacement, QtCore.SIGNAL("clicked(bool)"), self.show_displacement) QtCore.QObject.connect(self.form.hsb_displacement_factor, QtCore.SIGNAL("valueChanged(int)"), self.hsb_disp_factor_changed) QtCore.QObject.connect(self.form.sb_displacement_factor, QtCore.SIGNAL("valueChanged(int)"), self.sb_disp_factor_changed) QtCore.QObject.connect(self.form.sb_displacement_factor_max, QtCore.SIGNAL("valueChanged(int)"), self.sb_disp_factor_max_changed) # user defined equation 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) self.update() if self.restore_result_settings_in_dialog: self.restore_result_dialog() else: self.restore_initial_result_dialog()
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(508, 353) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QtCore.QSize(500, 250)) # icon = QtGui.QIcon() # icon.addPixmap(QtGui.QPixmap("../../../../../../brain/codes/python_packages/PyQt-Image-Viewer/icons/Icon.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) # MainWindow.setWindowIcon(icon) MainWindow.setStyleSheet("background-color: rgb(255, 255, 255);") self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setMinimumSize(QtCore.QSize(500, 278)) self.centralwidget.setObjectName("centralwidget") self.input_groupBox = QtGui.QGroupBox(self.centralwidget) self.input_groupBox.setGeometry(QtCore.QRect(9, 9, 150, 111)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.input_groupBox.sizePolicy().hasHeightForWidth()) self.input_groupBox.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.input_groupBox.setFont(font) self.input_groupBox.setObjectName("input_groupBox") self.formLayout = QtGui.QFormLayout(self.input_groupBox) self.formLayout.setFieldGrowthPolicy( QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setObjectName("formLayout") self.load_pushButton = QtGui.QPushButton(self.input_groupBox) self.load_pushButton.setObjectName("load_pushButton") self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.load_pushButton) self.label = QtGui.QLabel(self.input_groupBox) self.label.setObjectName("label") self.formLayout.setWidget(2, QtGui.QFormLayout.SpanningRole, self.label) self.doubleSpinBox = QtGui.QDoubleSpinBox(self.input_groupBox) self.doubleSpinBox.setObjectName("doubleSpinBox") self.formLayout.setWidget(4, QtGui.QFormLayout.SpanningRole, self.doubleSpinBox) self.output_groupBox = QtGui.QGroupBox(self.centralwidget) self.output_groupBox.setGeometry(QtCore.QRect(170, 10, 150, 110)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.output_groupBox.sizePolicy().hasHeightForWidth()) self.output_groupBox.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.output_groupBox.setFont(font) self.output_groupBox.setObjectName("output_groupBox") self.verticalLayout = QtGui.QVBoxLayout(self.output_groupBox) self.verticalLayout.setObjectName("verticalLayout") self.output_pushButton = QtGui.QPushButton(self.output_groupBox) self.output_pushButton.setObjectName("output_pushButton") self.verticalLayout.addWidget(self.output_pushButton) self.run_pushButton = QtGui.QPushButton(self.output_groupBox) self.run_pushButton.setObjectName("run_pushButton") self.verticalLayout.addWidget(self.run_pushButton) self.plot_groupBox = QtGui.QGroupBox(self.centralwidget) self.plot_groupBox.setGeometry(QtCore.QRect(330, 10, 150, 110)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.plot_groupBox.sizePolicy().hasHeightForWidth()) self.plot_groupBox.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.plot_groupBox.setFont(font) self.plot_groupBox.setObjectName("plot_groupBox") self.verticalLayout_2 = QtGui.QVBoxLayout(self.plot_groupBox) self.verticalLayout_2.setObjectName("verticalLayout_2") self.plotOriginal_pushButton = QtGui.QPushButton(self.plot_groupBox) self.plotOriginal_pushButton.setObjectName("plotOriginal_pushButton") self.verticalLayout_2.addWidget(self.plotOriginal_pushButton) self.plotResampled_pushButton = QtGui.QPushButton(self.plot_groupBox) self.plotResampled_pushButton.setObjectName("plotResampled_pushButton") self.verticalLayout_2.addWidget(self.plotResampled_pushButton) self.report_groupBox = QtGui.QGroupBox(self.centralwidget) self.report_groupBox.setGeometry(QtCore.QRect(10, 130, 471, 94)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.report_groupBox.sizePolicy().hasHeightForWidth()) self.report_groupBox.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.report_groupBox.setFont(font) self.report_groupBox.setObjectName("report_groupBox") self.gridLayout = QtGui.QGridLayout(self.report_groupBox) self.gridLayout.setObjectName("gridLayout") self.origSampleSize_label = QtGui.QLabel(self.report_groupBox) self.origSampleSize_label.setObjectName("origSampleSize_label") self.gridLayout.addWidget(self.origSampleSize_label, 0, 0, 1, 1) self.origMinMax_label = QtGui.QLabel(self.report_groupBox) self.origMinMax_label.setObjectName("origMinMax_label") self.gridLayout.addWidget(self.origMinMax_label, 0, 1, 1, 1) self.resSampleSize_label = QtGui.QLabel(self.report_groupBox) self.resSampleSize_label.setObjectName("resSampleSize_label") self.gridLayout.addWidget(self.resSampleSize_label, 1, 0, 1, 1) self.resMinMax_label = QtGui.QLabel(self.report_groupBox) self.resMinMax_label.setObjectName("resMinMax_label") self.gridLayout.addWidget(self.resMinMax_label, 1, 1, 1, 1) self.export_pushButton = QtGui.QPushButton(self.report_groupBox) self.export_pushButton.setObjectName("export_pushButton") self.gridLayout.addWidget(self.export_pushButton, 2, 2, 1, 1) self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(280, 250, 201, 65)) self.groupBox.setObjectName("groupBox") self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout_3.setObjectName("verticalLayout_3") self.name_label = QtGui.QLabel(self.groupBox) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.name_label.setFont(font) self.name_label.setObjectName("name_label") self.verticalLayout_3.addWidget(self.name_label) self.date_label = QtGui.QLabel(self.groupBox) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.date_label.setFont(font) self.date_label.setObjectName("date_label") self.verticalLayout_3.addWidget(self.date_label) # MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") # MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def buildUI(self): #Original Author: Jeremy Ernst #create the main widget self.mainWidget = QtGui.QWidget() self.mainWidget.setStyleSheet("background-color: rgb(0, 0, 0);, color: rgb(0,0,0);") self.setCentralWidget(self.mainWidget) #load stylesheet filePath = os.path.normpath(__file__) stylesheet = os.path.join(os.path.dirname(filePath), "mainScheme.qss") f = open(stylesheet, "r") style = f.read() f.close() self.mainWidget.setStyleSheet(style) #set qt object name self.setObjectName("createJointFromGeoWIN") self.setWindowTitle("Create Joint From GEO") #create the mainLayout for the rig creator UI self.layout = QtGui.QVBoxLayout(self.mainWidget) self.resize(400, 230) self.setMinimumSize(QtCore.QSize( 400, 230 )) self.setMaximumSize(QtCore.QSize( 400, 230 )) self.setStyleSheet("""QToolTip { background-color: black; color: white;border: black solid 1px}""") #vert selection 1 self.selection1Layout = QtGui.QHBoxLayout() self.layout.addLayout(self.selection1Layout) self.selection1 = QtGui.QLineEdit() self.selection1.setReadOnly(True) self.selection1Layout.addWidget(self.selection1) self.selection1.setMinimumWidth(300) self.selection1.setPlaceholderText("Load in component selection") self.sel1Btn = QtGui.QPushButton("<-") self.selection1Layout.addWidget(self.sel1Btn) self.sel1Btn.setObjectName("blueButton") self.sel1Btn.clicked.connect(partial(self.loadSelection, self.selection1, 1)) #vert selection 2 self.selection2Layout = QtGui.QHBoxLayout() self.layout.addLayout(self.selection2Layout) self.selection2 = QtGui.QLineEdit() self.selection2.setReadOnly(True) self.selection2Layout.addWidget(self.selection2) self.selection2.setMinimumWidth(300) self.selection2.setPlaceholderText("Load in component selection") self.sel2Btn = QtGui.QPushButton("<-") self.selection2Layout.addWidget(self.sel2Btn) self.sel2Btn.setObjectName("blueButton") self.sel2Btn.clicked.connect(partial(self.loadSelection, self.selection2, 2)) #slider label = QtGui.QLabel("Position of joint: Start of selection -> End of selection") self.layout.addWidget(label) self.slider = QtGui.QSlider() self.slider.setOrientation(QtCore.Qt.Horizontal) self.slider.setRange(0,100) self.layout.addWidget(self.slider) self.slider.setTickInterval(10) self.slider.setPageStep(10) self.slider.setTickPosition(QtGui.QSlider.TicksAbove) self.slider.setSingleStep(10) #jointName self.jointName = QtGui.QLineEdit() self.jointName.setPlaceholderText("createdJoint") self.layout.addWidget(self.jointName) #Create Button self.createBtn = QtGui.QPushButton("CREATE JOINT") self.layout.addWidget(self.createBtn) self.createBtn.setMinimumHeight(50) self.createBtn.setObjectName("blueButton") self.createBtn.clicked.connect(self.createJoint)
def zoom(self, widget, ingrement): zoom_size = [self.width + ingrement, self.height + ingrement] self.setIconSize(QtCore.QSize(zoom_size[0], zoom_size[1]))
def setFields(self, obj): '''setFields(obj) ... transfers obj's property values to UI''' self.form.discretize.setValue(obj.Discretize) self.form.colinearFilter.setValue(obj.Colinear) self.setupToolController(obj, self.form.toolController) self.setupCoolant(obj, self.form.coolantController) def getSignalsForUpdate(self, obj): '''getSignalsForUpdate(obj) ... return list of signals for updating obj''' signals = [] signals.append(self.form.discretize.editingFinished) signals.append(self.form.colinearFilter.editingFinished) signals.append(self.form.toolController.currentIndexChanged) signals.append(self.form.coolantController.currentIndexChanged) return signals def taskPanelBaseGeometryPage(self, obj, features): '''taskPanelBaseGeometryPage(obj, features) ... return page for adding base geometries.''' return TaskPanelBaseGeometryPage(obj, features) Command = PathOpGui.SetupOperation( 'Vcarve', PathVcarve.Create, TaskPanelOpPage, 'Path_Vcarve', QtCore.QT_TRANSLATE_NOOP("Path_Vcarve", "Vcarve"), QtCore.QT_TRANSLATE_NOOP("Path_Vcarve", "Creates a medial line engraving path"), PathVcarve.SetupProperties) FreeCAD.Console.PrintLog("Loading PathVcarveGui... done\n")
def GetResources(self): return {'Pixmap' : 'GDML_Compound', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDML_Compound',\ 'Add compound to Volume'), 'ToolTip': \ QtCore.QT_TRANSLATE_NOOP('GDML_Compound', \ 'Add a Compound of Volume')}
def GetResources(self): return {'Pixmap' : 'GDML_Cycle', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDML_CycleGroup',\ 'Cycle Group'), 'ToolTip': \ QtCore.QT_TRANSLATE_NOOP('GDML_CycleGroup', \ 'Cycle Object and all children display')}
def GetResources(self): return {'Pixmap' : 'GDML_ExpandVol', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDML_ExpandVol',\ 'Expand Volume'), 'ToolTip': \ QtCore.QT_TRANSLATE_NOOP('GDML_ExpandVol', \ 'Expand Volume')}
def GetResources(self): return {'Pixmap' : 'GDML_Tess2Mesh', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDML_TessGroup',\ 'Tess Group'), 'Tess 2 Mesh': \ QtCore.QT_TRANSLATE_NOOP('GDML_TessGroup', \ 'Create FC Mesh from GDML Tessellate')}
def tick(self, time): displayTime = QtCore.QTime(0, (time / 60000) % 60, (time / 1000) % 60) self.timeLcd.display(displayTime.toString('mm:ss'))
def GetResources(self): return {'Pixmap' : 'GDML_Tessellate_Gmsh', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDML_TessGroup',\ 'Gmsh & Tessellate'), 'Tessellate_Gmsh': \ QtCore.QT_TRANSLATE_NOOP('GDML_TessGroup', \ 'Mesh & Tesselate Selected Planar Object')}
def sizeHint(self): return QtCore.QSize(500, 300)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(937, 750) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout_2 = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setTabPosition(QtGui.QTabWidget.East) self.tabWidget.setTabsClosable(True) self.tabWidget.setObjectName("tabWidget") self.tab = QtGui.QWidget() self.tab.setObjectName("tab") self.gridLayout = QtGui.QGridLayout(self.tab) self.gridLayout.setObjectName("gridLayout") self.groupBox = QtGui.QGroupBox(self.tab) self.groupBox.setObjectName("groupBox") self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout_3.setObjectName("verticalLayout_3") self.toolBox = QtGui.QToolBox(self.groupBox) self.toolBox.setObjectName("toolBox") self.page = QtGui.QWidget() self.page.setGeometry(QtCore.QRect(0, 0, 96, 43)) self.page.setObjectName("page") self.gridLayout_4 = QtGui.QGridLayout(self.page) self.gridLayout_4.setObjectName("gridLayout_4") self.lineEdit = QtGui.QLineEdit(self.page) self.lineEdit.setObjectName("lineEdit") self.gridLayout_4.addWidget(self.lineEdit, 0, 0, 1, 1) self.toolBox.addItem(self.page, "") self.page_2 = QtGui.QWidget() self.page_2.setGeometry(QtCore.QRect(0, 0, 168, 531)) self.page_2.setObjectName("page_2") self.gridLayout_5 = QtGui.QGridLayout(self.page_2) self.gridLayout_5.setObjectName("gridLayout_5") self.listWidget = QtGui.QListWidget(self.page_2) self.listWidget.setObjectName("listWidget") QtGui.QListWidgetItem(self.listWidget) QtGui.QListWidgetItem(self.listWidget) QtGui.QListWidgetItem(self.listWidget) QtGui.QListWidgetItem(self.listWidget) QtGui.QListWidgetItem(self.listWidget) QtGui.QListWidgetItem(self.listWidget) QtGui.QListWidgetItem(self.listWidget) QtGui.QListWidgetItem(self.listWidget) self.gridLayout_5.addWidget(self.listWidget, 0, 0, 1, 1) self.toolBox.addItem(self.page_2, "") self.verticalLayout_3.addWidget(self.toolBox) self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1) self.tabWidget.addTab(self.tab, "") self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName("tab_2") self.gridLayout_2 = QtGui.QGridLayout(self.tab_2) self.gridLayout_2.setObjectName("gridLayout_2") self.groupBox_2 = QtGui.QGroupBox(self.tab_2) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout_4 = QtGui.QVBoxLayout(self.groupBox_2) self.verticalLayout_4.setObjectName("verticalLayout_4") self.label = QtGui.QLabel(self.groupBox_2) self.label.setObjectName("label") self.verticalLayout_4.addWidget(self.label) self.radioButton = QtGui.QRadioButton(self.groupBox_2) self.radioButton.setObjectName("radioButton") self.verticalLayout_4.addWidget(self.radioButton) self.checkBox = QtGui.QCheckBox(self.groupBox_2) self.checkBox.setObjectName("checkBox") self.verticalLayout_4.addWidget(self.checkBox) self.checkBox_2 = QtGui.QCheckBox(self.groupBox_2) self.checkBox_2.setTristate(True) self.checkBox_2.setObjectName("checkBox_2") self.verticalLayout_4.addWidget(self.checkBox_2) self.treeWidget = QtGui.QTreeWidget(self.groupBox_2) self.treeWidget.setObjectName("treeWidget") item_0 = QtGui.QTreeWidgetItem(self.treeWidget) item_0 = QtGui.QTreeWidgetItem(self.treeWidget) self.verticalLayout_4.addWidget(self.treeWidget) self.gridLayout_2.addWidget(self.groupBox_2, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_2, "") self.horizontalLayout_2.addWidget(self.tabWidget) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 937, 29)) self.menubar.setObjectName("menubar") self.menuMenu = QtGui.QMenu(self.menubar) self.menuMenu.setObjectName("menuMenu") self.menuSubmenu_2 = QtGui.QMenu(self.menuMenu) self.menuSubmenu_2.setObjectName("menuSubmenu_2") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.dockWidget1 = QtGui.QDockWidget(MainWindow) self.dockWidget1.setObjectName("dockWidget1") self.dockWidgetContents = QtGui.QWidget() self.dockWidgetContents.setObjectName("dockWidgetContents") self.verticalLayout_2 = QtGui.QVBoxLayout(self.dockWidgetContents) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_2 = QtGui.QPushButton(self.dockWidgetContents) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.bt_delay_popup = QtGui.QToolButton(self.dockWidgetContents) self.bt_delay_popup.setObjectName("bt_delay_popup") self.horizontalLayout.addWidget(self.bt_delay_popup) self.bt_instant_popup = QtGui.QToolButton(self.dockWidgetContents) self.bt_instant_popup.setPopupMode(QtGui.QToolButton.InstantPopup) self.bt_instant_popup.setObjectName("bt_instant_popup") self.horizontalLayout.addWidget(self.bt_instant_popup) self.bt_menu_button_popup = QtGui.QToolButton(self.dockWidgetContents) self.bt_menu_button_popup.setPopupMode( QtGui.QToolButton.MenuButtonPopup) self.bt_menu_button_popup.setObjectName("bt_menu_button_popup") self.horizontalLayout.addWidget(self.bt_menu_button_popup) self.line_2 = QtGui.QFrame(self.dockWidgetContents) self.line_2.setFrameShape(QtGui.QFrame.VLine) self.line_2.setFrameShadow(QtGui.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout.addWidget(self.line_2) self.pushButton_3 = QtGui.QPushButton(self.dockWidgetContents) self.pushButton_3.setEnabled(False) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.doubleSpinBox = QtGui.QDoubleSpinBox(self.dockWidgetContents) self.doubleSpinBox.setObjectName("doubleSpinBox") self.horizontalLayout.addWidget(self.doubleSpinBox) self.toolButton = QtGui.QToolButton(self.dockWidgetContents) self.toolButton.setPopupMode(QtGui.QToolButton.InstantPopup) self.toolButton.setObjectName("toolButton") self.horizontalLayout.addWidget(self.toolButton) self.verticalLayout_2.addLayout(self.horizontalLayout) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.comboBox = QtGui.QComboBox(self.dockWidgetContents) self.comboBox.setObjectName("comboBox") self.comboBox.addItem("") self.comboBox.addItem("") self.verticalLayout.addWidget(self.comboBox) self.textEdit = QtGui.QTextEdit(self.dockWidgetContents) self.textEdit.setObjectName("textEdit") self.verticalLayout.addWidget(self.textEdit) self.line = QtGui.QFrame(self.dockWidgetContents) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout.addWidget(self.line) self.progressBar = QtGui.QProgressBar(self.dockWidgetContents) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.verticalLayout_2.addLayout(self.verticalLayout) self.frame = QtGui.QFrame(self.dockWidgetContents) self.frame.setMinimumSize(QtCore.QSize(0, 100)) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setLineWidth(3) self.frame.setObjectName("frame") self.verticalLayout_2.addWidget(self.frame) self.dockWidget1.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget1) self.dockWidget2 = QtGui.QDockWidget(MainWindow) self.dockWidget2.setObjectName("dockWidget2") self.dockWidgetContents_2 = QtGui.QWidget() self.dockWidgetContents_2.setObjectName("dockWidgetContents_2") self.gridLayout_3 = QtGui.QGridLayout(self.dockWidgetContents_2) self.gridLayout_3.setObjectName("gridLayout_3") self.tableWidget = QtGui.QTableWidget(self.dockWidgetContents_2) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(2) self.tableWidget.setRowCount(4) item = QtGui.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(2, item) item = QtGui.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(3, item) item = QtGui.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, item) self.gridLayout_3.addWidget(self.tableWidget, 0, 0, 1, 1) self.dockWidget2.setWidget(self.dockWidgetContents_2) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget2) self.toolBar = QtGui.QToolBar(MainWindow) self.toolBar.setObjectName("toolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.actionAction = QtGui.QAction(MainWindow) self.actionAction.setObjectName("actionAction") self.actionSub_menu = QtGui.QAction(MainWindow) self.actionSub_menu.setObjectName("actionSub_menu") self.actionAction_C = QtGui.QAction(MainWindow) self.actionAction_C.setObjectName("actionAction_C") self.menuSubmenu_2.addAction(self.actionSub_menu) self.menuSubmenu_2.addAction(self.actionAction_C) self.menuMenu.addAction(self.actionAction) self.menuMenu.addAction(self.menuSubmenu_2.menuAction()) self.menubar.addAction(self.menuMenu.menuAction()) self.toolBar.addAction(self.actionAction) self.toolBar.addAction(self.actionSub_menu) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(1) self.toolBox.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def resizeEvent(self, event): self.Widget.setGeometry(0, 0, self.width(), self.height()) N = 0 X = 600 Y = 600 L = 300 app = QtGui.QApplication(sys.argv) Window = MyWindow() SpinBox = QtGui.QSpinBox(Window) SpinBox.setGeometry(10, 10, 100, 30) button1 = QtGui.QRadioButton('Koch', Window) button1.setGeometry(10, 50, 100, 20) button2 = QtGui.QRadioButton('Serpinskiy', Window) button2.setGeometry(10, 70, 100, 20) button3 = QtGui.QRadioButton('Minkovskiy', Window) button3.setGeometry(10, 90, 100, 20) QtCore.QObject.connect(SpinBox, QtCore.SIGNAL("valueChanged(int)"), Window.Widget.setValue) QtCore.QObject.connect(button1, QtCore.SIGNAL("clicked()"), Window.Widget.setKoch) QtCore.QObject.connect(button2, QtCore.SIGNAL("clicked()"), Window.Widget.setSerpinskiy) QtCore.QObject.connect(button3, QtCore.SIGNAL("clicked()"), Window.Widget.setMinkovskiy) Window.show() app.exec_()
def print_card(images, card_size=(148, 100)): app = QtGui.QApplication(sys.argv) printer = QtGui.QPrinter() #printer.setCopyCount(2) printer.setOrientation(QtGui.QPrinter.Landscape) printer.setFullPage(True) printer.setPaperSize(QtCore.QSize(card_size[1], card_size[0]), QtGui.QPrinter.Millimeter) fn = os.path.dirname(__file__) + '/print_' + time.strftime( '%Y%m%d%H%M%S') + '.pdf' printer.setOutputFileName(fn) painter = QtGui.QPainter() painter.begin(printer) page_rect = printer.pageRect() image_rect = QtCore.QRect(0, 0, page_rect.width() / 3, page_rect.height() / 2) rects = [] images.append(QtGui.QImage(os.path.dirname(__file__) + '/logo.png')) for image in images: scaled_image = image.scaled(image_rect.size(), QtCore.Qt.KeepAspectRatio) adjusted_rect = QtCore.QRect(image_rect) adjusted_rect.setSize(scaled_image.size()) if image_rect.top() >= image_rect.height(): dy = 0 else: dy = image_rect.height() - scaled_image.height() adjusted_rect.translate( (image_rect.width() - scaled_image.width()) / 2, dy) painter.drawImage(adjusted_rect, image) rects.append(adjusted_rect) image_rect.translate(image_rect.width(), 0) if image_rect.right() > page_rect.width(): image_rect.moveTop(image_rect.height()) image_rect.moveLeft(0) subtitleFont = QtGui.QFont() subtitleFont.setFamily('Helvetica Neue') subtitleFont.setPixelSize(8) subtitleFont.setWeight(QtGui.QFont.Normal) painter.setFont(subtitleFont) dateRect = rects[3] dateRect.moveLeft(dateRect.left() + 2) dateRect.moveTop(dateRect.bottom() + 2) dateRect.setHeight(10) painter.drawText(dateRect, time.strftime('%Y/%m/%d')) urlRect = rects[4] urlRect.moveLeft(urlRect.left() + 2) urlRect.moveTop(urlRect.bottom() + 2) urlRect.setHeight(10) painter.drawText(urlRect, 'kaigoto.com') painter.end() os.system( 'lpr -#2 -o landscape -o fit-to-page -o media=Custom.100x148mm -P Brother_HL_2270DW_series ' + fn)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(880, 640) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.tabOption = QtGui.QTabWidget(self.centralwidget) self.tabOption.setGeometry(QtCore.QRect(10, 10, 861, 581)) self.tabOption.setObjectName("tabOption") self.tab = QtGui.QWidget() self.tab.setObjectName("tab") self.grpCarrier1 = QtGui.QGroupBox(self.tab) self.grpCarrier1.setGeometry(QtCore.QRect(470, 10, 381, 461)) self.grpCarrier1.setAlignment(QtCore.Qt.AlignCenter) self.grpCarrier1.setFlat(False) self.grpCarrier1.setObjectName("grpCarrier1") self.viewCarrier1 = QtGui.QGraphicsView(self.grpCarrier1) self.viewCarrier1.setGeometry(QtCore.QRect(10, 40, 361, 281)) self.viewCarrier1.setObjectName("viewCarrier1") self.chkOverride = QtGui.QCheckBox(self.grpCarrier1) self.chkOverride.setEnabled(False) self.chkOverride.setGeometry(QtCore.QRect(20, 370, 141, 22)) self.chkOverride.setObjectName("chkOverride") self.lblPayloadFound = QtGui.QLabel(self.grpCarrier1) self.lblPayloadFound.setGeometry(QtCore.QRect(30, 330, 331, 21)) font = QtGui.QFont() font.setFamily("CM Roman") font.setPointSize(15) self.lblPayloadFound.setFont(font) self.lblPayloadFound.setText("") self.lblPayloadFound.setAlignment(QtCore.Qt.AlignCenter) self.lblPayloadFound.setObjectName("lblPayloadFound") self.txtCarrierSize = QtGui.QLineEdit(self.grpCarrier1) self.txtCarrierSize.setGeometry(QtCore.QRect(140, 410, 231, 27)) self.txtCarrierSize.setAlignment(QtCore.Qt.AlignCenter) self.txtCarrierSize.setReadOnly(True) self.txtCarrierSize.setObjectName("txtCarrierSize") self.lblCarrierSize = QtGui.QLabel(self.grpCarrier1) self.lblCarrierSize.setGeometry(QtCore.QRect(10, 410, 121, 21)) font = QtGui.QFont() font.setFamily("CM Roman") font.setPointSize(15) self.lblCarrierSize.setFont(font) self.lblCarrierSize.setAlignment(QtCore.Qt.AlignCenter) self.lblCarrierSize.setObjectName("lblCarrierSize") self.lblArrow = QtGui.QLabel(self.tab) self.lblArrow.setGeometry(QtCore.QRect(390, 180, 71, 21)) font = QtGui.QFont() font.setFamily("CM Roman") font.setPointSize(15) self.lblArrow.setFont(font) self.lblArrow.setAlignment(QtCore.Qt.AlignCenter) self.lblArrow.setObjectName("lblArrow") self.grpPayload1 = QtGui.QGroupBox(self.tab) self.grpPayload1.setGeometry(QtCore.QRect(0, 10, 381, 461)) self.grpPayload1.setAlignment(QtCore.Qt.AlignCenter) self.grpPayload1.setFlat(False) self.grpPayload1.setObjectName("grpPayload1") self.viewPayload1 = QtGui.QGraphicsView(self.grpPayload1) self.viewPayload1.setGeometry(QtCore.QRect(10, 40, 361, 281)) self.viewPayload1.setObjectName("viewPayload1") self.txtCompression = QtGui.QLineEdit(self.grpPayload1) self.txtCompression.setEnabled(False) self.txtCompression.setGeometry(QtCore.QRect(340, 370, 31, 27)) self.txtCompression.setAlignment(QtCore.Qt.AlignCenter) self.txtCompression.setReadOnly(True) self.txtCompression.setObjectName("txtCompression") self.slideCompression = QtGui.QSlider(self.grpPayload1) self.slideCompression.setEnabled(False) self.slideCompression.setGeometry(QtCore.QRect(80, 363, 251, 31)) self.slideCompression.setMaximum(9) self.slideCompression.setPageStep(1) self.slideCompression.setProperty("value", 0) self.slideCompression.setTracking(True) self.slideCompression.setOrientation(QtCore.Qt.Horizontal) self.slideCompression.setInvertedAppearance(False) self.slideCompression.setTickPosition(QtGui.QSlider.TicksBelow) self.slideCompression.setTickInterval(1) self.slideCompression.setObjectName("slideCompression") self.lblLevel = QtGui.QLabel(self.grpPayload1) self.lblLevel.setEnabled(False) self.lblLevel.setGeometry(QtCore.QRect(30, 370, 35, 21)) self.lblLevel.setObjectName("lblLevel") self.chkApplyCompression = QtGui.QCheckBox(self.grpPayload1) self.chkApplyCompression.setGeometry(QtCore.QRect(10, 340, 161, 22)) self.chkApplyCompression.setObjectName("chkApplyCompression") self.lblPayloadSize = QtGui.QLabel(self.grpPayload1) self.lblPayloadSize.setGeometry(QtCore.QRect(10, 410, 121, 21)) font = QtGui.QFont() font.setFamily("CM Roman") font.setPointSize(15) self.lblPayloadSize.setFont(font) self.lblPayloadSize.setAlignment(QtCore.Qt.AlignCenter) self.lblPayloadSize.setObjectName("lblPayloadSize") self.txtPayloadSize = QtGui.QLineEdit(self.grpPayload1) self.txtPayloadSize.setGeometry(QtCore.QRect(140, 410, 231, 27)) self.txtPayloadSize.setAlignment(QtCore.Qt.AlignCenter) self.txtPayloadSize.setReadOnly(True) self.txtPayloadSize.setObjectName("txtPayloadSize") self.btnSave = QtGui.QPushButton(self.tab) self.btnSave.setEnabled(False) self.btnSave.setGeometry(QtCore.QRect(340, 510, 161, 27)) self.btnSave.setObjectName("btnSave") self.tabOption.addTab(self.tab, "") self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName("tab_2") self.grpPayload2 = QtGui.QGroupBox(self.tab_2) self.grpPayload2.setGeometry(QtCore.QRect(470, 10, 381, 331)) self.grpPayload2.setAlignment(QtCore.Qt.AlignCenter) self.grpPayload2.setFlat(False) self.grpPayload2.setObjectName("grpPayload2") self.viewPayload2 = QtGui.QGraphicsView(self.grpPayload2) self.viewPayload2.setGeometry(QtCore.QRect(10, 40, 361, 281)) self.viewPayload2.setObjectName("viewPayload2") self.grpCarrier2 = QtGui.QGroupBox(self.tab_2) self.grpCarrier2.setGeometry(QtCore.QRect(0, 10, 381, 461)) self.grpCarrier2.setAlignment(QtCore.Qt.AlignCenter) self.grpCarrier2.setFlat(False) self.grpCarrier2.setObjectName("grpCarrier2") self.viewCarrier2 = QtGui.QGraphicsView(self.grpCarrier2) self.viewCarrier2.setGeometry(QtCore.QRect(10, 40, 361, 281)) self.viewCarrier2.setObjectName("viewCarrier2") self.lblCarrierEmpty = QtGui.QLabel(self.grpCarrier2) self.lblCarrierEmpty.setGeometry(QtCore.QRect(20, 330, 331, 21)) font = QtGui.QFont() font.setFamily("CM Roman") font.setPointSize(15) self.lblCarrierEmpty.setFont(font) self.lblCarrierEmpty.setText("") self.lblCarrierEmpty.setAlignment(QtCore.Qt.AlignCenter) self.lblCarrierEmpty.setObjectName("lblCarrierEmpty") self.btnExtract = QtGui.QPushButton(self.grpCarrier2) self.btnExtract.setEnabled(False) self.btnExtract.setGeometry(QtCore.QRect(50, 370, 281, 27)) self.btnExtract.setObjectName("btnExtract") self.btnClean = QtGui.QPushButton(self.grpCarrier2) self.btnClean.setEnabled(False) self.btnClean.setGeometry(QtCore.QRect(50, 410, 281, 27)) self.btnClean.setObjectName("btnClean") self.lblArrow2 = QtGui.QLabel(self.tab_2) self.lblArrow2.setGeometry(QtCore.QRect(390, 170, 71, 21)) font = QtGui.QFont() font.setFamily("CM Roman") font.setPointSize(15) self.lblArrow2.setFont(font) self.lblArrow2.setAlignment(QtCore.Qt.AlignCenter) self.lblArrow2.setObjectName("lblArrow2") self.tabOption.addTab(self.tab_2, "") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 880, 25)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.tabOption.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(256, 616) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_7 = QtGui.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.line_8 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_8.sizePolicy().hasHeightForWidth()) self.line_8.setSizePolicy(sizePolicy) self.line_8.setFrameShape(QtGui.QFrame.HLine) self.line_8.setFrameShadow(QtGui.QFrame.Sunken) self.line_8.setObjectName("line_8") self.horizontalLayout_7.addWidget(self.line_8) self.label_3 = QtGui.QLabel(self.centralwidget) self.label_3.setScaledContents(False) self.label_3.setObjectName("label_3") self.horizontalLayout_7.addWidget(self.label_3) self.line_9 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_9.sizePolicy().hasHeightForWidth()) self.line_9.setSizePolicy(sizePolicy) self.line_9.setFrameShape(QtGui.QFrame.HLine) self.line_9.setFrameShadow(QtGui.QFrame.Sunken) self.line_9.setObjectName("line_9") self.horizontalLayout_7.addWidget(self.line_9) self.verticalLayout.addLayout(self.horizontalLayout_7) self.detachSeparate_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.detachSeparate_pushButton.sizePolicy().hasHeightForWidth()) self.detachSeparate_pushButton.setSizePolicy(sizePolicy) self.detachSeparate_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.detachSeparate_pushButton.setFont(font) self.detachSeparate_pushButton.setObjectName( "detachSeparate_pushButton") self.verticalLayout.addWidget(self.detachSeparate_pushButton) self.gridLayout_2 = QtGui.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.scatter_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.scatter_pushButton.sizePolicy().hasHeightForWidth()) self.scatter_pushButton.setSizePolicy(sizePolicy) self.scatter_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.scatter_pushButton.setFont(font) self.scatter_pushButton.setObjectName("scatter_pushButton") self.gridLayout_2.addWidget(self.scatter_pushButton, 0, 0, 1, 1) self.scatterInfo_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.scatterInfo_pushButton.sizePolicy().hasHeightForWidth()) self.scatterInfo_pushButton.setSizePolicy(sizePolicy) self.scatterInfo_pushButton.setMinimumSize(QtCore.QSize(30, 25)) self.scatterInfo_pushButton.setMaximumSize(QtCore.QSize(25, 16777215)) self.scatterInfo_pushButton.setObjectName("scatterInfo_pushButton") self.gridLayout_2.addWidget(self.scatterInfo_pushButton, 0, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout_2) self.uvDeluxe_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.uvDeluxe_pushButton.sizePolicy().hasHeightForWidth()) self.uvDeluxe_pushButton.setSizePolicy(sizePolicy) self.uvDeluxe_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.uvDeluxe_pushButton.setFont(font) self.uvDeluxe_pushButton.setObjectName("uvDeluxe_pushButton") self.verticalLayout.addWidget(self.uvDeluxe_pushButton) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.line_12 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_12.sizePolicy().hasHeightForWidth()) self.line_12.setSizePolicy(sizePolicy) self.line_12.setFrameShape(QtGui.QFrame.HLine) self.line_12.setFrameShadow(QtGui.QFrame.Sunken) self.line_12.setObjectName("line_12") self.horizontalLayout_9.addWidget(self.line_12) self.label_5 = QtGui.QLabel(self.centralwidget) self.label_5.setScaledContents(False) self.label_5.setObjectName("label_5") self.horizontalLayout_9.addWidget(self.label_5) self.line_13 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_13.sizePolicy().hasHeightForWidth()) self.line_13.setSizePolicy(sizePolicy) self.line_13.setFrameShape(QtGui.QFrame.HLine) self.line_13.setFrameShadow(QtGui.QFrame.Sunken) self.line_13.setObjectName("line_13") self.horizontalLayout_9.addWidget(self.line_13) self.verticalLayout.addLayout(self.horizontalLayout_9) self.symmetry_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.symmetry_pushButton.sizePolicy().hasHeightForWidth()) self.symmetry_pushButton.setSizePolicy(sizePolicy) self.symmetry_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.symmetry_pushButton.setFont(font) self.symmetry_pushButton.setObjectName("symmetry_pushButton") self.verticalLayout.addWidget(self.symmetry_pushButton) self.horizontalLayout_8 = QtGui.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.line_10 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_10.sizePolicy().hasHeightForWidth()) self.line_10.setSizePolicy(sizePolicy) self.line_10.setFrameShape(QtGui.QFrame.HLine) self.line_10.setFrameShadow(QtGui.QFrame.Sunken) self.line_10.setObjectName("line_10") self.horizontalLayout_8.addWidget(self.line_10) self.label_4 = QtGui.QLabel(self.centralwidget) self.label_4.setScaledContents(False) self.label_4.setObjectName("label_4") self.horizontalLayout_8.addWidget(self.label_4) self.line_11 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_11.sizePolicy().hasHeightForWidth()) self.line_11.setSizePolicy(sizePolicy) self.line_11.setFrameShape(QtGui.QFrame.HLine) self.line_11.setFrameShadow(QtGui.QFrame.Sunken) self.line_11.setObjectName("line_11") self.horizontalLayout_8.addWidget(self.line_11) self.verticalLayout.addLayout(self.horizontalLayout_8) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.mirrorBlendshape_pushButton = QtGui.QPushButton( self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.mirrorBlendshape_pushButton.sizePolicy().hasHeightForWidth()) self.mirrorBlendshape_pushButton.setSizePolicy(sizePolicy) self.mirrorBlendshape_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.mirrorBlendshape_pushButton.setFont(font) self.mirrorBlendshape_pushButton.setObjectName( "mirrorBlendshape_pushButton") self.horizontalLayout_3.addWidget(self.mirrorBlendshape_pushButton) self.UVSymmetry_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.UVSymmetry_pushButton.sizePolicy().hasHeightForWidth()) self.UVSymmetry_pushButton.setSizePolicy(sizePolicy) self.UVSymmetry_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.UVSymmetry_pushButton.setFont(font) self.UVSymmetry_pushButton.setObjectName("UVSymmetry_pushButton") self.horizontalLayout_3.addWidget(self.UVSymmetry_pushButton) self.verticalLayout.addLayout(self.horizontalLayout_3) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.line_4 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_4.sizePolicy().hasHeightForWidth()) self.line_4.setSizePolicy(sizePolicy) self.line_4.setFrameShape(QtGui.QFrame.HLine) self.line_4.setFrameShadow(QtGui.QFrame.Sunken) self.line_4.setObjectName("line_4") self.horizontalLayout_5.addWidget(self.line_4) self.label = QtGui.QLabel(self.centralwidget) self.label.setScaledContents(False) self.label.setObjectName("label") self.horizontalLayout_5.addWidget(self.label) self.line_5 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_5.sizePolicy().hasHeightForWidth()) self.line_5.setSizePolicy(sizePolicy) self.line_5.setFrameShape(QtGui.QFrame.HLine) self.line_5.setFrameShadow(QtGui.QFrame.Sunken) self.line_5.setObjectName("line_5") self.horizontalLayout_5.addWidget(self.line_5) self.verticalLayout.addLayout(self.horizontalLayout_5) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.loadPositionVerts_pushButton = QtGui.QPushButton( self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.loadPositionVerts_pushButton.sizePolicy().hasHeightForWidth()) self.loadPositionVerts_pushButton.setSizePolicy(sizePolicy) self.loadPositionVerts_pushButton.setMinimumSize(QtCore.QSize(0, 40)) self.loadPositionVerts_pushButton.setObjectName( "loadPositionVerts_pushButton") self.gridLayout.addWidget(self.loadPositionVerts_pushButton, 0, 0, 1, 1) self.line_2 = QtGui.QFrame(self.centralwidget) self.line_2.setFrameShape(QtGui.QFrame.VLine) self.line_2.setFrameShadow(QtGui.QFrame.Sunken) self.line_2.setObjectName("line_2") self.gridLayout.addWidget(self.line_2, 0, 1, 1, 1) self.positionVerts_label = QtGui.QLabel(self.centralwidget) self.positionVerts_label.setAlignment(QtCore.Qt.AlignCenter) self.positionVerts_label.setObjectName("positionVerts_label") self.gridLayout.addWidget(self.positionVerts_label, 0, 2, 1, 1) self.loadUpVert_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.loadUpVert_pushButton.sizePolicy().hasHeightForWidth()) self.loadUpVert_pushButton.setSizePolicy(sizePolicy) self.loadUpVert_pushButton.setMinimumSize(QtCore.QSize(0, 40)) self.loadUpVert_pushButton.setObjectName("loadUpVert_pushButton") self.gridLayout.addWidget(self.loadUpVert_pushButton, 1, 0, 1, 1) self.line_3 = QtGui.QFrame(self.centralwidget) self.line_3.setFrameShape(QtGui.QFrame.VLine) self.line_3.setFrameShadow(QtGui.QFrame.Sunken) self.line_3.setObjectName("line_3") self.gridLayout.addWidget(self.line_3, 1, 1, 1, 1) self.upVert_label = QtGui.QLabel(self.centralwidget) self.upVert_label.setAlignment(QtCore.Qt.AlignCenter) self.upVert_label.setObjectName("upVert_label") self.gridLayout.addWidget(self.upVert_label, 1, 2, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.locator_checkBox = QtGui.QCheckBox(self.centralwidget) self.locator_checkBox.setEnabled(True) self.locator_checkBox.setChecked(False) self.locator_checkBox.setObjectName("locator_checkBox") self.horizontalLayout.addWidget(self.locator_checkBox) self.mesh_checkBox = QtGui.QCheckBox(self.centralwidget) self.mesh_checkBox.setEnabled(True) self.mesh_checkBox.setChecked(False) self.mesh_checkBox.setObjectName("mesh_checkBox") self.horizontalLayout.addWidget(self.mesh_checkBox) self.verticalLayout.addLayout(self.horizontalLayout) self.create_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.create_pushButton.sizePolicy().hasHeightForWidth()) self.create_pushButton.setSizePolicy(sizePolicy) self.create_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.create_pushButton.setFont(font) self.create_pushButton.setObjectName("create_pushButton") self.verticalLayout.addWidget(self.create_pushButton) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.line_6 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_6.sizePolicy().hasHeightForWidth()) self.line_6.setSizePolicy(sizePolicy) self.line_6.setFrameShape(QtGui.QFrame.HLine) self.line_6.setFrameShadow(QtGui.QFrame.Sunken) self.line_6.setObjectName("line_6") self.horizontalLayout_6.addWidget(self.line_6) self.label_2 = QtGui.QLabel(self.centralwidget) self.label_2.setScaledContents(False) self.label_2.setObjectName("label_2") self.horizontalLayout_6.addWidget(self.label_2) self.line_7 = QtGui.QFrame(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_7.sizePolicy().hasHeightForWidth()) self.line_7.setSizePolicy(sizePolicy) self.line_7.setFrameShape(QtGui.QFrame.HLine) self.line_7.setFrameShadow(QtGui.QFrame.Sunken) self.line_7.setObjectName("line_7") self.horizontalLayout_6.addWidget(self.line_7) self.verticalLayout.addLayout(self.horizontalLayout_6) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.roadkill_useLSCM_checkBox = QtGui.QCheckBox(self.centralwidget) self.roadkill_useLSCM_checkBox.setObjectName( "roadkill_useLSCM_checkBox") self.horizontalLayout_2.addWidget(self.roadkill_useLSCM_checkBox) self.roadkill_dontFillHoles_checkBox = QtGui.QCheckBox( self.centralwidget) self.roadkill_dontFillHoles_checkBox.setObjectName( "roadkill_dontFillHoles_checkBox") self.horizontalLayout_2.addWidget(self.roadkill_dontFillHoles_checkBox) self.verticalLayout.addLayout(self.horizontalLayout_2) self.roadkill_liveUnwrap_checkBox = QtGui.QCheckBox(self.centralwidget) self.roadkill_liveUnwrap_checkBox.setObjectName( "roadkill_liveUnwrap_checkBox") self.verticalLayout.addWidget(self.roadkill_liveUnwrap_checkBox) self.roadKill_pushButton = QtGui.QPushButton(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.roadKill_pushButton.sizePolicy().hasHeightForWidth()) self.roadKill_pushButton.setSizePolicy(sizePolicy) self.roadKill_pushButton.setMinimumSize(QtCore.QSize(0, 40)) font = QtGui.QFont() font.setPointSize(10) self.roadKill_pushButton.setFont(font) self.roadKill_pushButton.setObjectName("roadKill_pushButton") self.verticalLayout.addWidget(self.roadKill_pushButton) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowModality(QtCore.Qt.ApplicationModal) Dialog.resize(640, 450) font = QtGui.QFont() font.setPointSize(12) Dialog.setFont(font) self.groupBox = QtGui.QGroupBox(Dialog) self.groupBox.setGeometry(QtCore.QRect(200, 10, 231, 141)) font = QtGui.QFont() font.setPointSize(12) self.groupBox.setFont(font) self.groupBox.setAutoFillBackground(True) self.groupBox.setObjectName("groupBox") self.label = QtGui.QLabel(self.groupBox) self.label.setGeometry(QtCore.QRect(20, 30, 101, 41)) self.label.setObjectName("label") self.labelTopPosition = QtGui.QLabel(self.groupBox) self.labelTopPosition.setGeometry(QtCore.QRect(30, 60, 91, 41)) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.labelTopPosition.setFont(font) self.labelTopPosition.setObjectName("labelTopPosition") self.tbTopOpen = QtGui.QToolButton(self.groupBox) self.tbTopOpen.setGeometry(QtCore.QRect(150, 20, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbTopOpen.setFont(font) self.tbTopOpen.setObjectName("tbTopOpen") self.tbTopClose = QtGui.QToolButton(self.groupBox) self.tbTopClose.setGeometry(QtCore.QRect(150, 80, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbTopClose.setFont(font) self.tbTopClose.setObjectName("tbTopClose") self.groupBox_2 = QtGui.QGroupBox(Dialog) self.groupBox_2.setGeometry(QtCore.QRect(200, 300, 231, 141)) font = QtGui.QFont() font.setPointSize(12) self.groupBox_2.setFont(font) self.groupBox_2.setAutoFillBackground(True) self.groupBox_2.setFlat(False) self.groupBox_2.setObjectName("groupBox_2") self.label_4 = QtGui.QLabel(self.groupBox_2) self.label_4.setGeometry(QtCore.QRect(20, 30, 101, 41)) self.label_4.setObjectName("label_4") self.labelBottomPosition = QtGui.QLabel(self.groupBox_2) self.labelBottomPosition.setGeometry(QtCore.QRect(30, 60, 91, 41)) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.labelBottomPosition.setFont(font) self.labelBottomPosition.setObjectName("labelBottomPosition") self.tbBottomClose = QtGui.QToolButton(self.groupBox_2) self.tbBottomClose.setGeometry(QtCore.QRect(150, 20, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbBottomClose.setFont(font) self.tbBottomClose.setObjectName("tbBottomClose") self.tbBottomOpen = QtGui.QToolButton(self.groupBox_2) self.tbBottomOpen.setGeometry(QtCore.QRect(150, 80, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbBottomOpen.setFont(font) self.tbBottomOpen.setObjectName("tbBottomOpen") self.groupBox_3 = QtGui.QGroupBox(Dialog) self.groupBox_3.setGeometry(QtCore.QRect(4, 150, 191, 151)) font = QtGui.QFont() font.setPointSize(12) self.groupBox_3.setFont(font) self.groupBox_3.setAutoFillBackground(True) self.groupBox_3.setObjectName("groupBox_3") self.label_5 = QtGui.QLabel(self.groupBox_3) self.label_5.setGeometry(QtCore.QRect(10, 40, 101, 41)) self.label_5.setObjectName("label_5") self.labelOutboardPosition = QtGui.QLabel(self.groupBox_3) self.labelOutboardPosition.setGeometry(QtCore.QRect(90, 40, 91, 41)) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.labelOutboardPosition.setFont(font) self.labelOutboardPosition.setObjectName("labelOutboardPosition") self.tbOutboardOpen = QtGui.QToolButton(self.groupBox_3) self.tbOutboardOpen.setGeometry(QtCore.QRect(30, 80, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbOutboardOpen.setFont(font) self.tbOutboardOpen.setObjectName("tbOutboardOpen") self.tbOutboardClose = QtGui.QToolButton(self.groupBox_3) self.tbOutboardClose.setGeometry(QtCore.QRect(130, 80, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbOutboardClose.setFont(font) self.tbOutboardClose.setObjectName("tbOutboardClose") self.groupBox_4 = QtGui.QGroupBox(Dialog) self.groupBox_4.setGeometry(QtCore.QRect(440, 150, 191, 151)) font = QtGui.QFont() font.setPointSize(12) self.groupBox_4.setFont(font) self.groupBox_4.setAutoFillBackground(True) self.groupBox_4.setObjectName("groupBox_4") self.label_6 = QtGui.QLabel(self.groupBox_4) self.label_6.setGeometry(QtCore.QRect(10, 40, 101, 41)) self.label_6.setObjectName("label_6") self.labelInboardPosition = QtGui.QLabel(self.groupBox_4) self.labelInboardPosition.setGeometry(QtCore.QRect(90, 40, 91, 41)) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.labelInboardPosition.setFont(font) self.labelInboardPosition.setObjectName("labelInboardPosition") self.tbInboardClose = QtGui.QToolButton(self.groupBox_4) self.tbInboardClose.setGeometry(QtCore.QRect(30, 80, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbInboardClose.setFont(font) self.tbInboardClose.setObjectName("tbInboardClose") self.tbInboardOpen = QtGui.QToolButton(self.groupBox_4) self.tbInboardOpen.setGeometry(QtCore.QRect(130, 80, 51, 51)) font = QtGui.QFont() font.setPointSize(24) font.setWeight(75) font.setBold(True) self.tbInboardOpen.setFont(font) self.tbInboardOpen.setObjectName("tbInboardOpen") self.groupBox_5 = QtGui.QGroupBox(Dialog) self.groupBox_5.setGeometry(QtCore.QRect(200, 160, 231, 141)) self.groupBox_5.setAutoFillBackground(True) self.groupBox_5.setTitle("") self.groupBox_5.setObjectName("groupBox_5") self.label_2 = QtGui.QLabel(self.groupBox_5) self.label_2.setGeometry(QtCore.QRect(14, 12, 51, 21)) font = QtGui.QFont() font.setPointSize(12) self.label_2.setFont(font) self.label_2.setObjectName("label_2") self.spinBox = QtGui.QSpinBox(self.groupBox_5) self.spinBox.setGeometry(QtCore.QRect(70, 10, 81, 31)) font = QtGui.QFont() font.setPointSize(12) self.spinBox.setFont(font) self.spinBox.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.spinBox.setMinimum(1) self.spinBox.setMaximum(1000) self.spinBox.setSingleStep(1) self.spinBox.setProperty("value", 1) self.spinBox.setObjectName("spinBox") self.label_3 = QtGui.QLabel(self.groupBox_5) self.label_3.setGeometry(QtCore.QRect(160, 10, 71, 31)) font = QtGui.QFont() font.setFamily("MS Shell Dlg 2") font.setPointSize(12) self.label_3.setFont(font) self.label_3.setTextFormat(QtCore.Qt.RichText) self.label_3.setObjectName("label_3") self.pbOpenAll = QtGui.QPushButton(self.groupBox_5) self.pbOpenAll.setGeometry(QtCore.QRect(10, 77, 93, 41)) self.pbOpenAll.setObjectName("pbOpenAll") self.pbCloseAll = QtGui.QPushButton(self.groupBox_5) self.pbCloseAll.setGeometry(QtCore.QRect(125, 77, 93, 40)) self.pbCloseAll.setObjectName("pbCloseAll") self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(596, 717) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout_7 = QtGui.QGridLayout(self.centralwidget) self.gridLayout_7.setObjectName("gridLayout_7") self.groupBox_2 = QtGui.QGroupBox(self.centralwidget) self.groupBox_2.setObjectName("groupBox_2") self.gridLayout = QtGui.QGridLayout(self.groupBox_2) self.gridLayout.setObjectName("gridLayout") self.tabWidget = QtGui.QTabWidget(self.groupBox_2) self.tabWidget.setObjectName("tabWidget") self.tab = QtGui.QWidget() self.tab.setObjectName("tab") self.gridLayout_4 = QtGui.QGridLayout(self.tab) self.gridLayout_4.setObjectName("gridLayout_4") self.groupBox_3 = QtGui.QGroupBox(self.tab) self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_5 = QtGui.QGridLayout(self.groupBox_3) self.gridLayout_5.setObjectName("gridLayout_5") self.label_2 = QtGui.QLabel(self.groupBox_3) self.label_2.setObjectName("label_2") self.gridLayout_5.addWidget(self.label_2, 0, 0, 1, 1) self.lineEdit = QtGui.QLineEdit(self.groupBox_3) self.lineEdit.setObjectName("lineEdit") self.gridLayout_5.addWidget(self.lineEdit, 0, 1, 1, 1) self.frame = QtGui.QFrame(self.groupBox_3) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName("frame") self.formLayout = QtGui.QFormLayout(self.frame) self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setObjectName("formLayout") self.label_3 = QtGui.QLabel(self.frame) self.label_3.setObjectName("label_3") self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_3) self.lineEdit_2 = QtGui.QLineEdit(self.frame) self.lineEdit_2.setObjectName("lineEdit_2") self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.lineEdit_2) self.listWidget_2 = QtGui.QListWidget(self.frame) self.listWidget_2.setObjectName("listWidget_2") QtGui.QListWidgetItem(self.listWidget_2) self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.listWidget_2) self.gridLayout_5.addWidget(self.frame, 2, 0, 1, 2) self.listWidget = QtGui.QListWidget(self.groupBox_3) self.listWidget.setObjectName("listWidget") QtGui.QListWidgetItem(self.listWidget) self.gridLayout_5.addWidget(self.listWidget, 1, 1, 1, 1) self.gridLayout_4.addWidget(self.groupBox_3, 1, 0, 1, 1) self.tabWidget.addTab(self.tab, "") self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName("tab_2") self.gridLayout_6 = QtGui.QGridLayout(self.tab_2) self.gridLayout_6.setObjectName("gridLayout_6") self.label_4 = QtGui.QLabel(self.tab_2) self.label_4.setObjectName("label_4") self.gridLayout_6.addWidget(self.label_4, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_2, "") self.tab_3 = QtGui.QWidget() self.tab_3.setObjectName("tab_3") self.tabWidget.addTab(self.tab_3, "") self.tab_4 = QtGui.QWidget() self.tab_4.setObjectName("tab_4") self.tabWidget.addTab(self.tab_4, "") self.tab_5 = QtGui.QWidget() self.tab_5.setObjectName("tab_5") self.tabWidget.addTab(self.tab_5, "") self.tab_6 = QtGui.QWidget() self.tab_6.setObjectName("tab_6") self.tabWidget.addTab(self.tab_6, "") self.tab_7 = QtGui.QWidget() self.tab_7.setObjectName("tab_7") self.tabWidget.addTab(self.tab_7, "") self.tab_8 = QtGui.QWidget() self.tab_8.setObjectName("tab_8") self.tabWidget.addTab(self.tab_8, "") self.tab_9 = QtGui.QWidget() self.tab_9.setObjectName("tab_9") self.tabWidget.addTab(self.tab_9, "") self.tab_10 = QtGui.QWidget() self.tab_10.setObjectName("tab_10") self.tabWidget.addTab(self.tab_10, "") self.tab_11 = QtGui.QWidget() self.tab_11.setObjectName("tab_11") self.tabWidget.addTab(self.tab_11, "") self.tab_12 = QtGui.QWidget() self.tab_12.setObjectName("tab_12") self.gridLayout_3 = QtGui.QGridLayout(self.tab_12) self.gridLayout_3.setObjectName("gridLayout_3") self.tabWidget.addTab(self.tab_12, "") self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) self.gridLayout_7.addWidget(self.groupBox_2, 0, 0, 1, 1) self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setObjectName("groupBox") self.gridLayout_2 = QtGui.QGridLayout(self.groupBox) self.gridLayout_2.setObjectName("gridLayout_2") self.label = QtGui.QLabel(self.groupBox) self.label.setLineWidth(0) self.label.setTextFormat(QtCore.Qt.RichText) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setWordWrap(True) self.label.setOpenExternalLinks(True) self.label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) self.label.setObjectName("label") self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1) self.gridLayout_7.addWidget(self.groupBox, 1, 0, 1, 1) self.label_71 = QtGui.QLabel(self.centralwidget) self.label_71.setAlignment(QtCore.Qt.AlignCenter) self.label_71.setObjectName("label_71") self.gridLayout_7.addWidget(self.label_71, 2, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 596, 25)) self.menubar.setObjectName("menubar") self.menuMenu = QtGui.QMenu(self.menubar) self.menuMenu.setObjectName("menuMenu") self.menuMenuSub = QtGui.QMenu(self.menuMenu) self.menuMenuSub.setObjectName("menuMenuSub") self.menuMenuDelayed = QtGui.QMenu(self.menubar) self.menuMenuDelayed.setObjectName("menuMenuDelayed") self.menuMenuSubDelayed = QtGui.QMenu(self.menuMenuDelayed) self.menuMenuSubDelayed.setObjectName("menuMenuSubDelayed") self.menuMenuCheckale = QtGui.QMenu(self.menubar) self.menuMenuCheckale.setObjectName("menuMenuCheckale") self.menuNew = QtGui.QMenu(self.menuMenuCheckale) self.menuNew.setObjectName("menuNew") self.menuAbout = QtGui.QMenu(self.menubar) self.menuAbout.setObjectName("menuAbout") self.menuHelp = QtGui.QMenu(self.menubar) self.menuHelp.setObjectName("menuHelp") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.toolBar = QtGui.QToolBar(MainWindow) self.toolBar.setObjectName("toolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.toolBarDelayed = QtGui.QToolBar(MainWindow) self.toolBarDelayed.setObjectName("toolBarDelayed") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarDelayed) self.toolBarCheckable = QtGui.QToolBar(MainWindow) self.toolBarCheckable.setObjectName("toolBarCheckable") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarCheckable) MainWindow.insertToolBarBreak(self.toolBarCheckable) self.actionActionA = QtGui.QAction(MainWindow) self.actionActionA.setObjectName("actionActionA") self.actionActionSubA = QtGui.QAction(MainWindow) self.actionActionSubA.setObjectName("actionActionSubA") self.actionActionSubB = QtGui.QAction(MainWindow) self.actionActionSubB.setObjectName("actionActionSubB") self.actionActionDelayedA = QtGui.QAction(MainWindow) self.actionActionDelayedA.setObjectName("actionActionDelayedA") self.actionActionDelayedSubA = QtGui.QAction(MainWindow) self.actionActionDelayedSubA.setObjectName("actionActionDelayedSubA") self.actionActionCheckableA = QtGui.QAction(MainWindow) self.actionActionCheckableA.setCheckable(True) self.actionActionCheckableA.setObjectName("actionActionCheckableA") self.actionActionCheckableSubAChecked = QtGui.QAction(MainWindow) self.actionActionCheckableSubAChecked.setCheckable(True) self.actionActionCheckableSubAChecked.setChecked(True) self.actionActionCheckableSubAChecked.setObjectName("actionActionCheckableSubAChecked") self.actionActionCheckableSubAUnchecked = QtGui.QAction(MainWindow) self.actionActionCheckableSubAUnchecked.setCheckable(True) self.actionActionCheckableSubAUnchecked.setObjectName("actionActionCheckableSubAUnchecked") self.actionNew_2 = QtGui.QAction(MainWindow) self.actionNew_2.setObjectName("actionNew_2") self.actionNew_3 = QtGui.QAction(MainWindow) self.actionNew_3.setObjectName("actionNew_3") self.actionNew_4 = QtGui.QAction(MainWindow) self.actionNew_4.setObjectName("actionNew_4") self.actionNew_5 = QtGui.QAction(MainWindow) self.actionNew_5.setObjectName("actionNew_5") self.menuMenuSub.addAction(self.actionActionSubA) self.menuMenuSub.addAction(self.actionActionSubB) self.menuMenu.addAction(self.actionActionA) self.menuMenu.addAction(self.menuMenuSub.menuAction()) self.menuMenuSubDelayed.addAction(self.actionActionDelayedSubA) self.menuMenuDelayed.addAction(self.actionActionDelayedA) self.menuMenuDelayed.addAction(self.menuMenuSubDelayed.menuAction()) self.menuNew.addSeparator() self.menuNew.addAction(self.actionNew_2) self.menuNew.addAction(self.actionNew_4) self.menuNew.addAction(self.actionNew_3) self.menuNew.addSeparator() self.menuNew.addAction(self.actionNew_5) self.menuMenuCheckale.addAction(self.actionActionCheckableA) self.menuMenuCheckale.addSeparator() self.menuMenuCheckale.addAction(self.menuNew.menuAction()) self.menubar.addAction(self.menuMenu.menuAction()) self.menubar.addAction(self.menuMenuDelayed.menuAction()) self.menubar.addAction(self.menuMenuCheckale.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.menubar.addAction(self.menuAbout.menuAction()) self.toolBar.addAction(self.actionActionA) self.toolBar.addSeparator() self.toolBar.addAction(self.actionActionSubA) self.toolBar.addAction(self.actionActionSubB) self.toolBarDelayed.addAction(self.actionActionDelayedA) self.toolBarDelayed.addSeparator() self.toolBarDelayed.addAction(self.actionActionDelayedSubA) self.toolBarCheckable.addAction(self.actionActionCheckableA) self.toolBarCheckable.addSeparator() self.toolBarCheckable.addAction(self.actionActionCheckableSubAChecked) self.toolBarCheckable.addAction(self.actionActionCheckableSubAUnchecked) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.lineEdit, self.tabWidget) MainWindow.setTabOrder(self.tabWidget, self.lineEdit_2)
def setupUi(self, Links): Links.setObjectName("Links") Links.resize(594, 577) self.verticalLayout_4 = QtGui.QVBoxLayout(Links) self.verticalLayout_4.setObjectName("verticalLayout_4") self.tabWidget = QtGui.QTabWidget(Links) self.tabWidget.setTabPosition(QtGui.QTabWidget.West) self.tabWidget.setObjectName("tabWidget") self.tab = QtGui.QWidget() self.tab.setObjectName("tab") self.verticalLayout_5 = QtGui.QVBoxLayout(self.tab) self.verticalLayout_5.setObjectName("verticalLayout_5") self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.button_betradar = QtGui.QPushButton(self.tab) self.button_betradar.setObjectName("button_betradar") self.horizontalLayout_4.addWidget(self.button_betradar) self.button_betexplorer = QtGui.QPushButton(self.tab) self.button_betexplorer.setObjectName("button_betexplorer") self.horizontalLayout_4.addWidget(self.button_betexplorer) self.button_previous = QtGui.QPushButton(self.tab) self.button_previous.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/actions/actions/agt_back.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_previous.setIcon(icon) self.button_previous.setObjectName("button_previous") self.horizontalLayout_4.addWidget(self.button_previous) self.button_next = QtGui.QPushButton(self.tab) self.button_next.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/actions/actions/agt_forward.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_next.setIcon(icon1) self.button_next.setFlat(False) self.button_next.setObjectName("button_next") self.horizontalLayout_4.addWidget(self.button_next) self.button_add = QtGui.QPushButton(self.tab) self.button_add.setText("") icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/actions/actions/edit_add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_add.setIcon(icon2) self.button_add.setObjectName("button_add") self.horizontalLayout_4.addWidget(self.button_add) self.line_name = QtGui.QLineEdit(self.tab) self.line_name.setMaximumSize(QtCore.QSize(150, 16777215)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.line_name.setPalette(palette) self.line_name.setObjectName("line_name") self.horizontalLayout_4.addWidget(self.line_name) self.line_url = QtGui.QLineEdit(self.tab) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.line_url.setPalette(palette) self.line_url.setObjectName("line_url") self.horizontalLayout_4.addWidget(self.line_url) self.verticalLayout_5.addLayout(self.horizontalLayout_4) self.label = QtGui.QLabel(self.tab) self.label.setObjectName("label") self.verticalLayout_5.addWidget(self.label) self.webView = QtWebKit.QWebView(self.tab) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.webView.setPalette(palette) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.verticalLayout_5.addWidget(self.webView) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.tree_link_bases = QtGui.QTreeWidget(self.tab) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.tree_link_bases.setPalette(palette) self.tree_link_bases.setObjectName("tree_link_bases") self.tree_link_bases.headerItem().setText(0, "1") self.verticalLayout.addWidget(self.tree_link_bases) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.button_save = QtGui.QPushButton(self.tab) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/actions/actions/filesaveas.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_save.setIcon(icon3) self.button_save.setObjectName("button_save") self.horizontalLayout_2.addWidget(self.button_save) self.line_save = QtGui.QLineEdit(self.tab) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.line_save.setPalette(palette) self.line_save.setInputMask("") self.line_save.setObjectName("line_save") self.horizontalLayout_2.addWidget(self.line_save) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.button_delete = QtGui.QPushButton(self.tab) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/actions/actions/editdelete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_delete.setIcon(icon4) self.button_delete.setObjectName("button_delete") self.horizontalLayout.addWidget(self.button_delete) self.button_load = QtGui.QPushButton(self.tab) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/actions/actions/fileopen.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_load.setIcon(icon5) self.button_load.setObjectName("button_load") self.horizontalLayout.addWidget(self.button_load) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_5.addLayout(self.verticalLayout) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.tree_url = QtGui.QTreeWidget(self.tab) self.tree_url.setMinimumSize(QtCore.QSize(0, 200)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(243, 237, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) self.tree_url.setPalette(palette) self.tree_url.setObjectName("tree_url") self.tree_url.headerItem().setText(0, "1") self.verticalLayout_2.addWidget(self.tree_url) self.button_check = QtGui.QPushButton(self.tab) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(":/actions/actions/reload.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_check.setIcon(icon6) self.button_check.setObjectName("button_check") self.verticalLayout_2.addWidget(self.button_check) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.button_remove = QtGui.QPushButton(self.tab) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(":/actions/actions/edit_remove.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_remove.setIcon(icon7) self.button_remove.setObjectName("button_remove") self.horizontalLayout_3.addWidget(self.button_remove) self.button_clear = QtGui.QPushButton(self.tab) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(":/actions/actions/editclear.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.button_clear.setIcon(icon8) self.button_clear.setObjectName("button_clear") self.horizontalLayout_3.addWidget(self.button_clear) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.verticalLayout_3.addLayout(self.verticalLayout_2) self.horizontalLayout_5.addLayout(self.verticalLayout_3) self.verticalLayout_5.addLayout(self.horizontalLayout_5) self.tabWidget.addTab(self.tab, "") self.verticalLayout_4.addWidget(self.tabWidget) self.retranslateUi(Links) self.tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(Links)
def __init__(self,parent=None): self.kcb=[] self.k_Treturn={} self.k_preset=[] super(checkNodes,self).__init__() self.setupUi(self) self.show() self.scrollArea.setWidgetResizable(True) self.close_Button.clicked.connect(self.close) self.jsDir=json.loads(open(path+'k_enable.json').read(),encoding='gbk') self.checkBoxKeys=self.jsDir.keys() self.checkBoxKeys.sort() self.buttonList=[] self.buttonText=[] for cb in self.checkBoxKeys: button=self.jsDir[cb][3] Text=self.jsDir[cb][4] if not button in self.buttonList: self.buttonList.append(button) self.buttonText.append(Text) self.widgetList=[] self.klayoutList=[] karray = [] karray.append(QtGui.QWidget) self.kopenicon = QtGui.QIcon() self.kopenicon.addPixmap(QtGui.QPixmap(":/newPrefix/icon/kopen.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.kcloseicon = QtGui.QIcon() self.kcloseicon.addPixmap(QtGui.QPixmap(":/newPrefix/icon/kclose.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) for i in range(len(self.buttonList)): self.kframe_1 = QtGui.QFrame(self.scrollAreaWidgetContents) self.kframe_1.setFrameShape(QtGui.QFrame.Box) self.kframe_1.setFrameShadow(QtGui.QFrame.Raised) self.kframe_1.setObjectName(self.buttonList[i]+"kframe_1") self.kQVB_1 = QtGui.QVBoxLayout(self.kframe_1) self.kQVB_1.setObjectName(self.buttonList[i]+"kQVB_1") self.kQVB_1.setContentsMargins(3, 3, 3, 3) self.kQVB_1.setSpacing(2) self.verticalLayout_2.addWidget(self.kframe_1) bt=QtGui.QPushButton() bt.setObjectName(self.buttonList[i]+'_button') bt.setStyleSheet("background-color: #595959;height:20px;border-style:inset;border-width:1px;border-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop:0.5 #616161 stop:1 #616161);font-size: 12px;text-align: left;\n" "") bt.setText(self.buttonText[i]) self.kQVB_1.addWidget(bt) bt.clicked.connect(self.signalEmit) bt.setIcon(self.kopenicon) font = QtGui.QFont() font.setPointSize(12) bt.setFont(font) wd=QtGui.QWidget() wd.setObjectName(self.buttonList[i]+'_widget') self.kQVB_1.addWidget(wd) self.khorizontalLayout = QtGui.QHBoxLayout(wd) self.khorizontalLayout.setObjectName('khorizontalLayout') self.khorizontalLayout.setContentsMargins(0, 0, 0, 0) self.k_frame=QtGui.QFrame(wd) self.k_frame.setObjectName("k_frame") self.k_frame.setFrameShape(QtGui.QFrame.Box) self.k_frame.setFrameShadow(QtGui.QFrame.Sunken) self.khorizontalLayout.addWidget(self.k_frame) self.kverticalLayout = QtGui.QVBoxLayout(self.k_frame) self.kverticalLayout.setObjectName(self.buttonList[i]+"_kverticalLayout") selectAllBt=QtGui.QPushButton() selectAllBt.setObjectName(self.buttonList[i]+'_selAll') selectAllBt.setText(u'全选') selectAllBt.setGeometry(0,0,65,10) selectAllBt.setMinimumSize(QtCore.QSize(65, 10)) selectAllBt.setParent(wd) selectAllBt.clicked.connect(self.signalEmit) cancelAllBt=QtGui.QPushButton() cancelAllBt.setObjectName(self.buttonList[i]+'_canAll') cancelAllBt.setText(u'清除') cancelAllBt.setGeometry(80,0,65,10) cancelAllBt.setMinimumSize(QtCore.QSize(65, 10)) cancelAllBt.setParent(wd) cancelAllBt.clicked.connect(self.signalEmit) kspacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.kHbLayout = QtGui.QHBoxLayout() self.kHbLayout.setObjectName(self.buttonList[i]+"_kHbLayout") self.kHbLayout.addWidget(selectAllBt) self.kHbLayout.addWidget(cancelAllBt) self.kHbLayout.addItem(kspacerItem) self.kverticalLayout.addLayout(self.kHbLayout) self.widgetList.append(wd) self.klayoutList.append(self.kverticalLayout) for n in range(len(self.checkBoxKeys)): for wd in self.klayoutList: if wd.objectName()==self.jsDir[self.checkBoxKeys[n]][3]+'_kverticalLayout': cbwd=wd cb=QtGui.QCheckBox() cb.setMinimumSize(QtCore.QSize(0, 20)) cb.setObjectName(self.jsDir[self.checkBoxKeys[n]][3]+"."+self.checkBoxKeys[n]) cb.setText(self.jsDir[self.checkBoxKeys[n]][2]) cb.setChecked(self.jsDir[self.checkBoxKeys[n]][0]) wd.addWidget(cb) if not self.jsDir[self.checkBoxKeys[n]][1]=='true': cb.setEnabled(0) self.kcb.append(cb) for i in self.kcb: if 'common.' in i.objectName(): pass else: obj = self.findChild(karray[0],i.objectName()) if self.jsDir[obj.objectName().split('.')[-1]][1]=='true': obj.setChecked(0) for i in self.widgetList: if 'common_' in i.objectName(): pass else: io=i.objectName() io=io.split("_")[0] obj = self.findChild(karray[0],i.objectName()) abj = self.findChild(karray[0],(io+'_button')) obj.setVisible(0) abj.setIcon(self.kcloseicon) for klayout in self.klayoutList: kvbspacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) klayout.addItem(kvbspacerItem) spacerItem = QtGui.QSpacerItem(20, 0, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.doIt_Button.clicked.connect(self.kcheckbox) self.someone=Communicate() self.someone.buttonSignal.connect(self.buttonCmd) self.someone.kpreSignal.connect(self.kpresetcommand) self.kpresetbuild()
def __init__(self, parent): """ Create a tab for correcting spectra for radial velocity. :param parent: The parent widget. """ super(RVTab, self).__init__(parent) self.parent = parent # Create the overall RV tab. sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) sp.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sp) # Create a top-level horizontal layout to contain a matplotlib figure and # a vertical layout of settings.. rv_tab_layout = QtGui.QHBoxLayout(self) rv_tab_layout.setContentsMargins(20, 20, 20, 0) # This vertical layout will be for input settings. rv_settings_vbox = QtGui.QVBoxLayout() rv_settings_vbox.setSizeConstraint(QtGui.QLayout.SetMinimumSize) # A two-tab setting for 'template' and 'normalization' settings in the # radial velocity determination. rv_settings_tabs = QtGui.QTabWidget(self) sp = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sp.setHorizontalStretch(0) sp.setVerticalStretch(0) sp.setHeightForWidth(rv_settings_tabs.sizePolicy().hasHeightForWidth()) rv_settings_tabs.setSizePolicy(sp) rv_settings_tabs.setMinimumSize(QtCore.QSize(300, 240)) rv_settings_tabs.setMaximumSize(QtCore.QSize(300, 240)) rv_settings_tabs.setMovable(True) rv_settings_tabs.setObjectName("rv_settings_tabs") # A tab containing template settings. template_tab = QtGui.QWidget() template_tab.setObjectName("tv_template_tab") # TODO: Should template_tab and template_tab_widget actually be one entity? template_tab_widget = QtGui.QWidget(template_tab) template_tab_widget.setGeometry(QtCore.QRect(0, 0, 300, 210)) template_tab_layout = QtGui.QVBoxLayout(template_tab_widget) template_tab_layout.setSizeConstraint( QtGui.QLayout.SetDefaultConstraint) template_tab_layout.setContentsMargins(10, 10, 10, 10) # Add a label at the top of the template settings tab. label = QtGui.QLabel(template_tab_widget) label.setMaximumSize(QtCore.QSize(240, 16777215)) label.setText("Template spectrum filename:") template_tab_layout.addWidget(label) # Inner horizontal layout for the template path and select. template_path_layout = QtGui.QHBoxLayout() # Template path line edit (read-only). self.template_path = QtGui.QLineEdit(template_tab_widget) self.template_path.setObjectName("rv_template_path") self.template_path.setReadOnly(True) template_path_layout.addWidget(self.template_path) # Template path select button. rv_select_template_btn = QtGui.QPushButton(template_tab_widget) rv_select_template_btn.setObjectName("rv_select_template_btn") rv_select_template_btn.setText("...") template_path_layout.addWidget(rv_select_template_btn) # Add this horizontal layout to the template tab. template_tab_layout.addLayout(template_path_layout) # Add a label for the wavelength regions label = QtGui.QLabel(template_tab_widget) label.setMaximumSize(QtCore.QSize(240, 16777215)) label.setText("Wavelength region:") template_tab_layout.addWidget(label) # Wavelength region for CCF. wl_region_layout = QtGui.QHBoxLayout() self.wl_region = QtGui.QComboBox(template_tab_widget) self.wl_region.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.wl_region.setObjectName("rv_wl_region") wl_region_layout.addWidget(self.wl_region) # Edit button for the wavelength regions. rv_wl_region_edit = QtGui.QPushButton(template_tab_widget) rv_wl_region_edit.setMaximumSize(QtCore.QSize(80, 16777215)) rv_wl_region_edit.setObjectName("rv_wl_region_edit") wl_region_layout.addWidget(rv_wl_region_edit) template_tab_layout.addLayout(wl_region_layout) rv_wl_region_edit.setText("Edit list") # Add a horizontal line. hr = QtGui.QFrame(template_tab_widget) hr.setFrameShape(QtGui.QFrame.HLine) hr.setFrameShadow(QtGui.QFrame.Sunken) template_tab_layout.addWidget(hr) # Add a flexible spacer. template_tab_layout.addItem( QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)) # Add a cross-correlate button. rv_cross_correlate_btn = QtGui.QPushButton(template_tab_widget) rv_cross_correlate_btn.setObjectName("rv_cross_correlate_btn") rv_cross_correlate_btn.setText("Cross-correlate") template_tab_layout.addWidget(rv_cross_correlate_btn) # End of the template tab. rv_settings_tabs.addTab(template_tab, "Template") # Start the normalization tab. norm_tab = QtGui.QWidget() norm_tab.setObjectName("rv_normalization_tab") norm_tab_widget = QtGui.QWidget(norm_tab) norm_tab_widget.setGeometry(QtCore.QRect(0, 0, 300, 210)) norm_tab_layout = QtGui.QVBoxLayout(norm_tab_widget) norm_tab_layout.setContentsMargins(10, 10, 10, 10) # Start the grid layout for the normalization tab. norm_tab_grid_layout = QtGui.QGridLayout() # Normalization function. label = QtGui.QLabel(norm_tab_widget) label.setText("Function") norm_tab_grid_layout.addWidget(label, 0, 0, 1, 1) # Put the normalization function combo box in a horizontal layout with a # spacer. hbox = QtGui.QHBoxLayout() hbox.addItem( QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) self.norm_function = QtGui.QComboBox(norm_tab_widget) self.norm_function.setObjectName("rv_norm_function") hbox.addWidget(self.norm_function) norm_tab_grid_layout.addLayout(hbox, 0, 1, 1, 1) norm_functions = ("polynomial", "spline") for each in norm_functions: self.norm_function.addItem(each.title()) # Normalization function order. label = QtGui.QLabel(norm_tab_widget) label.setText("Order") norm_tab_grid_layout.addWidget(label, 1, 0, 1, 1) # Put the normalization order combo box in a horizontal layout with a spacer hbox = QtGui.QHBoxLayout() hbox.addItem( QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) self.norm_order = QtGui.QComboBox(norm_tab_widget) self.norm_order.setMaximumSize(QtCore.QSize(50, 16777215)) self.norm_order.setObjectName("rv_norm_order") hbox.addWidget(self.norm_order) norm_tab_grid_layout.addLayout(hbox, 1, 1, 1, 1) norm_orders = range(1, 10) for order in norm_orders: self.norm_order.addItem("{0:.0f}".format(order)) # Maximum number of iterations. label = QtGui.QLabel(norm_tab_widget) label.setText("Maximum iterations") norm_tab_grid_layout.addWidget(label, 2, 0, 1, 1) # Put the maxium number of iterations in a horizontal layout with a spacer. hbox = QtGui.QHBoxLayout() hbox.addItem( QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) self.norm_max_iter = QtGui.QComboBox(norm_tab_widget) self.norm_max_iter.setMaximumSize(QtCore.QSize(50, 16777215)) self.norm_max_iter.setObjectName("rv_norm_max_iter") hbox.addWidget(self.norm_max_iter) norm_tab_grid_layout.addLayout(hbox, 2, 1, 1, 1) norm_max_iters = range(1, 10) for iteration in norm_max_iters: self.norm_max_iter.addItem("{0:.0f}".format(iteration)) # Low sigma clipping. label = QtGui.QLabel(norm_tab_widget) label.setText("Low sigma clip") norm_tab_grid_layout.addWidget(label, 3, 0, 1, 1) # Put the low sigma line edit box in a horizontal layout with a spacer. hbox = QtGui.QHBoxLayout() hbox.setContentsMargins(-1, -1, 5, -1) hbox.addItem( QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) self.norm_low_sigma = QtGui.QLineEdit(norm_tab_widget) self.norm_low_sigma.setMaximumSize(QtCore.QSize(40, 16777215)) self.norm_low_sigma.setAlignment(QtCore.Qt.AlignCenter) self.norm_low_sigma.setObjectName("rv_norm_low_sigma") self.norm_low_sigma.setValidator( QtGui.QDoubleValidator(0, 1000, 2, self.norm_low_sigma)) hbox.addWidget(self.norm_low_sigma) norm_tab_grid_layout.addLayout(hbox, 3, 1, 1, 1) # High sigma clipping. label = QtGui.QLabel(norm_tab_widget) label.setText("High sigma clip") norm_tab_grid_layout.addWidget(label, 4, 0, 1, 1) # Put the high sigma line edit box in a horizontal layout with a spacer. hbox = QtGui.QHBoxLayout() hbox.setContentsMargins(-1, -1, 5, -1) hbox.addItem( QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) self.norm_high_sigma = QtGui.QLineEdit(norm_tab_widget) self.norm_high_sigma.setMaximumSize(QtCore.QSize(40, 16777215)) self.norm_high_sigma.setAlignment(QtCore.Qt.AlignCenter) self.norm_high_sigma.setObjectName("rv_norm_high_sigma") self.norm_high_sigma.setValidator( QtGui.QDoubleValidator(0, 1000, 2, self.norm_high_sigma)) hbox.addWidget(self.norm_high_sigma) norm_tab_grid_layout.addLayout(hbox, 4, 1, 1, 1) # Knot spacing. label = QtGui.QLabel(norm_tab_widget) norm_tab_grid_layout.addWidget(label, 5, 0, 1, 1) label.setText(u"Knot spacing (Å)") # Put the knot spacing lint edit box in a horizontal layout with a spacer hbox = QtGui.QHBoxLayout() hbox.setContentsMargins(-1, -1, 5, -1) hbox.addItem( QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) self.norm_knot_spacing = QtGui.QLineEdit(norm_tab_widget) self.norm_knot_spacing.setMaximumSize(QtCore.QSize(40, 16777215)) self.norm_knot_spacing.setAlignment(QtCore.Qt.AlignCenter) self.norm_knot_spacing.setObjectName("rv_norm_knot_spacing") self.norm_knot_spacing.setValidator( QtGui.QIntValidator(0, 10000, self.norm_knot_spacing)) hbox.addWidget(self.norm_knot_spacing) norm_tab_grid_layout.addLayout(hbox, 5, 1, 1, 1) # End of the grid in the normalization tab. norm_tab_layout.addLayout(norm_tab_grid_layout) norm_tab_layout.addItem( QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)) rv_settings_tabs.addTab(norm_tab, "Order normalization") rv_settings_vbox.addWidget(rv_settings_tabs) # Horizontal layout for the radial velocity measured/corrected. hbox = QtGui.QHBoxLayout() hbox.setSizeConstraint(QtGui.QLayout.SetMaximumSize) hbox.setContentsMargins(10, 0, 10, -1) label = QtGui.QLabel(self) label.setText("Radial velocity:") hbox.addWidget(label) # Radial velocity measured. self.rv_applied = QtGui.QLineEdit(self) sp = QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed) sp.setHorizontalStretch(0) sp.setVerticalStretch(0) sp.setHeightForWidth(self.rv_applied.sizePolicy().hasHeightForWidth()) self.rv_applied.setSizePolicy(sp) self.rv_applied.setMinimumSize(QtCore.QSize(50, 16777215)) self.rv_applied.setAlignment(QtCore.Qt.AlignCenter) self.rv_applied.setValidator( QtGui.QDoubleValidator(-1e6, 1e6, 2, self.rv_applied)) self.rv_applied.textChanged.connect(self.check_state) self.rv_applied.returnPressed.connect(self.correct_radial_velocity) hbox.addWidget(self.rv_applied) # Units/uncertainty label. label = QtGui.QLabel(self) label.setObjectName("rv_measured_units_label") label.setText("km/s") hbox.addWidget(label) # Correct for radial velocity button. rv_correct_btn = QtGui.QPushButton(self) rv_correct_btn.setObjectName("rv_correct_btn") rv_correct_btn.setText("Correct") hbox.addWidget(rv_correct_btn) rv_settings_vbox.addLayout(hbox) # The cross-correlate and correct button. rv_ccc_btn = QtGui.QPushButton(self) sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sp.setHorizontalStretch(0) sp.setVerticalStretch(0) sp.setHeightForWidth(rv_ccc_btn.sizePolicy().hasHeightForWidth()) rv_ccc_btn.setSizePolicy(sp) rv_ccc_btn.setMinimumSize(QtCore.QSize(300, 0)) rv_ccc_btn.setMaximumSize(QtCore.QSize(300, 16777215)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) rv_ccc_btn.setFont(font) rv_ccc_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) rv_ccc_btn.setDefault(True) rv_ccc_btn.setObjectName("rv_ccc_btn") rv_ccc_btn.setText("Cross-correlate and correct") rv_settings_vbox.addWidget(rv_ccc_btn) # Add a spacer after the big button. rv_settings_vbox.addItem( QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)) rv_tab_layout.addLayout(rv_settings_vbox) # Create a matplotlib widget. self.rv_plot = mpl.MPLWidget(None, tight_layout=True) sp = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sp.setHorizontalStretch(0) sp.setVerticalStretch(0) sp.setHeightForWidth(self.rv_plot.sizePolicy().hasHeightForWidth()) rv_tab_layout.addWidget(self.rv_plot) gs_top = gridspec.GridSpec(3, 1, height_ratios=[2, 1, 1]) gs_top.update(hspace=0) gs_bottom = gridspec.GridSpec(3, 1) self.ax_order = self.rv_plot.figure.add_subplot(gs_top[0]) self.ax_order_norm = self.rv_plot.figure.add_subplot(gs_top[1]) self.ax_ccf = self.rv_plot.figure.add_subplot(gs_bottom[2]) # Pseudo-legend. self.ax_order.text(0.99, 0.9, "Data", color="k", transform=self.ax_order.transAxes, horizontalalignment="right") self.ax_order.text(0.99, 0.8, "Continuum", color="r", transform=self.ax_order.transAxes, horizontalalignment="right") self.ax_order.text(0.99, 0.7, "Template", color="b", transform=self.ax_order.transAxes, horizontalalignment="right") # Ticks, etc self.ax_order.set_xticklabels([]) self.ax_order_norm.set_yticks([0, 1]) self.ax_order_norm.set_ylim(0, 1.2) self.ax_order_norm.set_xlabel(u"Wavelength (Å)") self.ax_order.set_ylabel("Flux") # Draw an initial line for data and continuum. self.ax_order.plot([], [], c='k', drawstyle='steps-mid') self.ax_order.plot([], [], c='r', zorder=2) self.ax_order.set_ylim([0, 1]) self.ax_order_norm.axhline(1, linestyle=":", c="#666666", zorder=-1) self.ax_order_norm.plot([], [], c='k', drawstyle='steps-mid') self.ax_order_norm.plot([], [], c='b') # Template. self.ax_order_norm.set_ylabel("Normalized flux") self.ax_ccf.plot([], [], c='k') self.ax_ccf.set_xlabel("Velocity (km/s)") self.ax_ccf.set_ylabel("CCF") self.ax_ccf.set_yticks([0, 0.5, 1.0]) # Keep an input cache. self._populate_widgets() # Create signals for buttons. rv_cross_correlate_btn.clicked.connect(self.cross_correlate) rv_correct_btn.clicked.connect(self.correct_radial_velocity) rv_ccc_btn.clicked.connect(self.cross_correlate_and_correct) rv_wl_region_edit.clicked.connect(self.launch_rvregion_dialog) # Create signals for when any of these things change. rv_select_template_btn.clicked.connect(self.select_template) self.wl_region.currentIndexChanged.connect(self.update_wl_region) self.norm_low_sigma.textChanged.connect( self.update_normalization_low_sigma) self.norm_high_sigma.textChanged.connect( self.update_normalization_high_sigma) self.norm_knot_spacing.textChanged.connect( self.update_normalization_knot_spacing) self.norm_function.currentIndexChanged.connect( self.update_normalization_function) self.norm_order.currentIndexChanged.connect( self.update_normalization_order) self.norm_max_iter.currentIndexChanged.connect( self.update_normalization_max_iterations) # Update the background to show whether certain items are valid. self.norm_low_sigma.textChanged.connect(self.check_state) self.norm_high_sigma.textChanged.connect(self.check_state) self.norm_knot_spacing.textChanged.connect(self.check_state) # Draw the template straight up if we can. self.draw_template(refresh=True) return None
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(448, 380) self.verticalLayout = QtGui.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName("horizontalLayout_10") self.comboBox = QtGui.QComboBox(Form) self.comboBox.setObjectName("comboBox") self.horizontalLayout_10.addWidget(self.comboBox) self.horizontalLayout_12 = QtGui.QHBoxLayout() self.horizontalLayout_12.setObjectName("horizontalLayout_12") self.pushButton_18 = QtGui.QPushButton(Form) self.pushButton_18.setObjectName("pushButton_18") self.horizontalLayout_12.addWidget(self.pushButton_18) self.pushButton_19 = QtGui.QPushButton(Form) self.pushButton_19.setObjectName("pushButton_19") self.horizontalLayout_12.addWidget(self.pushButton_19) self.horizontalLayout_10.addLayout(self.horizontalLayout_12) self.verticalLayout.addLayout(self.horizontalLayout_10) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton.sizePolicy().hasHeightForWidth()) self.pushButton.setSizePolicy(sizePolicy) self.pushButton.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton.setText("") self.pushButton.setObjectName("pushButton") self.horizontalLayout.addWidget(self.pushButton) self.lineEdit_3 = QtGui.QLineEdit(Form) self.lineEdit_3.setObjectName("lineEdit_3") self.horizontalLayout.addWidget(self.lineEdit_3) self.pushButton_2 = QtGui.QPushButton(Form) self.pushButton_2.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_2.sizePolicy().hasHeightForWidth()) self.pushButton_2.setSizePolicy(sizePolicy) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_14 = QtGui.QHBoxLayout() self.horizontalLayout_14.setObjectName("horizontalLayout_14") self.pushButton_23 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_23.sizePolicy().hasHeightForWidth()) self.pushButton_23.setSizePolicy(sizePolicy) self.pushButton_23.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_23.setText("") self.pushButton_23.setObjectName("pushButton_23") self.horizontalLayout_14.addWidget(self.pushButton_23) self.lineEdit_7 = QtGui.QLineEdit(Form) self.lineEdit_7.setObjectName("lineEdit_7") self.horizontalLayout_14.addWidget(self.lineEdit_7) self.pushButton_24 = QtGui.QPushButton(Form) self.pushButton_24.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_24.sizePolicy().hasHeightForWidth()) self.pushButton_24.setSizePolicy(sizePolicy) self.pushButton_24.setObjectName("pushButton_24") self.horizontalLayout_14.addWidget(self.pushButton_24) self.verticalLayout.addLayout(self.horizontalLayout_14) self.horizontalLayout_15 = QtGui.QHBoxLayout() self.horizontalLayout_15.setObjectName("horizontalLayout_15") self.pushButton_25 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_25.sizePolicy().hasHeightForWidth()) self.pushButton_25.setSizePolicy(sizePolicy) self.pushButton_25.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_25.setText("") self.pushButton_25.setObjectName("pushButton_25") self.horizontalLayout_15.addWidget(self.pushButton_25) self.lineEdit_8 = QtGui.QLineEdit(Form) self.lineEdit_8.setObjectName("lineEdit_8") self.horizontalLayout_15.addWidget(self.lineEdit_8) self.pushButton_26 = QtGui.QPushButton(Form) self.pushButton_26.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_26.sizePolicy().hasHeightForWidth()) self.pushButton_26.setSizePolicy(sizePolicy) self.pushButton_26.setObjectName("pushButton_26") self.horizontalLayout_15.addWidget(self.pushButton_26) self.verticalLayout.addLayout(self.horizontalLayout_15) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.pushButton_9 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_9.sizePolicy().hasHeightForWidth()) self.pushButton_9.setSizePolicy(sizePolicy) self.pushButton_9.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_9.setText("") self.pushButton_9.setObjectName("pushButton_9") self.horizontalLayout_5.addWidget(self.pushButton_9) self.lineEdit = QtGui.QLineEdit(Form) self.lineEdit.setObjectName("lineEdit") self.horizontalLayout_5.addWidget(self.lineEdit) self.pushButton_10 = QtGui.QPushButton(Form) self.pushButton_10.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_10.sizePolicy().hasHeightForWidth()) self.pushButton_10.setSizePolicy(sizePolicy) self.pushButton_10.setObjectName("pushButton_10") self.horizontalLayout_5.addWidget(self.pushButton_10) self.verticalLayout.addLayout(self.horizontalLayout_5) self.horizontalLayout_7 = QtGui.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.pushButton_13 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_13.sizePolicy().hasHeightForWidth()) self.pushButton_13.setSizePolicy(sizePolicy) self.pushButton_13.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_13.setText("") self.pushButton_13.setObjectName("pushButton_13") self.horizontalLayout_7.addWidget(self.pushButton_13) self.lineEdit_2 = QtGui.QLineEdit(Form) self.lineEdit_2.setObjectName("lineEdit_2") self.horizontalLayout_7.addWidget(self.lineEdit_2) self.pushButton_14 = QtGui.QPushButton(Form) self.pushButton_14.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_14.sizePolicy().hasHeightForWidth()) self.pushButton_14.setSizePolicy(sizePolicy) self.pushButton_14.setObjectName("pushButton_14") self.horizontalLayout_7.addWidget(self.pushButton_14) self.verticalLayout.addLayout(self.horizontalLayout_7) self.horizontalLayout_16 = QtGui.QHBoxLayout() self.horizontalLayout_16.setObjectName("horizontalLayout_16") self.pushButton_27 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_27.sizePolicy().hasHeightForWidth()) self.pushButton_27.setSizePolicy(sizePolicy) self.pushButton_27.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_27.setText("") self.pushButton_27.setObjectName("pushButton_27") self.horizontalLayout_16.addWidget(self.pushButton_27) self.lineEdit_9 = QtGui.QLineEdit(Form) self.lineEdit_9.setObjectName("lineEdit_9") self.horizontalLayout_16.addWidget(self.lineEdit_9) self.pushButton_28 = QtGui.QPushButton(Form) self.pushButton_28.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_28.sizePolicy().hasHeightForWidth()) self.pushButton_28.setSizePolicy(sizePolicy) self.pushButton_28.setObjectName("pushButton_28") self.horizontalLayout_16.addWidget(self.pushButton_28) self.verticalLayout.addLayout(self.horizontalLayout_16) self.horizontalLayout_13 = QtGui.QHBoxLayout() self.horizontalLayout_13.setObjectName("horizontalLayout_13") self.pushButton_21 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_21.sizePolicy().hasHeightForWidth()) self.pushButton_21.setSizePolicy(sizePolicy) self.pushButton_21.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_21.setText("") self.pushButton_21.setObjectName("pushButton_21") self.horizontalLayout_13.addWidget(self.pushButton_21) self.lineEdit_6 = QtGui.QLineEdit(Form) self.lineEdit_6.setObjectName("lineEdit_6") self.horizontalLayout_13.addWidget(self.lineEdit_6) self.pushButton_22 = QtGui.QPushButton(Form) self.pushButton_22.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_22.sizePolicy().hasHeightForWidth()) self.pushButton_22.setSizePolicy(sizePolicy) self.pushButton_22.setObjectName("pushButton_22") self.horizontalLayout_13.addWidget(self.pushButton_22) self.verticalLayout.addLayout(self.horizontalLayout_13) self.horizontalLayout_8 = QtGui.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.pushButton_15 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_15.sizePolicy().hasHeightForWidth()) self.pushButton_15.setSizePolicy(sizePolicy) self.pushButton_15.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_15.setText("") self.pushButton_15.setObjectName("pushButton_15") self.horizontalLayout_8.addWidget(self.pushButton_15) self.lineEdit_4 = QtGui.QLineEdit(Form) self.lineEdit_4.setObjectName("lineEdit_4") self.horizontalLayout_8.addWidget(self.lineEdit_4) self.pushButton_16 = QtGui.QPushButton(Form) self.pushButton_16.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_16.sizePolicy().hasHeightForWidth()) self.pushButton_16.setSizePolicy(sizePolicy) self.pushButton_16.setObjectName("pushButton_16") self.horizontalLayout_8.addWidget(self.pushButton_16) self.verticalLayout.addLayout(self.horizontalLayout_8) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.pushButton_11 = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_11.sizePolicy().hasHeightForWidth()) self.pushButton_11.setSizePolicy(sizePolicy) self.pushButton_11.setMinimumSize(QtCore.QSize(0, 0)) self.pushButton_11.setText("") self.pushButton_11.setObjectName("pushButton_11") self.horizontalLayout_6.addWidget(self.pushButton_11) self.lineEdit_5 = QtGui.QLineEdit(Form) self.lineEdit_5.setObjectName("lineEdit_5") self.horizontalLayout_6.addWidget(self.lineEdit_5) self.pushButton_12 = QtGui.QPushButton(Form) self.pushButton_12.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pushButton_12.sizePolicy().hasHeightForWidth()) self.pushButton_12.setSizePolicy(sizePolicy) self.pushButton_12.setObjectName("pushButton_12") self.horizontalLayout_6.addWidget(self.pushButton_12) self.verticalLayout.addLayout(self.horizontalLayout_6) self.horizontalLayout_11 = QtGui.QHBoxLayout() self.horizontalLayout_11.setObjectName("horizontalLayout_11") self.pushButton_20 = QtGui.QPushButton(Form) self.pushButton_20.setObjectName("pushButton_20") self.horizontalLayout_11.addWidget(self.pushButton_20) self.pushButton_17 = QtGui.QPushButton(Form) self.pushButton_17.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.pushButton_17.setObjectName("pushButton_17") self.horizontalLayout_11.addWidget(self.pushButton_17) self.verticalLayout.addLayout(self.horizontalLayout_11) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, obj_to_attach, take_selection=False, create_transaction=True, callback_OK=None, callback_Cancel=None, callback_Apply=None): self.__define_attributes() self.create_transaction = create_transaction self.callback_OK = callback_OK self.callback_Cancel = callback_Cancel self.callback_Apply = callback_Apply self.obj = obj_to_attach try: if not self.obj.hasExtension('Part::AttachExtension'): self.obj.addExtension('Part::AttachExtensionPython') except Exception: pass if hasattr(obj_to_attach, 'Attacher'): self.attacher = obj_to_attach.Attacher elif hasattr(obj_to_attach, 'AttacherType'): self.attacher = Part.AttachEngine(obj_to_attach.AttacherType) else: movable = True if not hasattr(self.obj, "Placement"): movable = False if 'Hidden' in self.obj.getEditorMode( "Placement") or 'ReadOnly' in self.obj.getEditorMode( "Placement"): movable = False if not movable: if self.callback_Cancel: self.callback_Cancel() raise ValueError( _translate( 'AttachmentEditor', "Object {name} is neither movable nor attachable, can't edit attachment", None).format(name=self.obj.Label)) self.obj_is_attachable = False self.attacher = Part.AttachEngine() mb = QtGui.QMessageBox() mb.setIcon(mb.Icon.Warning) mb.setText( _translate( 'AttachmentEditor', "{obj} is not attachable. You can still use attachment editor dialog to align the object, but the attachment won't be parametric.", None).format(obj=obj_to_attach.Label)) mb.setWindowTitle( _translate('AttachmentEditor', "Attachment", None)) btnAbort = mb.addButton(QtGui.QMessageBox.StandardButton.Abort) btnOK = mb.addButton( _translate('AttachmentEditor', "Continue", None), QtGui.QMessageBox.ButtonRole.ActionRole) mb.setDefaultButton(btnOK) mb.exec_() if mb.clickedButton() is btnAbort: if self.callback_Cancel: self.callback_Cancel() raise CancelError() import os self.form = uic.loadUi( os.path.dirname(__file__) + os.path.sep + 'TaskAttachmentEditor.ui') self.form.setWindowIcon( QtGui.QIcon(':/icons/tools/Part_Attachment.svg')) self.form.setWindowTitle( _translate('AttachmentEditor', "Attachment", None)) self.form.attachmentOffsetX.setProperty("unit", "mm") self.form.attachmentOffsetY.setProperty("unit", "mm") self.form.attachmentOffsetZ.setProperty("unit", "mm") Gui.ExpressionBinding(self.form.attachmentOffsetX).bind( self.obj, "AttachmentOffset.Base.x") Gui.ExpressionBinding(self.form.attachmentOffsetY).bind( self.obj, "AttachmentOffset.Base.y") Gui.ExpressionBinding(self.form.attachmentOffsetZ).bind( self.obj, "AttachmentOffset.Base.z") Gui.ExpressionBinding(self.form.attachmentOffsetYaw).bind( self.obj, "AttachmentOffset.Rotation.Yaw") Gui.ExpressionBinding(self.form.attachmentOffsetPitch).bind( self.obj, "AttachmentOffset.Rotation.Pitch") Gui.ExpressionBinding(self.form.attachmentOffsetRoll).bind( self.obj, "AttachmentOffset.Rotation.Roll") self.refLines = [ self.form.lineRef1, self.form.lineRef2, self.form.lineRef3, self.form.lineRef4 ] self.refButtons = [ self.form.buttonRef1, self.form.buttonRef2, self.form.buttonRef3, self.form.buttonRef4 ] self.attachmentOffsetEdits = [ self.form.attachmentOffsetX, self.form.attachmentOffsetY, self.form.attachmentOffsetZ, self.form.attachmentOffsetYaw, self.form.attachmentOffsetPitch, self.form.attachmentOffsetRoll ] self.block = False for i in range(len(self.refLines)): QtCore.QObject.connect( self.refLines[i], QtCore.SIGNAL('textEdited(QString)'), lambda txt, i=i: self.lineRefChanged(i, txt)) for i in range(len(self.refLines)): QtCore.QObject.connect(self.refButtons[i], QtCore.SIGNAL('clicked()'), lambda i=i: self.refButtonClicked(i)) for i in range(len(self.attachmentOffsetEdits)): QtCore.QObject.connect( self.attachmentOffsetEdits[i], QtCore.SIGNAL('valueChanged(double)'), lambda val, i=i: self.attachmentOffsetChanged(i, val)) QtCore.QObject.connect(self.form.checkBoxFlip, QtCore.SIGNAL('clicked()'), self.checkBoxFlipClicked) QtCore.QObject.connect(self.form.listOfModes, QtCore.SIGNAL('itemSelectionChanged()'), self.modeSelected) if self.create_transaction: self.obj.Document.openTransaction( _translate('AttachmentEditor', "Edit attachment of {feat}", None).format(feat=self.obj.Name)) self.readParameters() if len(self.attacher.References) == 0 and take_selection: sel = GetSelectionAsLinkSubList() for i in range(len(sel))[::-1]: if sel[i][0] is obj_to_attach: sel.pop(i) self.attacher.References = sel # need to update textboxes self.fillAllRefLines() if len(self.attacher.References) == 0: self.i_active_ref = 0 self.auto_next = True else: self.i_active_ref = -1 self.auto_next = False Gui.Selection.addObserver(self) self.updatePreview() self.updateRefButtons() self.tv = TempoVis(self.obj.Document, tag="PartGui.TaskAttachmentEditor") if self.tv: # tv will still be None if Show module is unavailable self.tv.hide_all_dependent(self.obj) self.tv.show(self.obj) self.tv.setUnpickable(self.obj) self.tv.modifyVPProperty(self.obj, "Transparency", 70) self.tv.show([obj for (obj, subname) in self.attacher.References])
def qCleanupResources(): QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
def textSize(self): return QtCore.QSizeF(self.__textItem.textWidth(), self.__font.pointSizeF())
def GetResources(self): return {'Pixmap' : 'GDMLTubeFeature', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDMLTubeFeature',\ 'Tube Object'), 'ToolTip': \ QtCore.QT_TRANSLATE_NOOP('GDMLTubeFeature',\ 'Tube Object')}
def qInitResources(): QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
class Communicate(QtCore.QObject): buttonSignal=QtCore.Signal(QtGui.QWidget) kpreSignal=QtCore.Signal(QtGui.QWidget)
def GetResources(self): return {'Pixmap' : 'GDML_Mesh2Tess', 'MenuText': \ QtCore.QT_TRANSLATE_NOOP('GDML_TessGroup',\ 'Mesh 2 Tess'), 'Mesh 2 Tess': \ QtCore.QT_TRANSLATE_NOOP('GDML_TessyGroup', \ 'Create GDML Tessellate from FC Mesh')}
def setupActions(self): self.playAction = QtGui.QAction( self.style().standardIcon(QtGui.QStyle.SP_MediaPlay), self.tr("Play"), self) self.playAction.setShortcut(self.tr("Crl+P")) self.playAction.setDisabled(True) self.pauseAction = QtGui.QAction( self.style().standardIcon(QtGui.QStyle.SP_MediaPause), self.tr("Pause"), self) self.pauseAction.setShortcut(self.tr("Ctrl+A")) self.pauseAction.setDisabled(True) self.stopAction = QtGui.QAction( self.style().standardIcon(QtGui.QStyle.SP_MediaStop), self.tr("Stop"), self) self.stopAction.setShortcut(self.tr("Ctrl+S")) self.stopAction.setDisabled(True) self.nextAction = QtGui.QAction( self.style().standardIcon(QtGui.QStyle.SP_MediaSkipForward), self.tr("Next"), self) self.nextAction.setShortcut(self.tr("Ctrl+N")) self.previousAction = QtGui.QAction( self.style().standardIcon(QtGui.QStyle.SP_MediaSkipBackward), self.tr("Previous"), self) self.previousAction.setShortcut(self.tr("Ctrl+R")) self.addFilesAction = QtGui.QAction(self.tr("Add &Files"), self) self.addFilesAction.setShortcut(self.tr("Ctrl+F")) self.exitAction = QtGui.QAction(self.tr("E&xit"), self) self.exitAction.setShortcut(self.tr("Ctrl+X")) self.aboutAction = QtGui.QAction(self.tr("A&bout"), self) self.aboutAction.setShortcut(self.tr("Ctrl+B")) self.aboutQtAction = QtGui.QAction(self.tr("About &Qt"), self) self.aboutQtAction.setShortcut(self.tr("Ctrl+Q")) self.connect(self.playAction, QtCore.SIGNAL('triggered()'), self.mediaObject, QtCore.SLOT('play()')) self.connect(self.pauseAction, QtCore.SIGNAL('triggered()'), self.mediaObject, QtCore.SLOT('pause()')) self.connect(self.stopAction, QtCore.SIGNAL('triggered()'), self.mediaObject, QtCore.SLOT('stop()')) self.connect(self.addFilesAction, QtCore.SIGNAL('triggered()'), self.addFiles) self.connect(self.exitAction, QtCore.SIGNAL('triggered()'), self, QtCore.SLOT('close()')) self.connect(self.aboutAction, QtCore.SIGNAL('triggered()'), self.about) self.connect(self.aboutQtAction, QtCore.SIGNAL('triggered()'), QtGui.qApp, QtCore.SLOT('aboutQt()'))