def toside(self): screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() # self.move((screen.width()-size.width()) , (screen.height()-size.height())) self.setGeometry((screen.width() - size.width()) + 320, (screen.height() - size.height()) - 130, 200, 390)
def center(self): screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
def __init__(self, parent, appName, argTemplate, account, server, ticket, chatServer, language, runDir, wineProgram, wineDebug, winePrefix, hiResEnabled, wineApp, osType, homeDir, icoFileIn, rootDir): self.winMain = parent self.homeDir = homeDir self.winLog = QtGui.QDialog(parent) self.osType = osType uifile = None icofile = None try: from pkg_resources import resource_filename uifile = resource_filename(__name__, 'ui/winLog.ui') icofile = resource_filename(__name__, icoFileIn) except: uifile = os.path.join(rootDir, "ui", "winLog.ui") icofile = os.path.join(rootDir, icoFileIn) Ui_winLog, base_class = uic.loadUiType(uifile) self.uiLog = Ui_winLog() self.uiLog.setupUi(self.winLog) self.winLog.setWindowFlags(QtCore.Qt.Dialog) self.winLog.setWindowIcon(QtGui.QIcon(icofile)) screen = QtGui.QDesktopWidget().screenGeometry() size = self.winLog.geometry() self.winLog.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) if self.osType.usingWindows: self.winLog.setWindowTitle("Output") else: if wineApp == "Wine": self.winLog.setWindowTitle("Launch Game - Wine output") else: self.winLog.setWindowTitle("Launch Game - Crossover output") #self.uiLog.btnStart.setVisible(False) self.uiLog.btnStart.setText("Launcher") self.uiLog.btnStart.setEnabled(False) self.uiLog.btnSave.setText("Save") self.uiLog.btnSave.setEnabled(False) self.uiLog.btnStop.setText("Exit") QtCore.QObject.connect(self.uiLog.btnStart, QtCore.SIGNAL("clicked()"), self.btnStartClicked) QtCore.QObject.connect(self.uiLog.btnSave, QtCore.SIGNAL("clicked()"), self.btnSaveClicked) QtCore.QObject.connect(self.uiLog.btnStop, QtCore.SIGNAL("clicked()"), self.btnStopClicked) self.aborted = False self.finished = False self.command = "" self.arguments = [] gameParams = argTemplate.replace("{SUBSCRIPTION}", account).replace( "{LOGIN}", server).replace("{GLS}", ticket).replace( "{CHAT}", chatServer).replace("{LANG}", language) if not hiResEnabled: gameParams = gameParams + " --HighResOutOfDate" if wineDebug != "": os.environ["WINEDEBUG"] = wineDebug if winePrefix != "" and wineApp == "Wine": os.environ["WINEPREFIX"] = winePrefix self.process = QtCore.QProcess() QtCore.QObject.connect(self.process, QtCore.SIGNAL("readyReadStandardOutput()"), self.readOutput) QtCore.QObject.connect(self.process, QtCore.SIGNAL("readyReadStandardError()"), self.readErrors) QtCore.QObject.connect( self.process, QtCore.SIGNAL("finished(int, QProcess::ExitStatus)"), self.resetButtons) if wineApp == "Native": self.command = appName self.process.setWorkingDirectory(runDir) os.chdir(runDir) for arg in gameParams.split(" "): self.arguments.append(arg) elif wineApp == "Wine": self.command = wineProgram self.process.setWorkingDirectory(runDir) self.arguments.append(appName) for arg in gameParams.split(" "): self.arguments.append(arg) elif wineApp == "CXGames": if not self.osType.startCXG(): self.uiLog.txtLog.append( "<b>Error: Couldn't start Crossover Games</b>") self.uiLog.btnSave.setEnabled(False) self.uiLog.btnStart.setEnabled(False) if self.osType.macPathCX == "": tempFile = "%s%s%s" % (self.osType.globalDir, self.osType.directoryCXG, wineProgram) if os.path.isfile(tempFile): self.command = tempFile else: tempFile = "%s%s%s" % (homeDir, self.osType.directoryCXG, wineProgram) if os.path.isfile(tempFile): self.command = tempFile else: self.command = wineProgram else: self.command = "%s%s" % (self.osType.macPathCX, wineProgram) self.process.setWorkingDirectory(runDir) tempArg = "--bottle %s --verbose -- %s %s" % (winePrefix, appName, gameParams) for arg in tempArg.split(" "): self.arguments.append(arg) elif wineApp == "CXOffice": if not self.osType.startCXO(): self.uiLog.txtLog.append( "<b>Error: Couldn't start Crossover</b>") self.uiLog.btnSave.setEnabled(False) self.uiLog.btnStart.setEnabled(False) if self.osType.macPathCX == "": tempFile = "%s%s%s" % (self.osType.globalDir, self.osType.directoryCXO, wineProgram) if os.path.isfile(tempFile): self.command = tempFile else: tempFile = "%s%s%s" % (homeDir, self.osType.directoryCXO, wineProgram) if os.path.isfile(tempFile): self.command = tempFile else: self.command = wineProgram else: self.command = "%s%s" % (self.osType.macPathCX, wineProgram) self.process.setWorkingDirectory(runDir) tempArg = "--bottle %s --verbose -- %s %s" % (winePrefix, appName, gameParams) for arg in tempArg.split(" "): self.arguments.append(arg)
def center(self): qr = self.frameGeometry() cp = QtGui.QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft())
def position(self): screen = QtGui.QDesktopWidget().screenGeometry() x = (screen.width() - self.geometry().width()) / 2 y = (screen.height() - self.geometry().height()) / 2 self.move(x, y)
def __init__(self): QtGui.QMainWindow.__init__(self) #Dimensiones originales size_x_Original = 1080 size_y_Original = 1920 #Clicked button self.p = 1.15 self.b = 0.95 #Flags Vista 2 self.IsChecked = [['Red', False], ['Pink', False], ['Blue', False], ['Black', False], ['Yellow', False]] #Direcciones de Imágenes de fondo self.MAIN_VIEW = "src/img/ArtesPowerRangers/Pantalla 1/1.jpg" self.VIEW_2 = "src/img/ArtesPowerRangers/Pantalla 2/1 Back.jpg" self.VIEW_3 = "src/img/ArtesPowerRangers/Pantalla 3/1 Back.jpg" self.VIEW_5 = "src/img/ArtesPowerRangers/Pantalla 5/Back5.jpg" self.VIEW_6 = "src/img/ArtesPowerRangers/Pantalla 7/Back-7.jpg" #Direcciones Caras Vista 3 self.URL_FACES = [ "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Red.jpg", "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Pink.jpg", "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Blue.jpg", "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Black.jpg", "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Yellow.jpg" ] self.RED = "src/img/ArtesPowerRangers/Pantalla 2/Red.jpg" self.RED_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/red_blocked.png" self.BLUE = "src/img/ArtesPowerRangers/Pantalla 2/Blue.jpg" self.BLUE_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/azul_blocked.png" self.BLACK = "src/img/ArtesPowerRangers/Pantalla 2/black.jpg" self.BLACK_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/black_blocked.png" self.PINK = "src/img/ArtesPowerRangers/Pantalla 2/pink.jpg" self.PINK_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/pink_blocked.png" self.YELLOW = "src/img/ArtesPowerRangers/Pantalla 2/yellow.jpg" self.YELLOW_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/yellow_blocked.png" self.GIF = "src/img/gif_red.gif" self.PASS_MAIL = "aradmagol" self.MAIL = "*****@*****.**" # Se monta la interfaz de usuario para la pantalla principal self.ui = uic.loadUi("views/main.ui") #Se bloquea el marco superior self.ui.setWindowFlags(self.ui.windowFlags() | QtCore.Qt.CustomizeWindowHint) self.ui.setWindowFlags(self.ui.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint) #Full Screen self.ui.showFullScreen() screen = QtGui.QDesktopWidget().screenGeometry() #Dimensiones de la pantalla self.size_x = screen.width() self.size_y = screen.height() #Relación imagen/pantalla rel_x = float(self.size_x) / float(size_x_Original) rel_y = float(self.size_y) / float(size_y_Original) #----------Vista 1--------------- #Se carga la imagen principal palette = QPalette() palette.setBrush( QPalette.Background, QBrush(QPixmap(self.MAIN_VIEW).scaled(self.size_x, self.size_y))) self.ui.setPalette(palette) #Vista de inicio self.ui.setCurrentWidget(self.ui.View1) #----------Bóton Inicio----------- nx = self.ui.inicio_btn.width() * rel_x ny = self.ui.inicio_btn.height() * rel_y self.ui.inicio_btn.resize(int(nx), int(ny)) self.ui.inicio_btn.move(int(self.size_x / 2 - nx / 2), int(7 * self.size_y / 8)) self.ui.inicio_btn.mousePressEvent = self.pressStartV1 self.ui.inicio_btn.mouseReleaseEvent = self.releaseStartV1 #---------------------------------- #-----------Vista 2---------------- #-----------Título----------------- tx = self.ui.title_v2.width() * rel_x ty = self.ui.title_v2.height() * rel_y self.ui.title_v2.resize(int(tx), int(ty)) self.ui.title_v2.move(int(self.size_x / 2 - tx / 2), int(self.size_y / 10)) #----------Bóton Ranger Azul------- y_init = 403 * rel_y brx = self.ui.blue_ranger.width() * rel_x bry = self.ui.blue_ranger.height() * rel_y self.ui.blue_ranger.resize(int(brx), int(bry)) self.ui.blue_ranger.move(int(self.size_x / 2 - brx / 2), int(y_init)) self.ui.blue_ranger.mousePressEvent = self.pressBlue #----------Bóton Ranger Rosa----------- self.ui.pink_ranger.resize(int(brx), int(bry)) self.ui.pink_ranger.move(int(self.size_x / 2 - brx / 2), int(y_init + bry)) self.ui.pink_ranger.mousePressEvent = self.pressPink #----------Bóton Ranger Rojo----------- self.ui.red_ranger.resize(int(brx), int(bry)) self.ui.red_ranger.move(int(self.size_x / 2 - brx / 2), int(y_init + 2 * bry)) self.ui.red_ranger.mousePressEvent = self.pressRed #----------Bóton Ranger Amarillo----------- self.ui.yellow_ranger.resize(int(brx), int(bry)) self.ui.yellow_ranger.move(int(self.size_x / 2 - brx / 2), int(y_init + 3 * bry)) self.ui.yellow_ranger.mousePressEvent = self.pressYellow #----------Bóton Ranger Negro----------- self.ui.black_ranger.resize(int(brx), int(bry)) self.ui.black_ranger.move(int(self.size_x / 2 - brx / 2), int(y_init + 4 * bry)) self.ui.black_ranger.mousePressEvent = self.pressBlack #----------Botón Continuar------------- self.y_init_btn = 1700 * rel_y c2x = self.ui.continue_btn.width() * rel_x c2y = self.ui.continue_btn.height() * rel_y self.ui.continue_btn.resize(int(c2x), int(c2y)) self.ui.continue_btn.move(int(self.size_x / 2 - c2x / 2), int(self.y_init_btn)) self.ui.continue_btn.mousePressEvent = self.pressContinueV2 self.ui.continue_btn.mouseReleaseEvent = self.releaseContinueV2 #-------------------------------------- #Se guarda el tamaño original del botón self.x_red = self.ui.red_ranger.width() self.y_red = self.ui.red_ranger.height() #Se guarda el tamaño original del botón self.x_black = self.ui.black_ranger.width() self.y_black = self.ui.black_ranger.height() #Se guarda el tamaño original del botón self.x_pink = self.ui.pink_ranger.width() self.y_pink = self.ui.pink_ranger.height() #Se guarda el tamaño original del botón self.x_blue = self.ui.blue_ranger.width() self.y_blue = self.ui.blue_ranger.height() #Se guarda el tamaño original del botón self.x_yellow = self.ui.yellow_ranger.width() self.y_yellow = self.ui.yellow_ranger.height() #------------Vista 3-------------- #-----------Título----------------- self.t3x = self.ui.title_v3.width() * rel_x t3y = self.ui.title_v3.height() * rel_y self.ui.title_v3.resize(int(self.t3x), int(t3y)) self.ui.title_v3.move(int(self.size_x / 2 - self.t3x / 2), int(self.size_y / 9)) self.fx = self.ui.photo_ranger.width() * rel_x fy = self.ui.photo_ranger.height() * rel_y self.ui.photo_ranger.resize(int(self.fx), int(fy)) self.ui.photo_ranger.move(int(self.size_x / 2 - self.fx / 2), int(self.size_y / 6)) self.name_x = self.ui.name_v3.width() * rel_x self.name_y = self.ui.name_v3.height() * rel_y self.ui.name_v3.resize(int(self.name_x), int(self.name_y)) self.ui.name_v3.move(int(self.size_x / 2 - self.name_x / 2), int(self.size_y / 2 + 2 * self.name_y)) #--------------Keyboard----------- self.promptTex = "" self.ui.keyboard.move( int(self.size_x / 2 - self.ui.keyboard.width() / 2), int(self.size_y / 2)) self.ui.key_a.mouseReleaseEvent = self.key_a self.ui.key_b.mouseReleaseEvent = self.key_b self.ui.key_c.mouseReleaseEvent = self.key_c self.ui.key_d.mouseReleaseEvent = self.key_d self.ui.key_e.mouseReleaseEvent = self.key_e self.ui.key_f.mouseReleaseEvent = self.key_f self.ui.key_g.mouseReleaseEvent = self.key_g self.ui.key_h.mouseReleaseEvent = self.key_h self.ui.key_i.mouseReleaseEvent = self.key_i self.ui.key_j.mouseReleaseEvent = self.key_j self.ui.key_k.mouseReleaseEvent = self.key_k self.ui.key_l.mouseReleaseEvent = self.key_l self.ui.key_m.mouseReleaseEvent = self.key_m self.ui.key_n.mouseReleaseEvent = self.key_n self.ui.key_o.mouseReleaseEvent = self.key_o self.ui.key_p.mouseReleaseEvent = self.key_p self.ui.key_q.mouseReleaseEvent = self.key_q self.ui.key_r.mouseReleaseEvent = self.key_r self.ui.key_s.mouseReleaseEvent = self.key_s self.ui.key_t.mouseReleaseEvent = self.key_t self.ui.key_u.mouseReleaseEvent = self.key_u self.ui.key_v.mouseReleaseEvent = self.key_v self.ui.key_w.mouseReleaseEvent = self.key_w self.ui.key_x.mouseReleaseEvent = self.key_x self.ui.key_y.mouseReleaseEvent = self.key_y self.ui.key_z.mouseReleaseEvent = self.key_z self.ui.key_1.mouseReleaseEvent = self.key_1 self.ui.key_2.mouseReleaseEvent = self.key_2 self.ui.key_3.mouseReleaseEvent = self.key_3 self.ui.key_4.mouseReleaseEvent = self.key_4 self.ui.key_5.mouseReleaseEvent = self.key_5 self.ui.key_6.mouseReleaseEvent = self.key_6 self.ui.key_7.mouseReleaseEvent = self.key_7 self.ui.key_8.mouseReleaseEvent = self.key_8 self.ui.key_9.mouseReleaseEvent = self.key_9 self.ui.key_0.mouseReleaseEvent = self.key_0 self.ui.key_punto.mouseReleaseEvent = self.key_punto self.ui.key_puntocoma.mouseReleaseEvent = self.key_puntocoma self.ui.key_coma.mouseReleaseEvent = self.key_coma self.ui.key_space.mouseReleaseEvent = self.key_space self.ui.key_money.mouseReleaseEvent = self.key_money self.ui.key_cs.mouseReleaseEvent = self.key_cs self.ui.key_cc.mouseReleaseEvent = self.key_cc self.ui.key_guionbajo.mouseReleaseEvent = self.key_guion_bajo self.ui.key_guion.mouseReleaseEvent = self.key_guion_alto self.ui.key_admirar.mouseReleaseEvent = self.key_admiracion self.ui.key_porcentage.mouseReleaseEvent = self.key_porcentaje self.ui.key_arroba.mouseReleaseEvent = self.key_arroba self.ui.key_number.mouseReleaseEvent = self.key_number self.ui.key_delete.mouseReleaseEvent = self.key_delete #-------------Continuar----------- self.c3x = self.ui.continue_btn_V3.width() * rel_x c3y = self.ui.continue_btn_V3.height() * rel_y self.ui.continue_btn_V3.resize(int(self.c3x), int(c3y)) self.ui.continue_btn_V3.move(int(self.size_x / 2 - self.c3x / 2), int(self.y_init_btn)) self.ui.continue_btn_V3.mousePressEvent = self.pressContinueV3 self.ui.continue_btn_V3.mouseReleaseEvent = self.releaseContinueV3 #--------------Atrás-------------- self.ax = self.ui.cancelar.width() * rel_x ay = self.ui.cancelar.height() * rel_y self.ui.cancelar.resize(int(self.ax), int(ay)) self.ui.cancelar.move(int(self.size_x / 25), int(self.y_init_btn)) self.ui.cancelar.mousePressEvent = self.pressCancelar self.ui.cancelar.mouseReleaseEvent = self.releaseCancelar self.firstTime = False #--------------Vista 5--------------- #------------Muestra GIF------------- altura_gif = 350 * rel_y gif_x = self.ui.the_gif.width() * rel_x gif_y = self.ui.the_gif.height() * rel_y self.ui.the_gif.resize(int(gif_x), int(gif_y)) self.ui.the_gif.move(int(self.size_x / 2 - gif_x / 2), int(altura_gif)) #--------------Marco----------------- altura_mark = 1250 * rel_y mark_x = self.ui.cuadro.width() * rel_x mark_y = self.ui.cuadro.height() * rel_y self.ui.cuadro.resize(int(mark_x), int(mark_y)) self.ui.cuadro.move(int(self.size_x / 2 - mark_x / 2), int(altura_mark)) #-----------Atrás botón-------------- altura_atras = 1350 * rel_y base_atras = 130 * rel_x atras_x = self.ui.atras.width() * rel_x atras_y = self.ui.atras.height() * rel_y self.ui.atras.resize(int(atras_x), int(atras_y)) self.ui.atras.move(int(base_atras), int(altura_atras)) self.ui.atras.mousePressEvent = self.pressAtrasV5 self.ui.atras.mouseReleaseEvent = self.releaseAtrasV5 #-----------Continuar botón-------------- base_con = 575 * rel_x con_x = self.ui.continuar_V5.width() * rel_x con_y = self.ui.continuar_V5.height() * rel_y self.ui.continuar_V5.resize(int(con_x), int(con_y)) self.ui.continuar_V5.move(int(base_con), int(altura_atras)) self.ui.continuar_V5.mousePressEvent = self.pressContinueV5 self.ui.continuar_V5.mouseReleaseEvent = self.releaseContinueV5 #Posiciones de los botones self.positionV2 = self.ui.continue_btn.pos() self.positionV3 = self.ui.continue_btn_V3.pos() self.positionV5 = self.ui.continuar_V5.pos() self.positionAtras = self.ui.atras.pos() self.positionCancelar = self.ui.cancelar.pos() #------------Vista 6--------------- #------------Muestra GIF------------- self.altura_gif2 = 170 * rel_y self.gif2_x = self.ui.the_gif_validate.width() * rel_x gif2_y = self.ui.the_gif_validate.height() * rel_y self.ui.the_gif_validate.resize(int(self.gif2_x), int(gif2_y)) self.ui.the_gif_validate.move(int(self.size_x / 2 - self.gif2_x / 2), int(self.altura_gif2)) #----------Escribe Correo------------- self.altura_mail = 990 * rel_y self.mail_x = self.ui.title_V6.width() * rel_x mail_y = self.ui.title_V6.height() * rel_y self.ui.title_V6.resize(int(self.mail_x), int(mail_y)) self.ui.title_V6.move(int(self.size_x / 2 - self.mail_x / 2), int(self.altura_mail)) #----------Acepto?------------- self.altura_acepto = 1650 * rel_y self.acepto_x = self.ui.acepto.width() * rel_x acepto_y = self.ui.acepto.height() * rel_y self.ui.acepto.resize(int(self.acepto_x), int(acepto_y)) self.ui.acepto.move(int(self.size_x / 2 - self.acepto_x / 2), int(self.altura_acepto)) #Bandera para el uso del teclado :) self.flag_Key = 3 #La vista 3 es la original #Botón pantalla completa self.ui.next_btn.resize(self.size_x, self.size_y) self.ui.next_btn.move(0, 0) self.ui.next_btn.mousePressEvent = self.restart #Nombre self.name = "" #Correo self.email = "" self.ui.show()
def __initUI(self): """ Initialize the GUI """ # Layout layout = QtGui.QVBoxLayout() self.__mainWidget = QtGui.QWidget() self.__mainWidget.setLayout(layout) self.setCentralWidget(self.__mainWidget) # Browse images button hLayout = QtGui.QHBoxLayout() label = QtGui.QLabel(u"Image :") self.__imageLabel = QtGui.QLabel("aucune") hLayout.addWidget(label) hLayout.addStretch(1) hLayout.addWidget(self.__imageLabel) layout.addLayout(hLayout) self.__imageButton = QtGui.QPushButton(u"Choisir une image") layout.addWidget(self.__imageButton) # Surface width input self.__widthInput = QtGui.QDoubleSpinBox() self.__widthInput.setDecimals(0) self.__widthInput.setMinimum(50) self.__widthInput.setMaximum(1000) self.__widthInput.setValue(PROFILE_AREA_WIDTH) hLayout = QtGui.QHBoxLayout() label = QtGui.QLabel(u"Largeur de la forme (px) :") hLayout.addWidget(label) hLayout.addStretch(1) hLayout.addWidget(self.__widthInput) layout.addLayout(hLayout) # Threshold input self.__thresholdInput = QtGui.QDoubleSpinBox() self.__widthInput.setDecimals(0) self.__thresholdInput.setMinimum(0) self.__thresholdInput.setMaximum(300) self.__thresholdInput.setValue(COLOR_THRESHOLD) hLayout = QtGui.QHBoxLayout() label = QtGui.QLabel(u"Tolérance de détection des couleurs :") hLayout.addWidget(label) hLayout.addStretch(1) hLayout.addWidget(self.__thresholdInput) layout.addLayout(hLayout) # Preview image self.__previewImage = QtGui.QLabel() self.__previewImage.setPixmap( QtGui.QPixmap(PROFILE_AREA_WIDTH, PROFILE_AREA_WIDTH)) label = QtGui.QLabel(u"Forme détectée :") hLayout = QtGui.QHBoxLayout() layout.addWidget(label) hLayout.addStretch(1) hLayout.addWidget(self.__previewImage) hLayout.addStretch(1) layout.addLayout(hLayout) # Refresh button self.__refreshButton = QtGui.QPushButton(u"Calculer la forme") layout.addWidget(self.__refreshButton) # Surface width input self.__unitInput = QtGui.QDoubleSpinBox() self.__unitInput.setDecimals(3) self.__unitInput.setMinimum(0.001) self.__unitInput.setMaximum(10) self.__unitInput.setValue(SHAPE_UNIT) hLayout = QtGui.QHBoxLayout() label = QtGui.QLabel(u"Taille d'un pixel (mm) :") hLayout.addWidget(label) hLayout.addStretch(1) hLayout.addWidget(self.__unitInput) layout.addLayout(hLayout) # Surface width input self.__baseZInput = QtGui.QDoubleSpinBox() self.__baseZInput.setDecimals(0) self.__baseZInput.setMinimum(1) self.__baseZInput.setMaximum(100) self.__baseZInput.setValue(BASE_Z) hLayout = QtGui.QHBoxLayout() label = QtGui.QLabel(u"Hauteur de la base :") hLayout.addWidget(label) hLayout.addStretch(1) hLayout.addWidget(self.__baseZInput) layout.addLayout(hLayout) # Surface width input self.__shapeZInput = QtGui.QDoubleSpinBox() self.__shapeZInput.setDecimals(0) self.__shapeZInput.setMinimum(1) self.__shapeZInput.setMaximum(100) self.__shapeZInput.setValue(SHAPE_Z) hLayout = QtGui.QHBoxLayout() label = QtGui.QLabel(u"Hauteur de la forme :") hLayout.addWidget(label) hLayout.addStretch(1) hLayout.addWidget(self.__shapeZInput) layout.addLayout(hLayout) # Export button self.__exportButton = QtGui.QPushButton(u"Exporter en STL") layout.addWidget(self.__exportButton) # Center the window geo = self.frameGeometry() geo.moveCenter(QtGui.QDesktopWidget().availableGeometry().center()) self.move(geo.topLeft()) # Title self.setWindowTitle("Profil 3D")
def _setupUI(self): self.setWindowTitle(self.NAME) self._addMenu() self._addToolbar() self._tabs = QtGui.QTabWidget() self._tabs.setTabsClosable(True) self.connect(self._tabs, QtCore.SIGNAL("currentChanged(int)"), self._roomTabFocused) self.connect(self._tabs, QtCore.SIGNAL("tabCloseRequested(int)"), self._roomTabClose) self._editor = SpellTextEditor(lang=self.getSetting( "program", "spell_language"), mainFrame=self) speakButton = QtGui.QPushButton(self._("&Send")) self.connect(speakButton, QtCore.SIGNAL('clicked()'), self.speak) grid = QtGui.QGridLayout() grid.setRowStretch(0, 1) grid.addWidget(self._tabs, 0, 0, 1, -1) grid.addWidget(self._editor, 2, 0) grid.addWidget(speakButton, 2, 1) widget = QtGui.QWidget() widget.setLayout(grid) self.setCentralWidget(widget) tabWidgetFocusEventFilter = TabWidgetFocusEventFilter(self) self.connect(tabWidgetFocusEventFilter, QtCore.SIGNAL("tabFocused()"), self._roomTabFocused) widget.installEventFilter(tabWidgetFocusEventFilter) self.centralWidget().hide() size = self.getSetting("window", "size") if not size: size = QtCore.QSize(640, 480) self.resize(size) position = self.getSetting("window", "position") if not position: screen = QtGui.QDesktopWidget().screenGeometry() position = QtCore.QPoint((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) self.move(position) self._updateLayout() menu = QtGui.QMenu(self) menu.addAction(self._menus["file"]["connect"]) menu.addAction(self._menus["file"]["disconnect"]) menu.addSeparator() menu.addAction(self._menus["file"]["exit"]) self._trayIcon = Systray(self._trayIconIcon, self) self._trayIcon.setContextMenu(menu) self._trayIcon.setToolTip(self.DESCRIPTION)
def center(self): #主窗口居中显示函数 screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width() - size.width()) / 2 - 15, (screen.height() - size.height()) / 2 - 60)
def __centerOnScreen(self): '''Centers the window on the screen.''' resolution = QtGui.QDesktopWidget().screenGeometry() self.move((resolution.width() / 2) - (self.frameSize().width() / 2), (resolution.height() / 2) - (self.frameSize().height() / 2))
def initUI(self): if (len(sys.argv) == 1): self.config_file = "protocol_configuration.ini" else: if (string.find(sys.argv[1], '.ini') == -1): self.config_file = str(sys.argv[1]) + ".ini" else: self.config_file = str(sys.argv[1]) print "Using configuration file: ", self.config_file config = ConfigParser.RawConfigParser(allow_no_value=True) config.read("./" + self.config_file) self.connect_to_loop = 1 if (self.connect_to_loop): self.bci = BCI.BciInterface() self.bci.id_msg_bus.SetEvent(400) self.bci.iDsock_bus.sendall(self.bci.id_serializer_bus.Serialize()) # Globals self.ACTION_UP = config.getint("constants", "ACTION_UP") self.ACTION_DOWN = config.getint("constants", "ACTION_DOWN") self.ACTION_LEFT = config.getint("constants", "ACTION_LEFT") self.ACTION_RIGHT = config.getint("constants", "ACTION_RIGHT") self.ACTION_END_EFFECTOR = config.getint("constants", "ACTION_END_EFFECTOR") self.ACTION_UP_LEFT = config.getint("constants", "ACTION_UP_LEFT") self.ACTION_UP_RIGHT = config.getint("constants", "ACTION_UP_RIGHT") self.ACTION_DOWN_LEFT = config.getint("constants", "ACTION_DOWN_LEFT") self.ACTION_DOWN_RIGHT = config.getint("constants", "ACTION_DOWN_RIGHT") self.TID_ACTION = config.getint("constants", "TID_ACTION") self.TID_TARGET = config.getint("constants", "TID_TARGET") self.TID_STATE = config.getint("constants", "TID_STATE") self.TID_PHASE = config.getint("constants", "TID_PHASE") self.TID_LETTER = config.getint("constants", "TID_LETTER") self.TID_EXIT = config.getint("constants", "TID_EXIT") self.TID_TARGET_AND_STATE_MULTIPLIER = config.getint( "constants", "TID_TARGET_AND_STATE_MULTIPLIER") self.TID_TARGET_AND_STATE_AND_LETTER_MULTIPLIER = config.getint( "constants", "TID_TARGET_AND_STATE_AND_LETTER_MULTIPLIER") self.REST_PHASE = config.getint("constants", "REST_PHASE") self.full_screen = config.getint("window", "full_screen") self.execution_mode = config.getint("protocol", "execution_mode") self.first_move = 0 self.OFFLINE_RUN = config.getint("constants", "OFFLINE_RUN") self.OFFLINE_CS_RUN = config.getint("constants", "OFFLINE_CS_RUN") self.ONLINE_RUN = config.getint("constants", "ONLINE_RUN") self.ONLINE_FREE_RUN = config.getint("constants", "ONLINE_FREE_RUN") self.ONLINE_SIMULATED = config.getint("constants", "ONLINE_SIMULATED") self.connect_eye = config.getint("protocol", "use_eye_tracker") now = datetime.datetime.now() self.format = config.get("protocol", "xdf_format") self.subject_id = config.get("protocol", "subject_id") self.name_experiment = config.get("protocol", "name_experiment") self.filename = self.subject_id + '_' + self.name_experiment + '_' + str( now.year) + str(now.month) + str(now.day) + '_' + str( now.hour) + str(now.minute) + str( now.second) + '.' + self.format # Parameters if (self.full_screen): self.screen_width = QtGui.QDesktopWidget().screenGeometry().width() self.screen_height = QtGui.QDesktopWidget().screenGeometry( ).height() print "screen ", self.screen_width, ", ", self.screen_height else: self.screen_width = config.getint("window", "screen_width") self.screen_height = config.getint("window", "screen_height") self.num_tiles_x = config.getint("interface", "num_tiles_column") self.num_tiles_y = config.getint("interface", "num_tiles_row") self.grid_thickness = config.getint("interface", "grid_thickness") self.gap_x = config.getint("interface", "gap_x") self.gap_y = config.getint("interface", "gap_y") self.tile_width = config.getint("interface", "tile_width") self.tile_height = config.getint("interface", "tile_height") self.device_diameter = config.getint("interface", "device_diameter") self.color_grid = QtGui.QColor( float(config.get("colors", "color_grid").split(',')[0]), float(config.get("colors", "color_grid").split(',')[1]), float(config.get("colors", "color_grid").split(',')[2])) self.color_text = QtGui.QColor( float(config.get("colors", "color_text").split(',')[0]), float(config.get("colors", "color_text").split(',')[1]), float(config.get("colors", "color_text").split(',')[2])) self.color_background = QtGui.QColor( float(config.get("colors", "color_background").split(',')[0]), float(config.get("colors", "color_background").split(',')[1]), float(config.get("colors", "color_background").split(',')[2])) self.color_target = QtGui.QColor( float(config.get("colors", "color_target").split(',')[0]), float(config.get("colors", "color_target").split(',')[1]), float(config.get("colors", "color_target").split(',')[2])) self.color_target_ONLINE_FREEMODE = QtGui.QColor( float(config.get("colors", "color_target2").split(',')[0]), float(config.get("colors", "color_target2").split(',')[1]), float(config.get("colors", "color_target2").split(',')[2])) self.color_device = QtGui.QColor( float(config.get("colors", "color_device").split(',')[0]), float(config.get("colors", "color_device").split(',')[1]), float(config.get("colors", "color_device").split(',')[2])) self.color_end_effector = QtGui.QColor(0, 0, 250) self.font = QtGui.QFont() self.font_size = config.getint("interface", "font_size") self.font.setPixelSize(self.font_size) self.fm = QtGui.QFontMetrics(self.font) self.characters = config.get("interface", "characters") self.position_target_y = 2 self.position_target_x = 2 self.position_device_y = 1 self.position_device_x = 2 self.tt = time() self.init_position_x = (self.screen_width - ((self.num_tiles_x * self.tile_width) + ((self.num_tiles_x - 1) * self.gap_x))) / 2 self.init_position_y = (self.screen_height - ((self.num_tiles_y * self.tile_height) + ((self.num_tiles_y - 1) * self.gap_y))) / 2 self.setGeometry(0, 0, self.screen_width, self.screen_height) self.setWindowTitle('RASER') self.setFocusPolicy(QtCore.Qt.WheelFocus) self.setFocus() # Connect to eye-tracker if (self.connect_eye): self.eyetracker = EyeLink.tracker(self.screen_width, self.screen_height) else: print "[RaSER GUI] Eye-tracker not used" self.show() if (self.full_screen): self.showFullScreen() QtCore.QCoreApplication.processEvents() QtCore.QCoreApplication.flush() timer = QtCore.QTimer(self) timer.timeout.connect(self.update_loop) timer.start(config.getfloat("interface", "paint_cycle_time")) self.tt = time() self.end_effector_shrink_factor = config.getfloat( "interface", "end_effector_shrink_factor") self.increase_saliency_end_effector = config.getint( "interface", "increase_saliency_end_effector") self.action_end_effector = 0 self.counter_end_effector = 0 self.action_end_effector_time = round( config.getfloat("interface", "end_effector_action_time") / config.getfloat("interface", "paint_cycle_time")) self.paint_underscore = 0 self.counter_underscore = 0 self.underscore_blinking_time = round( config.getfloat("interface", "underscore_blinking_time") / config.getfloat("interface", "paint_cycle_time")) self.written_text = "" self.color = 1 self.action_executed = 0 self.draw_photodiode = config.getint("interface", "draw_photodiode") # Rest phase variables self.rest_phase_duration = ( float(config.get("protocol", "rest_phase_duration").split(' ')[0]) - 1) * 1000 / config.getfloat("interface", "paint_cycle_time") self.counter_rest_phase = 0 self.rest_phase_bar_length = 0.6 * self.screen_width self.show_rest_phase = 0 self.color_rect = QtGui.QColor(255, 100, 0) self.color_text = QtGui.QColor(0, 128, 128) ####################################################################### # LPT Trigger initialization ####################################################################### # self.use_hwtrigger = config.getint("protocol", "use_hardware_trigger") self.lpt_type = config.getint("protocol", "use_hardware_trigger") self.use_hwtrigger = self.lpt_type > 0 # Parallel port if (self.lpt_type == 1): self.lpt = pylpttrigger self.lpt.open(0, 100, 0) # Arduino elif (self.lpt_type == 2): SERIAL_PORT = 'Arduino Micro' BAUD_RATE = 115200 self.lpt = SerialWriter.SerialWriter(SERIAL_PORT, BAUD_RATE) else: print "Unknown LPT Trigger!! Exiting..." exit() self.send_trigger = 0 self.counter_lpt = 0
def __init__(self): #Create Window super(MyWindow, self).__init__() uic.loadUi('ThreePhase.ui', self) self.show() qr = self.frameGeometry() cp = QtGui.QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft()) #Create Vars to hold output values self.freq = 3 #hz self.freqStep = 1 self.globalGain = 0.8003 self.globalOffset = 0 self.op_code = 1 #idle self.channel_1_offset_value = 0 self.channel_2_offset_value = 0 self.channel_3_offset_value = 0 self.channel_1_gain_value = 1.0 self.channel_2_gain_value = 1.0 self.channel_3_gain_value = 1.0 #Create necessary local vars self.update_freq = 1000 #time in msec for timer experation self.msg_data = [] self.dataHasChanged = False #Connect GUI features to functionality #connect frequency input self.Increase_Freq_Btn.clicked.connect(self.increaseFreq) self.Decrease_Freq_Btn.clicked.connect(self.decreaseFreq) self.connect(self.FreqDial, QtCore.SIGNAL('valueChanged(int)'), self.updateFreq) #connect gain input self.OffsetInput.valueChanged.connect(self.updateOffset) #connect offset input self.GainInput.valueChanged.connect(self.updateGain) #connect start button self.Startbtn.clicked.connect(self.startBtnPress) #connect stop button self.Stopbtn.clicked.connect(self.stopBtnPress) self.Stopbtn.setEnabled(False) #connect channel offset self.Channel1_offset.valueChanged.connect(self.channelOffsetUpdate) self.Channel2_offset.valueChanged.connect(self.channelOffsetUpdate) self.Channel3_offset.valueChanged.connect(self.channelOffsetUpdate) #connect channel multipliers self.Channel1_gain.valueChanged.connect(self.channelGainUpdate) self.Channel2_gain.valueChanged.connect(self.channelGainUpdate) self.Channel3_gain.valueChanged.connect(self.channelGainUpdate) #connect reset button self.ResetBtn.clicked.connect(self.resetGenData) #Create I2C comm self.DEVICE_BUS = 1 self.DEVICE_ADDR = 0x08 try: self.bus = smbus.SMBus(self.DEVICE_BUS) self.updateSysStatus("Connected") except: self.updateSysStatus( "I2C Connection Error Please Check Connections and Restart") #Create update timer self.timer = QtCore.QTimer() self.timer.setInterval(self.update_freq) self.timer.timeout.connect(self.timerExperation) self.timer.start()
def __init__(self): QtGui.QWidget.__init__(self) screen = QtGui.QDesktopWidget().screenGeometry() self.setWindowTitle('Annotation & Augmentation Tool') self.setGeometry(0, 0, screen.width(), screen.height()) self.image_path = None iconsize = 0.047 * ((screen.width() + screen.height()) / 2) self.buttonopenFolder = QtGui.QToolButton() self.buttonopenFolder.setText(' Open Folder ') self.buttonopenFolder.setIcon(QtGui.QIcon('./res/image.png')) self.buttonopenFolder.setIconSize( QtCore.QSize(int(iconsize), int(iconsize))) self.buttonopenFolder.setCheckable(True) self.buttonopenFolder.setFixedSize(int(1.8 * iconsize), int(1.4 * iconsize)) self.buttonopenFolder.setToolButtonStyle( QtCore.Qt.ToolButtonTextUnderIcon) self.buttonopenFolder.clicked.connect(self.openFloder) self.nextImageButton = QtGui.QToolButton() self.nextImageButton.setText('Previous \nImage') self.nextImageButton.setIcon(QtGui.QIcon('./res/left.png')) self.nextImageButton.setIconSize( QtCore.QSize(int(0.5 * iconsize), int(0.5 * iconsize))) self.nextImageButton.setFixedSize(int(0.85 * iconsize), int(1.4 * iconsize)) self.nextImageButton.setCheckable(True) self.nextImageButton.setToolButtonStyle( QtCore.Qt.ToolButtonTextUnderIcon) self.nextImageButton.clicked.connect(self.fetchPreviousImage) self.previousImageButton = QtGui.QToolButton() self.previousImageButton.setText('Next \nImage') self.previousImageButton.setIcon(QtGui.QIcon('./res/rightF.png')) self.previousImageButton.setIconSize( QtCore.QSize(int(0.5 * iconsize), int(0.5 * iconsize))) self.previousImageButton.setFixedSize(int(0.85 * iconsize), int(1.4 * iconsize)) self.previousImageButton.setCheckable(True) self.previousImageButton.setToolButtonStyle( QtCore.Qt.ToolButtonTextUnderIcon) self.previousImageButton.clicked.connect(self.fetchNextImage) self.saveYoloFormat = QtGui.QToolButton() self.saveYoloFormat.setText(' Save Annot ') self.saveYoloFormat.setIcon(QtGui.QIcon('./res/save.png')) self.saveYoloFormat.setIconSize( QtCore.QSize(int(iconsize), int(iconsize))) self.saveYoloFormat.setCheckable(True) self.saveYoloFormat.setFixedSize(int(1.8 * iconsize), int(1.4 * iconsize)) self.saveYoloFormat.setToolButtonStyle( QtCore.Qt.ToolButtonTextUnderIcon) self.saveYoloFormat.clicked.connect(self.saveAnnotation) classlabel = QtGui.QLabel("Classes") self.classList = [line.rstrip('\n') for line in open('./classes.txt')] self.classIndx = 0 self.CBclass = QtGui.QComboBox() self.CBclass.addItems(self.classList) self.CBclass.currentIndexChanged.connect(self.selectionchange) l1 = QtGui.QLabel() l1.setText("Data Augmentation") self.rotateImage = QtGui.QToolButton() self.rotateImage.setText(' Roation ') self.rotateImage.setIcon(QtGui.QIcon('./res/rotate.png')) self.rotateImage.setIconSize(QtCore.QSize(int(iconsize), int(iconsize))) self.rotateImage.setCheckable(True) self.rotateImage.setFixedSize(int(1.8 * iconsize), int(1.4 * iconsize)) self.rotateImage.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.rotateImage.clicked.connect(self.rotate3Image) self.flipping = QtGui.QToolButton() self.flipping.setText(' Flipping ') self.flipping.setIcon(QtGui.QIcon('./res/FLIP_F.png')) self.flipping.setIconSize(QtCore.QSize(int(iconsize), int(iconsize))) self.flipping.setCheckable(True) self.flipping.setFixedSize(int(1.8 * iconsize), int(1.4 * iconsize)) self.flipping.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.flipping.clicked.connect(self.flippingImage) self.addnoise = QtGui.QToolButton() self.addnoise.setText(' Salt & Papper Noise ') self.addnoise.setIcon(QtGui.QIcon('./res/noise.png')) self.addnoise.setIconSize(QtCore.QSize(int(iconsize), int(iconsize))) self.addnoise.setCheckable(True) self.addnoise.setFixedSize(int(1.8 * iconsize), int(1.4 * iconsize)) self.addnoise.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.addnoise.clicked.connect(self.addnoiseImage) self.addBright = QtGui.QToolButton() self.addBright.setText(' Brightness ') self.addBright.setIcon(QtGui.QIcon('./res/bright.png')) self.addBright.setIconSize(QtCore.QSize(int(iconsize), int(iconsize))) self.addBright.setCheckable(True) self.addBright.setFixedSize(int(1.8 * iconsize), int(1.4 * iconsize)) self.addBright.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.addBright.clicked.connect(self.addBrightImage) utemlogo = QtGui.QLabel() pixmap = QtGui.QPixmap('./res/utem.png') utemlogo.setPixmap( pixmap.scaled(int(2 * iconsize), int(1.5 * iconsize), QtCore.Qt.KeepAspectRatio)) fkekklogo = QtGui.QLabel() pixmap = QtGui.QPixmap('./res/fkekk.png') fkekklogo.setPixmap( pixmap.scaled(int(2 * iconsize), int(1.5 * iconsize), QtCore.Qt.KeepAspectRatio)) ButtonLayout = QtGui.QVBoxLayout() ButtonLayout.setAlignment(QtCore.Qt.AlignCenter) ButtonLayout.addWidget(self.buttonopenFolder) hboxRL = QtGui.QHBoxLayout() hboxRL.addWidget(self.nextImageButton) hboxRL.addWidget(self.previousImageButton) ButtonLayout.addLayout(hboxRL) ButtonLayout.addWidget(self.saveYoloFormat) ButtonLayout.addWidget(classlabel) ButtonLayout.addWidget(self.CBclass) ButtonLayout.addStretch() ButtonLayout.addWidget(l1) ButtonLayout.addWidget(self.rotateImage) ButtonLayout.addWidget(self.flipping) ButtonLayout.addWidget(self.addnoise) ButtonLayout.addWidget(self.addBright) ButtonLayout.addStretch() ButtonLayout.addWidget(fkekklogo) ButtonLayout.addWidget(utemlogo) self.label_image = MouseLabel(self) self.scroll = QtGui.QScrollArea(self) self.scroll.setWidget(self.label_image) hbox = QtGui.QHBoxLayout(self) hbox.addWidget(self.scroll) hbox.addLayout(ButtonLayout) self.connect(self.label_image, QtCore.SIGNAL('clicked(int, int, int, int, int)'), self.point_selected)
def __init__(self, parent=None, flags=QtCore.Qt.Widget): super(MainWindow, self).__init__(parent, flags) splitter_widget = QtGui.QSplitter(QtCore.Qt.Horizontal) self.code_object_view = QtGui.QTreeView(splitter_widget) self.code_object_view.setHeaderHidden(True) self.code_object_view.setModel(QtGui.QStandardItemModel()) self.code_object_view.selectionModel().currentChanged.connect(self.on_code_object_view_current_changed) tab_widget = QtGui.QTabWidget(splitter_widget) self.summary_view = QtWebKit.QWebView() self.summary_view.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks) self.summary_view.linkClicked.connect(self.on_summary_view_link_clicked) self.disassembly_view = QtWebKit.QWebView() self.disassembly_view.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks) self.disassembly_view.linkClicked.connect(self.on_disassembly_view_link_clicked) self.hex_edit = hexedit.HexEdit() tab_widget.addTab(self.summary_view, 'Summary') tab_widget.addTab(self.disassembly_view, 'Disassembly') tab_widget.addTab(self.hex_edit, 'Hex Dump') menu = self.menuBar().addMenu('&File') menu.addAction('&Open...').triggered.connect(self.on_menu_bar_open_triggered) menu.addAction('&Close').triggered.connect(self.on_menu_bar_close_triggered) menu.addAction('&Reload').triggered.connect(self.on_menu_bar_reload_triggered) menu.addSeparator() menu.addAction('E&xit').triggered.connect(Qt.qApp.quit) menu = self.menuBar().addMenu('&Help') menu.addAction('About...').triggered.connect(self.on_menu_bar_about_triggered) menu.addSeparator() menu.addAction('About Qt...').triggered.connect(Qt.qApp.aboutQt) splitter_widget.setStretchFactor(0, 0) splitter_widget.setStretchFactor(1, 1) splitter_widget.setSizes([200, splitter_widget.width()-200]) self.setCentralWidget(splitter_widget) self.setWindowTitle('Chrysanthemum') self.setWindowIcon(QtGui.QIcon(':/images/icon.png')) self.setAcceptDrops(True) self.resize(1024, 768) self.setGeometry(QtGui.QStyle.alignedRect(QtCore.Qt.LeftToRight, QtCore.Qt.AlignCenter, self.size(), QtGui.QDesktopWidget().availableGeometry())) self.close()
def center_on_screen(self): resolution = QtGui.QDesktopWidget().screenGeometry() self.move((resolution.width() / 2) - (self.frameSize().width() / 2), (resolution.height() / 2) - (self.frameSize().height() / 2))
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setWindowIcon(QtGui.QIcon(os.path.join("Resources", "images", "Icon"))) self.setWindowTitle("Pcode - Loading...") screen = QtGui.QDesktopWidget().screenGeometry() self.resize(screen.width() - 200, screen.height() - 200) size = self.geometry() self.move((screen.width() - size.width()) / 2, ( screen.height() - size.height()) / 2) self.lastWindowGeometry = self.geometry() mainLayout = QtGui.QVBoxLayout() mainLayout.setSpacing(0) mainLayout.setMargin(0) self.setLayout(mainLayout) self.useData = UseData() logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', filename=self.useData.appPathDict["logfile"], level=logging.DEBUG) if sys.version_info.major < 3: logging.error("This application requires Python 3") sys.exit(1) self.library = Library(self.useData) self.busyWidget = BusyWidget(app, self.useData, self) if self.useData.SETTINGS["UI"] == "Custom": app.setStyleSheet(StyleSheet.globalStyle) self.projectWindowStack = QtGui.QStackedWidget() self.projectTitleBox = QtGui.QComboBox() self.projectTitleBox.setMinimumWidth(180) self.projectTitleBox.setStyleSheet(StyleSheet.projectTitleBoxStyle) self.projectTitleBox.setItemDelegate(QtGui.QStyledItemDelegate()) self.projectTitleBox.currentIndexChanged.connect(self.projectChanged) self.projectTitleBox.activated.connect(self.projectChanged) self.settingsWidget = SettingsWidget(self.useData, app, self.projectWindowStack, self.library.codeViewer, self) self.settingsWidget.colorScheme.styleEditor(self.library.codeViewer) startWindow = Start(self.useData, self) self.addProject(startWindow, "Start", "Start", os.path.join("Resources", "images", "flag-green")) self.projects = Projects(self.useData, self.busyWidget, self.library, self.settingsWidget, app, self.projectWindowStack, self.projectTitleBox, self) self.createActions() hbox = QtGui.QHBoxLayout() hbox.setContentsMargins(5, 3, 5, 3) mainLayout.addLayout(hbox) hbox.addStretch(1) self.pagesStack = QtGui.QStackedWidget() mainLayout.addWidget(self.pagesStack) self.projectSwitcher = StackSwitcher(self.pagesStack) self.projectSwitcher.setStyleSheet(StyleSheet.mainMenuStyle) hbox.addWidget(self.projectSwitcher) self.pagesStack.addWidget(self.projectWindowStack) # self.addPage(self.projectWindowStack, "EDITOR", QtGui.QIcon( # os.path.join("Resources", "images", "hire-me"))) # # self.addPage(self.library, "LIBRARY", QtGui.QIcon( # os.path.join("Resources", "images", "library"))) # self.projectSwitcher.setDefault() hbox.addWidget(self.projectTitleBox) hbox.setSpacing(5) self.settingsButton = QtGui.QToolButton() self.settingsButton.setAutoRaise(True) self.settingsButton.setDefaultAction(self.settingsAct) hbox.addWidget(self.settingsButton) self.fullScreenButton = QtGui.QToolButton() self.fullScreenButton.setAutoRaise(True) self.fullScreenButton.setDefaultAction(self.showFullScreenAct) hbox.addWidget(self.fullScreenButton) self.aboutButton = QtGui.QToolButton() self.aboutButton.setAutoRaise(True) self.aboutButton.setDefaultAction(self.aboutAct) hbox.addWidget(self.aboutButton) self.setShortcuts() if self.useData.settings["firstRun"] == 'True': self.showMaximized() else: self.restoreUiState() self.useData.settings["running"] = 'True' self.useData.settings["firstRun"] = 'False' self.useData.saveSettings()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setWindowIcon( QtGui.QIcon(os.path.join("Resources", "images", "Icon"))) self.setWindowTitle("Pcode - Loading...") screen = QtGui.QDesktopWidget().screenGeometry() self.resize(screen.width() - 200, screen.height() - 200) size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) self.lastWindowGeometry = self.geometry() self.setBaseColor() mainLayout = QtGui.QVBoxLayout() mainLayout.setSpacing(0) mainLayout.setMargin(0) self.setLayout(mainLayout) self.useData = UseData() self.library = Library(self.useData) self.busyWidget = BusyWidget(app, self.useData, self) self.projectWindowStack = QtGui.QStackedWidget() self.projectTitleBox = QtGui.QComboBox() self.projectTitleBox.setMinimumWidth(180) self.projectTitleBox.setStyleSheet(StyleSheet.projectTitleBoxStyle) self.projectTitleBox.setItemDelegate(QtGui.QStyledItemDelegate()) self.projectTitleBox.currentIndexChanged.connect(self.projectChanged) self.projectTitleBox.activated.connect(self.projectChanged) self.settingsWidget = SettingsWidget(self.useData, self.projectWindowStack, self.library.codeViewer, self) self.settingsWidget.colorScheme.styleEditor(self.library.codeViewer) startWindow = Start(self.useData, self) self.addProject(startWindow, "Start", "Start", os.path.join("Resources", "images", "flag-green")) self.projects = Projects(self.useData, self.busyWidget, self.library, self.settingsWidget, app, self.projectWindowStack, self.projectTitleBox, self) self.createActions() hbox = QtGui.QHBoxLayout() hbox.setContentsMargins(5, 3, 5, 3) mainLayout.addLayout(hbox) hbox.addStretch(1) self.pagesStack = QtGui.QStackedWidget() mainLayout.addWidget(self.pagesStack) self.projectSwitcher = StackSwitcher(self.pagesStack) self.projectSwitcher.setStyleSheet(StyleSheet.mainMenuStyle) hbox.addWidget(self.projectSwitcher) self.addPage( self.projectWindowStack, "EDITOR", QtGui.QIcon(os.path.join("Resources", "images", "hire-me"))) self.addPage( self.library, "LIBRARY", QtGui.QIcon(os.path.join("Resources", "images", "library"))) self.projectSwitcher.setDefault() hbox.addWidget(self.projectTitleBox) hbox.setSpacing(5) self.settingsButton = QtGui.QToolButton() self.settingsButton.setAutoRaise(True) self.settingsButton.setDefaultAction(self.settingsAct) hbox.addWidget(self.settingsButton) self.fullScreenButton = QtGui.QToolButton() self.fullScreenButton.setAutoRaise(True) self.fullScreenButton.setDefaultAction(self.showFullScreenAct) hbox.addWidget(self.fullScreenButton) self.aboutButton = QtGui.QToolButton() self.aboutButton.setAutoRaise(True) self.aboutButton.setDefaultAction(self.aboutAct) hbox.addWidget(self.aboutButton) self.install_shortcuts() if self.useData.settings["firstRun"] == 'True': self.showMaximized() else: self.restoreUiState() self.useData.settings["running"] = 'True' self.useData.settings["firstRun"] = 'False' self.useData.saveSettings()
def initSize(self): screen = QtGui.QDesktopWidget().screenGeometry() self.setGeometry(screen.width() / 8, screen.height() / 8, 3 * screen.width() / 4, 3 * screen.height() / 4)
def __init__(self, parent, roach_config, network_config, filesys_config, hardware_config, logging_config): super(configWindow, self).__init__(parent) # Load of main window GUI # The GUI was developed in QT Designer self.ui = uic.loadUi("./src/gui/config.ui") # Screen dimensions screen = QtGui.QDesktopWidget().screenGeometry() self.size_x = screen.width() self.size_y = screen.height() self.ui.setWindowFlags(self.ui.windowFlags() | QtCore.Qt.CustomizeWindowHint) self.ui.setWindowFlags(self.ui.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint) self.ui.move(self.size_x / 2 - self.ui.width() / 2, self.size_y / 2 - self.ui.height() / 2) self.hdw_cfg = hardware_config self.fsy_cfg = filesys_config self.lgg_cfg = logging_config self.net_cfg = network_config self.rch_cfg = roach_config # ROACH # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - roach_list = self.rch_cfg.keys() network_list = self.net_cfg.keys() synth_list = self.hdw_cfg["synth_config"].keys() atten_list = self.hdw_cfg["atten_config"].keys() self.ui.nameRoachBox.clear() self.ui.netNameRoach.clear() self.ui.nameRoachBox.addItems(roach_list) self.ui.netNameRoach.addItems(roach_list) self.fillSynthesizer(synth_list) self.fillAttenuator(atten_list) # Roach settings self.updateRoach(roach_list[0]) # Network settings self.updateNetwork(roach_list[0]) # Hardware settings # Synthesizer self.ui.synthNameEdit.clear() self.ui.synthNameEdit.addItems(synth_list) self.updateSynth(synth_list[0]) # Attenuator self.ui.attenNameEdit.clear() self.ui.attenNameEdit.addItems(atten_list) self.updateAtt(atten_list[0]) # Directories self.updateDirectories() # Logging self.updateLogging() # Buttons # Roach self.ui.firmFileBtn.mousePressEvent = self.chooseFirmFilePath self.ui.tonesFileBtn.mousePressEvent = self.chooseTonesFilePath self.ui.nameRoachBox.currentIndexChanged.connect(self.changeRoach) self.ui.addRoachBtn.mousePressEvent = self.addNewRoach self.ui.removeRoachBtn.mousePressEvent = self.rmRoach self.ui.roachBtn.mousePressEvent = self.saveRoach self.ui.roachWriteBtn.mousePressEvent = self.writeRoach # Network self.ui.netNameRoach.currentIndexChanged.connect( self.changeRoachNetwork) self.ui.netBtn.mousePressEvent = self.saveNet self.ui.netWriteBtn.mousePressEvent = self.writeNet # Hardware self.ui.synthNameEdit.currentIndexChanged.connect(self.changeSynth) self.ui.attenNameEdit.currentIndexChanged.connect(self.changeAtten) self.ui.activeSynthBtn.mousePressEvent = self.toggleActiveSynth self.ui.activeAttenBtn.mousePressEvent = self.toggleActiveAtten self.ui.addSynthBtn.mousePressEvent = self.addNewSynth self.ui.removeSynthBtn.mousePressEvent = self.rmSynth self.ui.addAttenBtn.mousePressEvent = self.addNewAtten self.ui.removeAttenBtn.mousePressEvent = self.rmAtten self.ui.hdwBtn.mousePressEvent = self.saveHardware self.ui.hdwWriteBtn.mousePressEvent = self.writeHardware # Directories self.ui.diryFirmwareEdit.mousePressEvent = self.chooseFirmPath self.ui.rootDiryBtn.mousePressEvent = self.chooseRootPath self.ui.logDiryBtn.mousePressEvent = self.chooseLogPath self.ui.pidBtn.mousePressEvent = self.choosePIDPath self.ui.toneDiryBtn.mousePressEvent = self.chooseTonesPath self.ui.RAMDiryBtn.mousePressEvent = self.chooseRAMPath self.ui.theDiryBtn.mousePressEvent = self.saveDiry self.ui.theDiryWriteBtn.mousePressEvent = self.writeDiry
def center(self): geometry = self.frameGeometry() center = QtGui.QDesktopWidget().availableGeometry().center() geometry.moveCenter(center) self.move(geometry.topLeft())
def center(self): qr = self.frameGeometry() # Getting current window frame of my desktop cp = QtGui.QDesktopWidget().availableGeometry().center() # Getting center point of my Desktop wiondow qr.moveCenter(cp) # moving the center of the window to the cp self.move(qr.topLeft())
def centrar(self): # Centra el Frame screen = QtGui.QDesktopWidget().screenGeometry( ) # obtiene resolucion del usuario size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
file.write(str(l)) file.close() label_nilaiprima = self.label_nilaip label_nilaiprima.setText("p = " + str(num)[0:3] + "..") file2 = open('output/nilaip.txt', 'w') file2.write(str(num)) file2.close() # print(lower) # print(upper) return num def next(self): self.hide() ketiga = FungsiKetiga.MyQtApp(self) ketiga.position() ketiga.show() if __name__ == "__main__": import sys app = QtGui.QApplication(sys.argv) qt_app = MyQtApp() screen = QtGui.QDesktopWidget().screenGeometry() x = (screen.width() - qt_app.geometry().width()) / 2 y = (screen.height() - qt_app.geometry().height()) / 2 qt_app.move(x, y) qt_app.show() app.exec()
def center(self): frameGm = self.frameGeometry() centerPoint = QtGui.QDesktopWidget().availableGeometry().center() frameGm.moveCenter(centerPoint) self.move(frameGm.topLeft())
def main(): # Create the object that handles the communication with the FPGA board: sl = SuperLaserLand_JD_RP() # Specify the mapping between the MAC addresses (which are used as a form of serial numbers) and the box data devices_data = {} devices_data['002632f016dc'] = { 'color': '#1CC981', 'name': 'Red Pitaya 0', 'shorthand': 'RP 0', 'config file': 'system_parameters_RP_1.xml', #'port': 60002 } devices_data['002632f03cc2'] = { 'color': '#1CC981', 'name': 'RP Comb 1', 'shorthand': 'RPC 1', 'config file': 'system_parameters_RP_C1.xml', #'port': 60002 } devices_data['002632f03d5b'] = { 'color': '#1CC981', 'name': 'RP Comb 2', 'shorthand': 'RPC 2', 'config file': 'system_parameters_RP_C3.xml', #'port': 60002 } # serial_to_color_mapping = {} # serial_to_color_mapping['000000054R'] = '#1CC981' # serial_to_color_mapping['000000054S'] = '#811CC9' # # serial_to_color_mapping['124300046U'] = 'blue' # serial_to_color_mapping['12320003SX'] = 'orange' # serial_to_color_mapping['000000054E'] = '#E37405' # orange high-bandwidth (dark orange) # serial_to_color_mapping['000000054J'] = '#70E7FF' # blue high-bandwidth (light blue) # serial_to_color_mapping['124300046R'] = '#B572E8' # purple high-bandwidth (purple) # serial_to_color_mapping['124300046V'] = '#FF0000' # serial_to_color_mapping['124300046S'] = '#0033CC' # this opens the connection to the fpga (hard-coded IP address for now) # strList = sl.getDeviceList() ########################################################################### # Update the FPGA bitfile and the Zynq monitor-tcp C program # send new bitfile version try: # sl.dev.write_file_on_remote(strFilenameLocal=r'D:\Projects\RedPitaya\fpga\project\redpitaya.runs\impl_1\red_pitaya_top.bit', strFilenameRemote='/opt/red_pitaya_top.bit') # sl.dev.write_file_on_remote(strFilenameLocal=r'D:\Projets_Xilinx\RedPitaya\fpga\project\redpitaya.runs\impl_1\red_pitaya_top.bit', strFilenameRemote='/opt/red_pitaya_top.bit') pass except: print "warning, could not update fpga bitfile" pass # program FPGA with new bitfile: # sl.dev.send_shell_command('cat /opt/red_pitaya_top.bit > /dev/xdevcfg') # time.sleep(3) # # # send new monitor-tcp version # sl.dev.write_file_on_remote(strFilenameLocal=u'D:\\Université\\Dropbox\\22_H2015\\Red Pitaya\\monitor-tcp\\monitor-tcp', strFilenameRemote='/opt/monitor-tcp-new') # # # set executable permissions # sl.dev.send_shell_command('chmod +x /opt/monitor-tcp-new') # # copy over old file # sl.dev.send_shell_command('mv /opt/monitor-tcp-new /opt/monitor-tcp') # # # send reboot command # sl.dev.send_reboot_command() # sl.dev.sock.shutdown(socket.SHUT_RDWR) # sl.dev.sock.close() # # time.sleep(1) # give some time for tcp server to come back up ## return # sl.getDeviceList() # reconnect # # #sl.dev.OpenTCPConnection(sl.dev.HOST, sl.dev.PORT) # hack to get things working quickly ## sl.dev.sock.connect((sl.dev.HOST, sl.dev.PORT)) # ## return # for quick debug tests ########################################################################### # Start the User Interface allowSetForegroundWindow.allowSetForegroundWindow() # Start Qt: app = QtGui.QApplication(sys.argv) strBroadcastAddress = '192.168.0.255' strFPGAFirmware = r'red_pitaya_top.bit' strCPUFirmware = u'monitor-tcp' initial_config = initialConfiguration(sl.dev, devices_data, strBroadcastAddress, strFPGAFirmware, strCPUFirmware) # def __init__(self, dev, devices_data={}, strBroadcastAddress="192.168.2.255", strFPGAFirmware='', strCPUFirmware=''): # # this will remove minimized status # # and restore window with keeping maximized/normal state # allowSetForegroundWindow.allowSetForegroundWindow() ## initial_config.setWindowState(initial_config.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) # # this will activate the window ## initial_config.activateWindow() ## initial_config.show() # # initial_config.raise_() # # initial_config.show() # # SetWindowPos(initial_config.winId(), # win32con.HWND_TOPMOST, # = always on top. only reliable way to bring it to the front on windows # 0, 0, 0, 0, # win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_SHOWWINDOW) # SetWindowPos(initial_config.winId(), # win32con.HWND_NOTOPMOST, # disable the always on top, but leave window at its top position # 0, 0, 0, 0, # win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_SHOWWINDOW) # initial_config.raise_() # initial_config.show() # initial_config.activateWindow() #initial_config.setWindowState(initial_config.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) # Run the event loop for this window app.exec_() if initial_config.bOk == False: # User clicked cancel. simply close the program: return # Start the init process (this sets the PLL gain/settings registers and the residuals streaming) sl.initSubModules(initial_config.bSendDefaultValues) ########################################################################### # Create the object which handles the configuration parameters (DAC offsets, DAC gains, beat frequency modulation range, etc): sp = SLLSystemParameters() # # Send the values to the FPGA only if we have just re-programmed it. Otherwise we use whatever value is already in so we don't disturb the operation # bTriggerEvents = False # if initial_config.bSendFirmware: # # bTriggerEvents = True bTriggerEvents = True # Lookup filename and load if file is there: try: custom_config_file = devices_data[ initial_config.strSelectedSerial]['config file'] sp.loadFromFile(custom_config_file) print('Loaded configuration from %s' % custom_config_file) except KeyError: custom_config_file = '' print 'Warning: Could not find config file "%s" for FPGA serial: %s, loading default values' % ( custom_config_file, initial_config.strSelectedSerial) sp.loadDefaults() sp.loadDefaults() # sp.saveToFile('system_parameters_current.xml') bSendToFPGA = bTriggerEvents sp.sendToFPGA(sl, bSendToFPGA) # config_window = SLLConfigurationWindow() # config_window.loadParameters(sp) # config_window.hide() ########################################################################### # Load all our windows: # Style sheet which includes the color scheme for each specific box: try: custom_style_sheet = ( '#MainWindow {color: white; background-color: %s;}' % devices_data[initial_config.strSelectedSerial]['color']) except KeyError: custom_style_sheet = '' # The shorthand name which gets added to the window names: try: custom_shorthand = devices_data[ initial_config.strSelectedSerial]['shorthand'] except KeyError: custom_shorthand = '' # Have to be careful with the modulus setting (double-check with a scope to make sure the output frequency is right) # I think the output frequency for the square wave mode is given by: # 200 MHz/(2*(modulus+1)) # While for the pulsed mode (bPulses = 1), the frequency is: # 200 MHz/(modulus+1) # sl.set_clk_divider_settings(bOn=1, bPulses=0, modulus=67e3-1) # sl.set_clk_divider_settings(bOn=1, bPulses=0, modulus=67e3+1-1) divider_settings_window = DisplayDividerAndResidualsStreamingSettingsWindow( sl, clk_divider_modulus=67e3, bDividerOn=0, bPulses=0, custom_style_sheet=custom_style_sheet, custom_shorthand=custom_shorthand, bUpdateFPGA=bSendToFPGA) # Optical lock window xem_gui_mainwindow2 = XEM_GUI_MainWindow( sl, custom_shorthand + ': Optical lock', 1, (False, True, False), sp, custom_style_sheet, initial_config.strSelectedSerial) xem_gui_mainwindow2.initSL(bTriggerEvents) # CEO Lock window xem_gui_mainwindow = XEM_GUI_MainWindow(sl, custom_shorthand + ': CEO lock', 0, (True, False, False), sp, custom_style_sheet, initial_config.strSelectedSerial) xem_gui_mainwindow.initSL(bTriggerEvents) # ########################################################################### # # For testing the Red Pitaya with the built-in DDS: # # addr_vco = 2 # addr_vco_amplitude = 0x0000 # addr_vco_freq_msb = 0x0004 # addr_vco_freq_lsb = 0x0008 # # vco_amplitude = round(0.01*(2**15-1)) ## vco_freq_word = np.array([round((15e6/100e6+1./600.)*2.**48)]).astype(np.int64) ## # break vco word into msbs and lsbs: ## vco_freq_word_msbs = vco_freq_word >> 32 ## vco_freq_word_lsbs = np.bitwise_and(vco_freq_word, (1<<32)-1) # # # write amplitude # address_uint32 = (addr_vco << 20) + addr_vco_amplitude # data_uint32 = vco_amplitude # sl.dev.write_Zynq_register_uint32(address_uint32, data_uint32) ######################################################### # The two frequency counter: strOfTime = time.strftime("%m_%d_%Y_%H_%M_%S_") try: temp_control_port = devices_data[ initial_config.strSelectedSerial]['port'] except: temp_control_port = 0 strNameTemplate = 'data_logging\%s' % strOfTime strNameTemplate = '%s_%s_' % (strNameTemplate, initial_config.strSelectedSerial) freq_error_window1 = FreqErrorWindowWithTempControlV2( sl, 'CEO beat in-loop counter', 0, strNameTemplate, custom_style_sheet, 0, xem_gui_mainwindow) freq_error_window2 = FreqErrorWindowWithTempControlV2( sl, 'Optical beat in-loop counter', 1, strNameTemplate, custom_style_sheet, temp_control_port, None) counters_window = Qt.QWidget() counters_window.setObjectName('MainWindow') counters_window.setStyleSheet(custom_style_sheet) vbox = Qt.QVBoxLayout() vbox.addWidget(freq_error_window1) vbox.addWidget(freq_error_window2) counters_window.setLayout(vbox) counters_window.setWindowTitle(custom_shorthand + ': Frequency counters') #counters_window.setGeometry(993, 40, 800, 1010) #counters_window.setGeometry(0, 0, 750, 1000) # counters_window.resize(600, 1080-100+30) counters_window.move(QtGui.QDesktopWidget().availableGeometry().topLeft() + Qt.QPoint(985, 10)) counters_window.show() # Dither windows, this code could be moved to another class/file to help with clutter: dither_widget0 = DisplayDitherSettingsWindow( sl, 0, modulation_frequency_in_hz='1e3', output_amplitude='1e-3', integration_time_in_seconds='0.1', bEnableDither=True, custom_style_sheet=custom_style_sheet) dither_widget1 = DisplayDitherSettingsWindow( sl, 1, modulation_frequency_in_hz='5e3', output_amplitude='1e-3', integration_time_in_seconds='0.1', bEnableDither=True, custom_style_sheet=custom_style_sheet) dither_widget2 = DisplayDitherSettingsWindow( sl, 2, modulation_frequency_in_hz='110', output_amplitude='1e-4', integration_time_in_seconds='0.1', bEnableDither=True, custom_style_sheet=custom_style_sheet) settings_window = Qt.QWidget() settings_window.setObjectName('MainWindow') settings_window.setStyleSheet(custom_style_sheet) vbox = Qt.QVBoxLayout() vbox.addWidget(dither_widget0) vbox.addWidget(dither_widget1) vbox.addWidget(dither_widget2) vbox.addStretch(1) hbox = Qt.QHBoxLayout() hbox.addLayout(vbox) hbox.addWidget(divider_settings_window) hbox.addStretch(1) settings_window.setLayout(hbox) settings_window.setWindowTitle(custom_shorthand + ': Dither controls') settings_window.show() # ########################################################################### # # For testing out the transfer function window: # frequency_axis = np.logspace(np.log10(10e3), np.log10(2e6), 10e3) # transfer_function = 1/(1 + 1j*frequency_axis/100e3) # window_number = 1 # vertical_units = 'V/V' # tf_window1 = DisplayTransferFunctionWindow(frequency_axis, transfer_function, window_number, vertical_units) # # # Regroup the two windows into a single one: main_windows = Qt.QWidget() main_windows.setObjectName('MainWindow') main_windows.setStyleSheet(custom_style_sheet) # ########################################################################### # # Select clock source # # clock_source = 0: Internal clock at 100 MHz # # clock_source = 1: External clock at 200 MHz on DIN[0]/CLKIN, divided by 2 internally for a system clock still at 100 MHz # if initial_config.bSendFirmware: # if initial_config.bExternalClock == True: # clock_source = 1 # print('External clock mode') # else: # clock_source = 0 # print('Internal clock mode') # sl.selectClockSource(clock_source) # # Now we just need to reset the frontend to make sure we start everything in a nice state # sl.resetFrontend() sl.resetFrontend() tabs = QtGui.QTabWidget() # xem_gui_mainwindow2.resize(600, 700) # xem_gui_mainwindow.setContentsMargins(0, 0, 0, 0) # xem_gui_mainwindow.layout().setContentsMargins(0, 0, 0, 0) # xem_gui_mainwindow2.setContentsMargins(0, 0, 0, 0) # xem_gui_mainwindow2.layout().setContentsMargins(0, 0, 0, 0) # counters_window.setContentsMargins(0, 0, 0, 0) # counters_window.layout().setContentsMargins(0, 0, 0, 0) # dither_window.setContentsMargins(0, 0, 0, 0) # dither_window.layout().setContentsMargins(0, 0, 0, 0) # dfr_timing_gui.setContentsMargins(0, 0, 0, 0) # dfr_timing_gui.layout().setContentsMargins(0, 0, 0, 0) # divider_settings_window.setContentsMargins(0, 0, 0, 0) # divider_settings_window.layout().setContentsMargins(0, 0, 0, 0) tabs.setMaximumSize(1920, 1080 - 100 + 30) # main_windows.setMaximumSize(600,600) # xem_gui_mainwindow.setMaximumSize(600,600) # xem_gui_mainwindow2.setMaximumSize(600,600) # counters_window.setMaximumSize(600,600) # dither_window.setMaximumSize(600,600) # dfr_timing_gui.setMaximumSize(600,600) # divider_settings_window.setMaximumSize(600,600) tabs.addTab(xem_gui_mainwindow, "CEO Lock") tabs.addTab(xem_gui_mainwindow2, "Optical Lock") tabs.addTab(counters_window, "Counters") tabs.addTab(settings_window, "Settings") #FEATURE #tabs.addTab(dfr_timing_gui, "DFr trigger generator") # tabs.addTab(divider_settings_window, "Filter settings") # tabs.setGeometry(0, 0, 750, 1000) box = QtGui.QHBoxLayout() box.addWidget(tabs) main_windows.setLayout(box) main_windows.setWindowTitle(custom_shorthand) main_windows.move(QtGui.QDesktopWidget().availableGeometry().topLeft() + Qt.QPoint(945 - 300, 0)) main_windows.show() # Enter main event loop app.exec_()
def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_wallpaperWidget() self.ui.setupUi(self) # Get system locale self.catLang = KGlobal.locale().language() isWide = lambda x: float(x[0]) / float(x[1]) >= 1.6 isSquare = lambda x: float(x[0]) / float(x[1]) < 1.6 # Get screen resolution rect = QtGui.QDesktopWidget().screenGeometry() # Get metadata.desktop files from shared wallpaper directory lst = KStandardDirs().findAllResources("wallpaper", "*metadata.desktop", KStandardDirs.Recursive) for desktopFiles in lst: parser = DesktopParser() parser.read(str(desktopFiles)) try: wallpaperTitle = parser.get_locale('Desktop Entry', 'Name[%s]' % self.catLang, '') except: wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '') try: wallpaperDesc = parser.get_locale('Desktop Entry', 'X-KDE-PluginInfo-Author', '') except: wallpaperDesc = "Unknown" # Get all files in the wallpaper's directory l = os.listdir( os.path.join( os.path.split(str(desktopFiles))[0], "contents/images")) wallpaperFile = os.path.split(str(desktopFiles))[0] wallpaperThumb = os.path.join( os.path.split(str(desktopFiles))[0], "contents/screenshot.png") # Insert wallpapers to listWidget. item = QtGui.QListWidgetItem(self.ui.listWallpaper) # Each wallpaper item is a widget. Look at widgets.py for more information. widget = WallpaperItemWidget(unicode(wallpaperTitle), unicode(wallpaperDesc), wallpaperThumb, self.ui.listWallpaper) item.setSizeHint(QSize(38, 110)) self.ui.listWallpaper.setItemWidget(item, widget) # Add a hidden value to each item for detecting selected wallpaper's path. item.setStatusTip(wallpaperFile) self.ui.listWallpaper.connect(self.ui.listWallpaper, SIGNAL("itemSelectionChanged()"), self.setWallpaper) self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"), self.disableWidgets) self.ui.buttonChooseWp.connect(self.ui.buttonChooseWp, SIGNAL("clicked()"), self.selectWallpaper)
def initUI(self, parent, adjust, name, point, marker, marker_size): QtGui.QMainWindow.__init__(self) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(name) self.resize(1000, 1000) screen = QtGui.QDesktopWidget().screenGeometry() self.move(random.randint(0, screen.height()), random.randint(0, screen.width())) self.open = QtGui.QAction('&Open', self) self.open.setShortcut('Ctrl+O') self.open.setStatusTip('import graphics') self.connect(self.open, QtCore.SIGNAL('triggered()'), self.openGraph) self.close = QtGui.QAction('&Exit', self) self.close.setShortcut('Ctrl+Q') self.close.setStatusTip('Exit application') self.connect(self.close, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()')) self.printG = QtGui.QAction('&Print', self) self.printG.setShortcut('Ctrl+P') self.printG.setStatusTip('Print graphics') self.connect(self.printG, QtCore.SIGNAL('triggered()'), self.printGraph) self.save = QtGui.QAction('&Save', self) self.save.setShortcut('Ctrl+S') self.save.setStatusTip('Save Graphic') self.connect(self.save, QtCore.SIGNAL('triggered()'), self.showDialog) self.setStatusBar(QtGui.QStatusBar()) self.menubar = self.menuBar() self.fileMenu1 = self.menubar.addMenu('&File') #self.fileMenu1.addAction(self.open) self.fileMenu1.addAction(self.save) self.fileMenu1.addAction(self.printG) self.fileMenu1.addAction(self.close) self.main_widget = QtGui.QWidget(self) self.main_lay = QtGui.QHBoxLayout(self.main_widget) #Creation of the graphics widged self.graph_widget = QtGui.QWidget(self) self.graph_lay = QtGui.QVBoxLayout(self.graph_widget) self.G = Canvas.CanvasQT(self.main_widget, width=6, height=4, dpi=100,\ x=self.x,y=self.y,pxlbl=self.xlabel,pylbl=self.ylabel\ ,point=point,marker=marker,marker_size=marker_size) self.navigation_toolbar = NavigationToolbar2(self.G, self) #creation of the option widget self.test = QtGui.QWidget() self.test.hide() self.option_layout = QtGui.QGridLayout(self.test) self.lbl2 = QtGui.QLabel("select file :", self) self.lbl2.setFixedSize(70, 36) self.tefile = QtGui.QTextEdit() self.tefile.setReadOnly(True) self.tefile.setFixedSize(100, 36) self.browse = QtGui.QPushButton('&Browse', self) self.browse.setFixedSize(100, 36) # self.connect(self.browse ,QtCore.SIGNAL("clicked()"),self.openFile) self.tbro = QtGui.QTextBrowser() self.tbro.setFixedHeight(500) self.tbro.setFixedWidth(200) self.tbro.setLineWrapMode(QtGui.QTextEdit.NoWrap) self.lbl3 = QtGui.QLabel("x :", self) self.lbl3.setFixedSize(15, 36) self.CBox1 = QtGui.QComboBox() self.CBox1.addItem("") self.CBox1.setFixedSize(65, 36) # self.connect(self.CBox1,QtCore.SIGNAL('currentIndexChanged(const QString&)'),self.changeData) self.lbl4 = QtGui.QLabel("y :", self) self.lbl4.setFixedSize(15, 36) self.CBox2 = QtGui.QComboBox() self.CBox2.addItem("") self.CBox2.setFixedSize(65, 36) # self.connect(self.CBox2,QtCore.SIGNAL('currentIndexChanged(const QString&)'),self.changeData) self.imp = QtGui.QPushButton('&import', self) self.imp.setFixedSize(100, 36) # self.connect(self.imp ,QtCore.SIGNAL("clicked()"),self.close) self.option_layout.addWidget(self.lbl2, 0, 0, 1, 1, QtCore.Qt.AlignCenter) self.option_layout.addWidget(self.tefile, 0, 1, 1, 4, QtCore.Qt.AlignLeft) self.option_layout.addWidget(self.browse, 0, 5, 1, 1, QtCore.Qt.AlignCenter) self.option_layout.addWidget(self.tbro, 1, 0, 10, 6, QtCore.Qt.AlignCenter) self.option_layout.addWidget(self.lbl3, 12, 0, 1, 1, QtCore.Qt.AlignRight) self.option_layout.addWidget(self.CBox1, 12, 1, 1, 1, QtCore.Qt.AlignLeft) self.option_layout.addWidget(self.lbl4, 12, 2, 1, 1, QtCore.Qt.AlignRight) self.option_layout.addWidget(self.CBox2, 12, 3, 1, 1, QtCore.Qt.AlignLeft) self.option_layout.addWidget(self.imp, 12, 5, 1, 1, QtCore.Qt.AlignLeft) self.graph_lay.addWidget(self.G) self.graph_lay.addWidget(self.navigation_toolbar, 0) self.main_lay.addWidget(self.graph_widget) self.main_lay.addWidget(self.test) if self.average: self.checkbox_average = QtGui.QCheckBox("Show average Value") self.connect(self.checkbox_average, QtCore.SIGNAL('clicked()'), self.addAverage) self.lbl1 = QtGui.QLabel() self.lbl1.setFixedWidth(250) average = self.averageValue() display = self.displayData( average, self.getStandardDeviation(self.y, average)) self.lbl1.setText('Average : ' + display) self.navigation_toolbar.addWidget(self.lbl1) self.navigation_toolbar.addWidget(self.checkbox_average) if adjust: self.G.adjust_x_lim(self.x, self.y) self.main_widget.setFocus() self.setCentralWidget(self.main_widget)
def __init__(self, parent=None): super(QtGui.QWidget, self).__init__(parent) self.do_output = False self.data_dir = '' self.has_selected_data_dir = False self.has_selected_output_dir = True self.setWindowTitle("Enter settings for Experiment YAML File") self.title_label = QtGui.QLabel("Enter Settings to Save as YAML File") self.main_vbox = QtGui.QVBoxLayout() self.title_hbox = QtGui.QHBoxLayout() self.title_hbox.addStretch() self.title_hbox.addWidget(self.title_label) self.title_hbox.addStretch() self.main_vbox.addLayout(self.title_hbox) # self.main_vbox.addStretch() # file name # self.file_name_hbox = QtGui.QHBoxLayout() self.file_name_field = QtGui.QLineEdit() # regexp = QtCore.QRegExp('(.+?)(\.[^.]*$|$') # validator = QtGui.QRegExpValidator(regexp) # self.file_name_field.setValidator(validator) self.file_name_label = QtGui.QLabel("Enter filename without extension") # self.file_name_hbox.addWidget(self.file_name_field) # self.file_name_hbox.addWidget(self.file_name_label) # self.main_vbox.addLayout(self.file_name_hbox) # data directory # self.data_dir_hbox = QtGui.QHBoxLayout() self.data_button = QtGui.QPushButton("Select Data Dir", self) self.data_button.clicked.connect(self.select_data) self.data_label = QtGui.QLabel( "Click to select a valid data directory") # self.data_dir_hbox.addWidget(self.data_button) # self.data_dir_hbox.addWidget(self.data_label) # self.main_vbox.addLayout(self.data_dir_hbox) # output directory self.output_dir_button = QtGui.QPushButton("Select Output Location", self) self.output_dir_button.clicked.connect(self.select_output_location) self.output_label = QtGui.QLabel( "Click to select directory to store Experiment YAML file") # Exp type # self.exp_type_hbox = QtGui.QHBoxLayout() self.exp_type_menu = QtGui.QComboBox(self) self.exp_type_menu.addItem("LEED") self.exp_type_menu.addItem("LEEM") self.exp_type_label = QtGui.QLabel("Select Experiment Type") # self.exp_type_hbox.addWidget(self.exp_type_menu) # self.exp_type_hbox.addWidget(self.exp_type_label) # self.main_vbox.addLayout(self.exp_type_hbox) # Data type # self.data_type_hbox = QtGui.QHBoxLayout() self.data_type_menu = QtGui.QComboBox(self) self.data_type_menu.addItem("Image") self.data_type_menu.addItem("Raw") self.data_type_label = QtGui.QLabel("Select Data Type") # self.data_type_hbox.addWidget(self.data_type_menu) # self.data_type_hbox.addWidget(self.data_type_label) # self.main_vbox.addLayout(self.data_type_hbox) self.data_type_menu.currentIndexChanged.connect( self.toggle_image_type_active) # Image type # self.image_type_hbox = QtGui.QHBoxLayout() self.image_type_menu = QtGui.QComboBox(self) self.image_type_menu.addItem("TIFF") self.image_type_menu.addItem("PNG") self.image_type_label = QtGui.QLabel("Select Image Type") # self.image_type_hbox.addWidget(self.image_type_menu) # self.image_type_hbox.addWidget(self.image_type_label) # self.main_vbox.addLayout(self.image_type_hbox) grid = QtGui.QGridLayout() grid.addWidget(self.file_name_field, 1, 0) grid.addWidget(self.file_name_label, 1, 1) grid.addWidget(self.data_button, 2, 0) grid.addWidget(self.data_label, 2, 1) grid.addWidget(self.output_dir_button, 3, 0) grid.addWidget(self.output_label, 3, 1) grid.addWidget(self.exp_type_menu, 4, 0) grid.addWidget(self.exp_type_label, 4, 1) grid.addWidget(self.data_type_menu, 5, 0) grid.addWidget(self.data_type_label, 5, 1) grid.addWidget(self.image_type_menu, 6, 0) grid.addWidget(self.image_type_label, 6, 1) grid.setHorizontalSpacing(100) grid.setVerticalSpacing(15) self.main_vbox.addLayout(grid) # Data Params self.data_params_hbox = QtGui.QHBoxLayout() self.data_params_hbox.addStretch() self.data_params_label = QtGui.QLabel("--Data Parameters--") self.data_params_hbox.addWidget(self.data_params_label) self.data_params_hbox.addStretch() self.main_vbox.addStretch() self.main_vbox.addLayout(self.data_params_hbox) self.im_hbox = QtGui.QHBoxLayout() self.im_width_field = QtGui.QLineEdit() self.im_width_field.setValidator(QtGui.QIntValidator(bottom=0)) self.im_width_label = QtGui.QLabel("Enter Image Width > 0") self.im_hbox.addWidget(self.im_width_field) self.im_hbox.addWidget(self.im_width_label) self.im_height_field = QtGui.QLineEdit() self.im_height_field.setValidator(QtGui.QIntValidator(bottom=0)) self.im_height_label = QtGui.QLabel("Enter Image Height > 0") self.im_hbox.addWidget(self.im_height_field) self.im_hbox.addWidget(self.im_height_label) self.im_bits_menu = QtGui.QComboBox() self.im_bits_menu.addItem("8") self.im_bits_menu.addItem("16") self.im_bits_label = QtGui.QLabel( "Select Image Bit Depth\n(only for Raw Data)") self.im_hbox.addWidget(self.im_bits_menu) self.im_hbox.addWidget(self.im_bits_label) self.im_byte_order_menu = QtGui.QComboBox() self.im_byte_order_menu.addItem("Little-Endian (Intel)") self.im_byte_order_menu.addItem("Big-Endian (Motorola)") self.im_byte_order_label = QtGui.QLabel( "Select Byte-Order for raw data") self.im_hbox.addWidget(self.im_byte_order_menu) self.im_hbox.addWidget(self.im_byte_order_label) self.main_vbox.addLayout(self.im_hbox) # Energy Params self.energy_params_label_hbox = QtGui.QHBoxLayout() self.energy_params_label_hbox.addStretch() self.energy_params_label = QtGui.QLabel("--Energy Parameters--") self.energy_params_label_hbox.addWidget(self.energy_params_label) self.energy_params_label_hbox.addStretch() self.main_vbox.addStretch() self.main_vbox.addLayout(self.energy_params_label_hbox) self.energy_params_hbox = QtGui.QHBoxLayout() self.min_energy_field = QtGui.QLineEdit() self.min_energy_field.setValidator(QtGui.QDoubleValidator()) self.min_energy_label = QtGui.QLabel("Enter Starting Energy in eV") self.max_energy_field = QtGui.QLineEdit() self.max_energy_field.setValidator(QtGui.QDoubleValidator()) self.max_energy_label = QtGui.QLabel("Enter Final Energy in eV") self.step_energy_field = QtGui.QLineEdit() self.step_energy_field.setValidator(QtGui.QDoubleValidator()) self.step_energy_label = QtGui.QLabel("Enter Step Energy in eV") self.energy_params_hbox.addWidget(self.min_energy_field) self.energy_params_hbox.addWidget(self.min_energy_label) self.energy_params_hbox.addStretch() self.energy_params_hbox.addWidget(self.max_energy_field) self.energy_params_hbox.addWidget(self.max_energy_label) self.energy_params_hbox.addStretch() self.energy_params_hbox.addWidget(self.step_energy_field) self.energy_params_hbox.addWidget(self.step_energy_label) self.main_vbox.addLayout(self.energy_params_hbox) self.main_vbox.addStretch() self.end_button_hbox = QtGui.QHBoxLayout() self.cancel_button = QtGui.QPushButton("Cancel", self) self.cancel_button.clicked.connect(lambda: self.close()) self.ok_button = QtGui.QPushButton("Ok", self) self.ok_button.clicked.connect(self.validate) self.end_button_hbox.addStretch() self.end_button_hbox.addWidget(self.cancel_button) self.end_button_hbox.addWidget(self.ok_button) self.main_vbox.addLayout(self.end_button_hbox) self.setLayout(self.main_vbox) # Center on Screen resolution = QtGui.QDesktopWidget().screenGeometry() self.move((resolution.width() / 2) - (self.frameSize().width() / 2), (resolution.height() / 2) - (self.frameSize().height() / 2)) self.show()
def __init__(self, parent=None): super(AttendanceGraph, self).__init__(parent) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8("icons/favicon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.setWindowIcon(icon) self.setWindowTitle( 'Employees\' Presence and Absence Average Count Comparison') fg = self.frameGeometry() cp = QtGui.QDesktopWidget().availableGeometry().center() fg.moveCenter(cp) self.move(fg.topLeft()) self.setMinimumSize(800, 500) logs = self.get_attendance_stat() if logs is not None: self.figure = Figure(figsize=(100, 600), facecolor='gray') self.canvas = FigureCanvas(self.figure) self.toolbar = Tb(self.canvas, self) graph = self.figure.add_subplot(111) graph.set_xlabel('Period', color='yellow') graph.set_ylabel('Count', color='yellow') x = np.array(logs['key']) y_presences = np.array(logs['attendance_ave']) y_absences = np.array(logs['absence_ave']) x_smooth = np.linspace(x.min(), x.max(), 300) y_presences_smooth = spline(x, y_presences, x_smooth) y_absences_smooth = spline(x, y_absences, x_smooth) # graph.plot(x, y_presences, linestyle=' ', marker='o', color='blue') # graph.plot(x_smooth, y_presences_smooth, label='average presence count', color='blue') # graph.plot(x, y_absences, linestyle=' ', marker='o', color='orange') # graph.plot(x_smooth, y_absences_smooth, label='average absence count', color='orange') graph.plot(x, y_presences, linestyle=' ', marker='o', color='blue') graph.plot(logs['key'], logs['attendance_ave'], label='average presence count', color='blue') graph.plot(x, y_absences, linestyle=' ', marker='o', color='orange') graph.plot(logs['key'], logs['absence_ave'], label='average absence count', color='orange') graph.grid(linestyle='-') graph.legend(loc='upper left') graph.ticklabel_format(useOffset=False) layout = QtGui.QVBoxLayout() layout.addWidget(self.toolbar) layout.addWidget(self.canvas) self.setLayout(layout) self.setWindowModality(QtCore.Qt.ApplicationModal)
def __init__(self): """ Class constructor >>> 1 + 1 2 >>> """ super(DySMainWindow, self).__init__() # self.setAttribute(QtCore.Qt.WA_TranslucentBackground, 90) # minimum size self.setMinimumSize(500, 500) # computer information self._hostname = socket.gethostname() print "self._hostname =", self._hostname # style # self.setStyle("windows") # plastique # cde # motif # sgi # windows # cleanlooks # mac # icon self.setWindowIcon(QtGui.QIcon(":/application.png")) QtGui.QSystemTrayIcon(QtGui.QIcon(":/application.png")) # location of window on self.screen_geometry self.window_offset_x = 250 self.window_offset_y = 50 # language settings self.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) # window name self.setWindowTitle("DyS") # font self.font = QtGui.QFont("Consolas", 10) # mouse tracking self.setMouseTracking(True) # context menu self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # main window flags self.flags = QtCore.Qt.Window __main_dir = current_working_directory self._working_directory = QtCore.QString(os.path.abspath(__main_dir).replace("/", "\\")) # get screen geometry size self.screen_geometry = QtGui.QDesktopWidget().screenGeometry() # move # self.move(self.window_offset_x, self.window_offset_y) dy = .05*self.screen_geometry.height() # size of application # position main widget on self.screen_geometry self.setGeometry(.25*self.screen_geometry.width(), dy, .5*self.screen_geometry.width(), .5*self.screen_geometry.width()) # MBD system MBD_folder_name_ = None self.MBD_file_abs_path = None # self.MBD_filename = "0_0_0_double_pendulum.dprj" # MBD_folder_name_ = "dynamic_systems\\0_0_0_double_pendulum" # self.MBD_filename = "dys_0_.dprj" # MBD_folder_name_ = "dynamic_systems\\0_" # self.MBD_filename = "dys_0_2_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_2_1" # self.MBD_filename = "dys_0_3_prismatic_joint.dprj" # MBD_folder_name_ = "dynamic_systems\\0_3_prismatic_joint" # self.MBD_filename = "dys_0_4.dprj" # MBD_folder_name_ = "dynamic_systems\\0_4" # self.MBD_filename = "dys_0_5.dprj" # MBD_folder_name_ = "dynamic_systems\\0_5" # self.MBD_filename = "dys_0_6_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_6_1" # self.MBD_filename = "dys_0_6_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_6_2" # self.MBD_filename = "dys_0_7_0_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_0_1" # self.MBD_filename = "dys_0_7_0_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_0_2" # self.MBD_filename = "0_7_3_3_kinematic_analysis_1arm.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_1arm" # self.MBD_filename = "0_7_3_3_kinematic_analysis_2arm.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_2arm" # self.MBD_filename = "0_7_3_3_kinematic_analysis_slider_crank.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_slider_crank" # self.MBD_filename = "0_7_3_3_kinematic_analysis_4bar.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_4bar" # self.MBD_filename = "0_7_3_3_kinematic_analysis_efi.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_kinematic_analysis_efi" # self.MBD_filename = "0_7_3_3_dynamic_analysis_efi.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_dynamic_analysis_efi" # self.MBD_filename = "0_7_3_3_dynamic_analysis_efi_V2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_3_dynamic_analysis_efi_V2" # self.MBD_filename = "dys_0_7_3_0.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_0" # self.MBD_filename = "0_7_3_0_plane_sphere.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_0_plane_sphere" # self.MBD_filename = "dys_0_7_2_revolute_clearence_joint.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_2_revolute_clearence_joint" # self.MBD_filename = "0_7_2_revolute_clearance_joint_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_2_revolute_clearance_joint_1" # self.MBD_filename = "0_7_3_0_contact_models.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_0_contact_models" self.MBD_filename = "0_7_3_0_contact_models_cylinder.dprj" MBD_folder_name_ = "dynamic_systems\\0_7_3_0_contact_models_cylinder" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_2" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_paper.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_paper" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_paper_1.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_paper_1" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_paper_2.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_paper_2" # self.MBD_filename = "0_7_1_0_spring_translational.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_1_0_spring_translational" # self.MBD_filename = "0_8_0_surface_roughness.dprj" # MBD_folder_name_ = "dynamic_systems\\0_8_0_surface_roughness" # self.MBD_filename = "0_9_0_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_0_brush_slip-ring" # self.MBD_filename = "0_9_1_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_1_brush_slip-ring" # self.MBD_filename = "0_9_2_multiple_contacts.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_2_multiple_contacts" # self.MBD_filename = "0_9_3_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_3_brush_slip-ring" # self.MBD_filename = "0_9_4_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_4_brush_slip-ring" # self.MBD_filename = "0_9_5_brush_energy.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_5_brush_energy" # self.MBD_filename = "0_9_6_brush_slip-ring.dprj" # MBD_folder_name_ = "dynamic_systems\\0_9_6_brush_slip-ring" # self.MBD_filename = "1_0_0_ancf-beam.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-beam" # self.MBD_filename = "1_0_0_ancf-cantilever_1element.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_1element" # self.MBD_filename = "1_0_0_ancf-cantilever_2elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_2elements" # self.MBD_filename = "1_0_0_ancf-cantilever_2elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_2elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_4elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_4elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_8elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_8elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_16elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_16elements" # # self.MBD_filename = "1_0_0_ancf-cantilever_32elements.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_32elements" # self.MBD_filename = "1_0_0_ancf-free_falling_flexible_pendulum.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-free_falling_flexible_pendulum" # self.MBD_filename = "1_0_0_ancf-cantilever_M.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-cantilever_M" # self.MBD_filename = "1_0_0_ancf-beam_contact.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_0_ancf-beam_contact" # self.MBD_filename = "1_0_1_ancf_frame.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_ancf_frame" # self.MBD_filename = "1_0_1_geometry_test.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_geometry_test" # self.MBD_filename = "1_0_1_external_force.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_external_force" # self.MBD_filename = "1_0_1_paper_2_eigenfrequencies.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_eigenfrequencies" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_point_mass.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_point_mass" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_sub.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_sub" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_y_spring=-1mm.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_y_spring=-1mm" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_y_spring=+1mm.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_y_spring=+1mm" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_prestress_2x.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_prestress_2x" #self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_prestress_params_2x.dprj" #MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_prestress_params_2x" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_2_prestress_0.5x.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_2_prestress_0.5x" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_rigid.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_rigid" # self.MBD_filename = "1_0_1_paper_2_dynamic_system_rigid_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_dynamic_system_rigid_2" # self.MBD_filename = "0_7_3_2_pin_slot_clearance_joint_testing.dprj" # MBD_folder_name_ = "dynamic_systems\\0_7_3_2_pin_slot_clearance_joint_testing" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_rigid_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_rigid_flexible" # self.MBD_filename = "1_0_1_paper_2_revolute_joint_flexible_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_revolute_joint_flexible_flexible" # self.MBD_filename = "1_0_1_paper_2_revolute_joint_rigid_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_revolute_joint_rigid_flexible" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_point_mass_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_point_mass_flexible" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_point_mass_flexible_offset.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_point_mass_flexible_offset" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_rigid_flexible.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_rigid_flexible" # self.MBD_filename = "1_0_1_paper_2_rigid_joint_rigid_flexible_2.dprj" # MBD_folder_name_ = "dynamic_systems\\1_0_1_paper_2_rigid_joint_rigid_flexible_2" # predefine attributes self.simulation_control_widget = None self._visualization_widget = "vtk" # file is not defined if MBD_folder_name_ is None: self.MBD_folder_abs_path = os.getcwd() self.MBD_filename = project_filename = "Model_1" print "File is not defined" # file is defined else: self._working_directory = os.path.join(os.getcwd(), "..") self.MBD_file_abs_path = os.path.abspath(os.path.join(self._working_directory, MBD_folder_name_, self.MBD_filename)) self.MBD_folder_abs_path = os.path.join(self._working_directory, MBD_folder_name_) project_filename = os.path.basename(self.MBD_folder_abs_path) self._file_types = "Dynamic System Project File (*.dprj);;Multibody System File (*.mbd)" self.project = MBD_system_items.MBDsystemItem("MBDProject", parent=None) self.project.dys = self # print "self.MBD_folder_abs_path =", self.MBD_folder_abs_path self.MBD_system = MBDsystem(MBD_file_abs_path=self.MBD_file_abs_path, MBD_folder_abs_path=self.MBD_folder_abs_path, MBD_filename=project_filename, dys=self, parent=self.project) # tree view widget self.tree_view_widget = TreeViewWidget(self.project, self.MBD_system, parent=self) self.tree_view_widget.setWindowFlags(self.flags) # self.tree_view_widget.show() # move self.tree_view_widget.move(.18*self.screen_geometry.width() - self.tree_view_widget.frameGeometry().width(), dy)#self.frameGeometry().width(), self.frameGeometry().height()) self.tree_view_widget.resize(.20*self.screen_geometry.width(), 0.8 * self.screen_geometry.height()) # simulation control widget self.simulation_control_widget = SimulationControlWidget(MBD_system=self.MBD_system, parent=self) self.simulation_control_widget.setWindowFlags(self.flags) # self.simulation_control_widget.show() # move self.simulation_control_widget.move(.25*self.screen_geometry.width() + self.geometry().width(), dy) # preferences widget self.preferences_widget = PreferencesWidget(self.simulation_control_widget, parent=None) # graph widget - test for measure in self.MBD_system.measures: measure.graph_widget.setWindowFlags(self.flags) measure.graph_widget.show() # set central widget self.setCentralWidget(self.simulation_control_widget.vtkWidget) # self.simulation_control_widget.vtkWidget.displayText() # print "2 =", self.simulation_control_widget.vtkWidget.vtkWidget.GetSize() # if self.simulation_control_widget.opengl_widget is not None: # self.setCentralWidget(self.simulation_control_widget.opengl_widget) # init graph widget - test # graph_widget = GraphWidget(parent=self) # graph_widget.setWindowFlags(self.flags) # graph_widget.show() # output widget # maybe put in new thread? if output will be large # self.OutputWidget = OutputWidget(parent=self) # self.OutputWidget.setWindowFlags(self.flags) # self.OutputWidget.show() # job list widget self.JobListWidget = JobListWidget(job_list_=["job1", "job2", "job3"], parent=self) self.JobListWidget.setWindowFlags(self.flags) # python console self.python_console = None#PythonConsole() # resize # self.resize(self.simulation_control_widget.opengl_widget.initial_window_width, self.simulation_control_widget.opengl_widget.initial_window_height) # create actions self.create_actions() # create menus self.create_menus() # create status bar self.create_status_bar() # signals and connections self.connect_signals()