当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QErrorMessage类代码示例

本文整理汇总了Python中PyQt4.QtGui.QErrorMessage的典型用法代码示例。如果您正苦于以下问题:Python QErrorMessage类的具体用法?Python QErrorMessage怎么用?Python QErrorMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QErrorMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: accept

 def accept(self):
     """Acepta el dialogo. Coge la operacion con la que esta trabajando 
     el usuario e inicia el procedimiento de calculo"""
     from pyrqt.excepciones import OpcionesIncorrectaException
     import rpy
     nombre = unicode(self.ui.treeWidget.currentItem().text(0))
     widget = self.__widgets["operaciones"][nombre]
     try:
         resultado = self.__gestoroperaciones[nombre].procedimiento(widget.seleccion(), widget.opciones())
     except OpcionesIncorrectaException:
         errormessage = QErrorMessage(self)
         errormessage.showMessage(u"Las opciones no son correctas")
     #except IndexError:
     #    errormessage = QErrorMessage(self)
     #    errormessage.showMessage(u"Seleccion incorrecta")
     #    LOG.exception("excepcion capturada")
     except KeyError:
         QErrorMessage(self).showMessage(u"Hay elementos de la salida sin definir(o mal definidos) en la operación")
         LOG.exception("Excepción Generada por un módulo de operaciones")
     except rpy.RException:
         QErrorMessage(self).showMessage(u"R devolvio un error")
         log.exception("Excepción de RPY")
     except AssertionError:
         QErrorMessage(self).showMessage(u"Error desconocido")
     else:
         self.__vsalida.ana_res(resultado) #Añadir a la salida el resultado
         self.__vsalida.hide() #TODO averiguar como hacer para que recupere el foco sin ocultar la ventana
         self.__vsalida.show()
开发者ID:nesaro,项目名称:driza,代码行数:28,代码来源:doperaciones.py

示例2: input_device_changed

    def input_device_changed(self, index):
        success, index = self.audio_device.select_input_device(index)
        self.ui.DeviceList.setCurrentIndex(index)
        self.fft_plot.must_plot = True
        if not success:
# Note: the error message is a child of the settings dialog, so that
# that dialog remains on top when the error message is closed
            error_message = QErrorMessage(self.settings_dialog)
            error_message.setWindowTitle("Input device error")
            error_message.showMessage("Impossible to use the selected input"
                                      " device, reverting to the previous one")
开发者ID:benni3456,项目名称:audio_analyser,代码行数:11,代码来源:audio_analyser.py

示例3: second_channel_changed

	def second_channel_changed(self, index):
		self.ui.actionStart.setChecked(False)
		
		success, index = self.audiobackend.select_second_channel(index)
		
		self.settings_dialog.comboBox_secondChannel.setCurrentIndex(index)
		
		if not success:
			# Note: the error message is a child of the settings dialog, so that
			# that dialog remains on top when the error message is closed
			error_message = QErrorMessage(self.settings_dialog)
			error_message.setWindowTitle("Input device error")
			error_message.showMessage("Impossible to use the selected channel as the second channel, reverting to the previous one")
		
		self.ui.actionStart.setChecked(True)
开发者ID:neojjang,项目名称:friture,代码行数:15,代码来源:analyzer.py

示例4: __init__

 def __init__(self, ipcon, uid, version):
     PluginBase.__init__(self, ipcon, uid, 'DC Brick', version)
     
     self.setupUi(self)
     self.encoder_hide_all()
     
     self.dc = BrickDC(uid, ipcon)
     self.device = self.dc
     
     self.update_timer = QTimer()
     self.update_timer.timeout.connect(self.update_data)
     
     self.speedometer = SpeedoMeter()
     self.vertical_layout_right.insertWidget(4, self.speedometer)
     
     self.new_value = 0
     self.update_counter = 0
     
     self.full_brake_time = 0
     
     self.velocity_slider.sliderReleased.connect(self.velocity_slider_released)
     self.velocity_slider.valueChanged.connect(self.velocity_spin.setValue)
     self.velocity_spin.editingFinished.connect(self.velocity_spin_finished)
     
     self.acceleration_slider.sliderReleased.connect(self.acceleration_slider_released)
     self.acceleration_slider.valueChanged.connect(self.acceleration_spin.setValue)
     self.acceleration_spin.editingFinished.connect(self.acceleration_spin_finished)
     
     self.frequency_slider.sliderReleased.connect(self.frequency_slider_released)
     self.frequency_slider.valueChanged.connect(self.frequency_spin.setValue)
     self.frequency_spin.editingFinished.connect(self.frequency_spin_finished)
     
     self.radio_mode_brake.toggled.connect(self.brake_value_changed)
     self.radio_mode_coast.toggled.connect(self.coast_value_changed)
     
     self.minimum_voltage_button.pressed.connect(self.minimum_voltage_button_pressed)
     self.full_brake_button.pressed.connect(self.full_brake_pressed)
     self.enable_checkbox.stateChanged.connect(self.enable_state_changed)
     
     self.emergency_signal = None
     self.under_signal = None
     self.current_velocity_signal = None
     self.velocity_reached_signal = None
     
     self.qem = QErrorMessage(self)
     
     self.qtcb_under_voltage.connect(self.cb_under_voltage)
     self.dc.register_callback(self.dc.CALLBACK_UNDER_VOLTAGE,
                               self.qtcb_under_voltage.emit) 
     
     self.qtcb_emergency_shutdown.connect(self.cb_emergency_shutdown)
     self.dc.register_callback(self.dc.CALLBACK_EMERGENCY_SHUTDOWN,
                               self.qtcb_emergency_shutdown.emit) 
     
     self.qtcb_position_reached.connect(self.update_velocity)
     self.dc.register_callback(self.dc.CALLBACK_VELOCITY_REACHED,
                               self.qtcb_position_reached.emit) 
     self.dc.register_callback(self.dc.CALLBACK_CURRENT_VELOCITY,
                               self.qtcb_position_reached.emit)
开发者ID:karstenerhardt,项目名称:brickv,代码行数:59,代码来源:dc.py

示例5: __init__

    def __init__(self, parent=None):
        """The constructor sets up the MainWindow widget, and connects
        all necessary signals and slots
        """
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        # We store the window size to make sure the previous window size
        # is restored when leaving fullscreen mode. This varible is used
        # in the toggleFullscreen slot.
        self.__tmpWinSize = self.size()
        self.eventFilter = LumaEventFilter(self)

        self.mainTabs.installEventFilter(self.eventFilter)

        self.translator = QTranslator()
        self.languageHandler = LanguageHandler()
        self.languages = self.languageHandler.availableLanguages

        #self.__createPluginToolBar()
        self.__createLoggerWidget()
        self.__loadSettings()
        self.__createLanguageOptions()

        self.setStatusBar(self.statusBar)

        self.mainTabs.setTabsClosable(True)
        self.mainTabs.setContextMenuPolicy(Qt.CustomContextMenu)
        self.mainTabs.customContextMenuRequested.connect(
            self.__mainTabsContextMenu)

        self.defaultTabStyle = ''
        self.lumaHeadStyle = 'background: url(:/icons/luma-gray);\n' + \
                     'background-position: bottom right;\n' + \
                     'background-attachment: fixed;\n' + \
                     'background-repeat:  no-repeat;'

        #Sets up pluginWidget
        #self in parameter is used to call pluginSelected here...
        self.pluginWidget = PluginListWidget(self)
        self.showPlugins()

        self.welcomeTab = WelcomeTab()
        self.welcomeTab.textBrowser.setStyleSheet(self.lumaHeadStyle)

        #This value comes from __loadSettings()
        #Its a checkbox set in WelcomeTab
        if self.showWelcomeSettings == 2:
            self.showWelcome()
        else:
            # Let's do some styling of the tab widget when no tabs are opened
            if self.mainTabs.currentIndex() == -1:
                self.__setTabWidgetStyle(self.lumaHeadStyle)

            self.actionShowWelcomeTab.setEnabled(True)

        self.serversChangedMessage = QErrorMessage(self)
开发者ID:einaru,项目名称:luma,代码行数:56,代码来源:MainWindow.py

示例6: __init__

    def __init__(self, args):
        super(QApplication, self).__init__(args)

        self.error_msg = QErrorMessage()
        self.error_msg.setWindowTitle("Starter Kit: Blinkenlights Demo " + config.DEMO_VERSION)

        signal.signal(signal.SIGINT, self.exit_demo)
        signal.signal(signal.SIGTERM, self.exit_demo)

        self.make_gui()
        self.connect()
开发者ID:chuangke365,项目名称:blinkenlights,代码行数:11,代码来源:demo.py

示例7: __init__

    def __init__(self, args):
        super(QApplication, self).__init__(args)

        self.error_msg = QErrorMessage()
        self.ipcon = IPConnection()

        signal.signal(signal.SIGINT, self.exit_demo)
        signal.signal(signal.SIGTERM, self.exit_demo)

        timer = QTimer(self)
        timer.setSingleShot(True)
        timer.timeout.connect(self.connect)
        timer.start(1)
开发者ID:sherckuith,项目名称:weather-station,代码行数:13,代码来源:demo.py

示例8: __init__

    def __init__(self, parent=None):
        super(DialogService, self).__init__(parent)

        # All-purpose error popup message:
        # Used by self.showErrorMsgByErrorCode(<errorCode>),
        # or self.showErrorMsg(<string>). Returns a
        # QErrorMessage without parent, but with QWindowFlags set
        # properly to be a dialog popup box:
        self.errorMsgPopup = QErrorMessage.qtHandler()
        # Re-parent the popup, retaining the window flags set
        # by the qtHandler:
        self.errorMsgPopup.setParent(parent, self.errorMsgPopup.windowFlags())
        # self.errorMsgPopup.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        self.infoMsg = QMessageBox(parent=parent)
开发者ID:ros-visualization,项目名称:echo_tree,代码行数:14,代码来源:tester_gui.py

示例9: crear_y_seleccionar_archivo

    def crear_y_seleccionar_archivo(self, nombre):
        # Quita la extension si llega a tenerla.
        nombre = nombre.replace('.py', '')
        nombre += ".py"
        nombre_de_archivo = nombre

        if self.ruta_del_archivo_actual:
            base_path = os.path.abspath(os.path.dirname(self.ruta_del_archivo_actual))
            ruta = os.path.join(base_path, unicode(nombre_de_archivo))
        else:
            ruta = unicode(nombre_de_archivo)

        if os.path.exists(ruta):
            self._tmp_dialog = QErrorMessage(self)
            self._tmp_dialog.showMessage("Ya existe un archivo con ese nombre")
        else:
            self._crear_archivo_nuevo_en(ruta)

            self.cargar_contenido_desde_archivo(ruta)
            self.ruta_del_archivo_actual = ruta
            self.watcher.cambiar_archivo_a_observar(ruta)
            self.ejecutar()
            self.main.actualizar_el_listado_de_archivos()
开发者ID:pprofpc,项目名称:pilas,代码行数:23,代码来源:editor.py

示例10: run_gui

        otherinstance = True
    else:
        # On windows only singleinstance can be trusted
        otherinstance = True if iswindows else False
    if not otherinstance and not opts.shutdown_running_calibre:
        return run_gui(opts, args, actions, listener, app, gui_debug=gui_debug)

    communicate(opts, args)

    return 0


if __name__ == '__main__':
    try:
        sys.exit(main())
    except Exception as err:
        if not iswindows:
            raise
        tb = traceback.format_exc()
        from PyQt4.QtGui import QErrorMessage
        logfile = os.path.join(os.path.expanduser('~'), 'calibre.log')
        if os.path.exists(logfile):
            log = open(logfile).read().decode('utf-8', 'ignore')
            d = QErrorMessage()
            d.showMessage(('<b>Error:</b>%s<br><b>Traceback:</b><br>'
                '%s<b>Log:</b><br>%s')%(unicode(err),
                    unicode(tb).replace('\n', '<br>'),
                    log.replace('\n', '<br>')))


开发者ID:Pipeliner,项目名称:calibre,代码行数:28,代码来源:main.py

示例11: Editor

class Editor(editor_base.EditorBase):
    """Representa el editor de texto que aparece en el panel derecho.

    El editor soporta autocompletado de código y resaltado de sintáxis.
    """

    # Señal es emitida cuando el Editor ejecuta codigo
    signal_ejecutando = QtCore.pyqtSignal()

    def __init__(self, main, interpreterLocals, consola_lanas, ventana_interprete):
        super(Editor, self).__init__()
        self.cantidad_ejecuciones = 0
        self.consola_lanas = consola_lanas
        self.ventana_interprete = ventana_interprete
        self.ruta_del_archivo_actual = None
        self.interpreterLocals = interpreterLocals
        self.setLineWrapMode(QTextEdit.NoWrap)
        self._cambios_sin_guardar = False
        self.main = main
        self.nombre_de_archivo_sugerido = ""
        self.watcher = pilasengine.watcher.Watcher(None, self.cuando_cambia_archivo_de_forma_externa)

    def crear_archivo_inicial(self):
        dirpath = tempfile.mkdtemp()
        archivo_temporal = os.path.join(dirpath, "mi_juego.py")
        archivo = codecs.open(archivo_temporal, "w", 'utf-8')
        archivo.write(CODIGO_INICIAL)
        archivo.close()
        #print("Creando el archivo " + str(archivo_temporal))
        self.abrir_archivo_del_proyecto(archivo_temporal)

    def es_archivo_iniciar_sin_guardar(self):
        return self.nombre_de_archivo_sugerido == ""

    def crear_y_seleccionar_archivo(self, nombre):
        # Quita la extension si llega a tenerla.
        nombre = nombre.replace('.py', '')
        nombre += ".py"
        nombre_de_archivo = nombre

        if self.ruta_del_archivo_actual:
            base_path = os.path.abspath(os.path.dirname(self.ruta_del_archivo_actual))
            ruta = os.path.join(base_path, unicode(nombre_de_archivo))
        else:
            ruta = unicode(nombre_de_archivo)

        if os.path.exists(ruta):
            self._tmp_dialog = QErrorMessage(self)
            self._tmp_dialog.showMessage("Ya existe un archivo con ese nombre")
        else:
            self._crear_archivo_nuevo_en(ruta)

            self.cargar_contenido_desde_archivo(ruta)
            self.ruta_del_archivo_actual = ruta
            self.watcher.cambiar_archivo_a_observar(ruta)
            self.ejecutar()
            self.main.actualizar_el_listado_de_archivos()

    def _crear_archivo_nuevo_en(self, ruta):
        fo = open(ruta, "wb")
        fo.write("# contenido")
        fo.close()

    def obtener_archivos_del_proyecto(self):
        base_path = os.path.dirname(self.nombre_de_archivo_sugerido)
        listado = os.listdir(base_path)

        return [x for x in listado if x.endswith('.py')]

    def keyPressEvent(self, event):
        "Atiene el evento de pulsación de tecla."
        self._cambios_sin_guardar = True

        # Permite usar tab como seleccionador de la palabra actual
        # en el popup de autocompletado.
        if event.key() in [Qt.Key_Tab]:
            if self.completer and self.completer.popup().isVisible():
                event.ignore()
                nuevo_evento = QKeyEvent(QKeyEvent.KeyPress, Qt.Key_Return, Qt.NoModifier)
                try:
                    if self.autocomplete(nuevo_evento):
                        return None
                except UnicodeEncodeError:
                    pass
                return None


        if editor_base.EditorBase.keyPressEvent(self, event):
            return None

        # Elimina los pares de caracteres especiales si los encuentra
        if event.key() == Qt.Key_Backspace:
            self._eliminar_pares_de_caracteres()
            self._borrar_un_grupo_de_espacios(event)

        if self.autocomplete(event):
            return None


        if event.key() == Qt.Key_Return:
#.........这里部分代码省略.........
开发者ID:pprofpc,项目名称:pilas,代码行数:101,代码来源:editor.py

示例12: __init__

 def __init__ (self, ipcon, uid):
     PluginBase.__init__(self, ipcon, uid)
     self.setupUi(self)
     
     self.servo = brick_servo.Servo(self.uid)
     self.device = self.servo
     self.ipcon.add_device(self.servo)
     self.version = '.'.join(map(str, self.servo.get_version()[1]))
     
     self.update_timer = QTimer()
     self.update_timer.timeout.connect(self.update_apply)
     self.update_timer.setInterval(0)
     self.update_timer.setSingleShot(True)
     
     layout = QVBoxLayout(self)
     layout.addWidget(QLabel('Servo'))
     self.position_list = []
     self.velocity_list = []
     self.acceleration_list = []
     self.enable_list = []
     
     self.up_ena = [0]*7
     self.up_pos = [0]*7
     self.up_vel = [0]*7
     self.up_acc = [0]*7
     
     self.alive = True
     
     for i in range(1, 8):
         label = QLabel()
         label.setText('Off')
         self.enable_list.append(label)
         self.status_grid.addWidget(label, i, 1)
         
     for i in range(1, 8):
         pk = PositionKnob()
         self.position_list.append(pk)
         self.status_grid.addWidget(pk, i, 2)
         
     for i in range(1, 8):
         cb = ColorBar(Qt.Vertical)
         self.velocity_list.append(cb)
         self.status_grid.addWidget(cb, i, 3)
         
     for i in range(1, 8):
         cb = ColorBar(Qt.Vertical)
         self.acceleration_list.append(cb)
         self.status_grid.addWidget(cb, i, 4)
         
     self.qem = QErrorMessage(self)
     self.qem.setWindowTitle("Under Voltage")
         
     self.test_button.clicked.connect(self.test_button_clicked)
     self.output_voltage_button.clicked.connect(self.output_voltage_button_clicked)
         
     self.servo_dropbox.currentIndexChanged.connect(lambda x: self.update_servo_specific())
     self.enable_checkbox.stateChanged.connect(self.enable_state_changed)
     
     self.position_slider.sliderReleased.connect(self.position_slider_released)
     self.position_slider.valueChanged.connect(self.position_spin.setValue)
     self.position_spin.editingFinished.connect(self.position_spin_finished)
     
     self.velocity_slider.sliderReleased.connect(self.velocity_slider_released)
     self.velocity_slider.valueChanged.connect(self.velocity_spin.setValue)
     self.velocity_spin.editingFinished.connect(self.velocity_spin_finished)
     
     self.acceleration_slider.sliderReleased.connect(self.acceleration_slider_released)
     self.acceleration_slider.valueChanged.connect(self.acceleration_spin.setValue)
     self.acceleration_spin.editingFinished.connect(self.acceleration_spin_finished)
     
     self.period_slider.sliderReleased.connect(self.period_slider_released)
     self.period_slider.valueChanged.connect(self.period_spin.setValue)
     self.period_spin.editingFinished.connect(self.period_spin_finished)
     
     self.pulse_width_min_spin.editingFinished.connect(self.pulse_width_spin_finished)
     self.pulse_width_max_spin.editingFinished.connect(self.pulse_width_spin_finished)
     self.degree_min_spin.editingFinished.connect(self.degree_spin_finished)
     self.degree_max_spin.editingFinished.connect(self.degree_spin_finished)
     
     self.minimum_voltage_button.pressed.connect(self.minimum_voltage_button_pressed)
     
     self.qtcb_under_voltage.connect(self.cb_under_voltage)
     self.servo.register_callback(self.servo.CALLBACK_UNDER_VOLTAGE,
                                  self.qtcb_under_voltage.emit) 
     
     class WorkerThread(QThread):
         def __init__(self, parent = None, func = None):
             QThread.__init__(self, parent)
             self.func = func
             
         def run(self):
             self.func()
     
     
     self.test_event = Event()
     self.test_thread_object = WorkerThread(self, self.test_thread)
     self.update_event = Event()
     self.update_thread_object = WorkerThread(self, self.update_thread)
     
     self.update_done_event = Event()
#.........这里部分代码省略.........
开发者ID:smunix,项目名称:brickv,代码行数:101,代码来源:servo.py

示例13: correct

    except socket.error:  # Good si is correct (on UNIX)
        otherinstance = True
    else:
        # On windows only singleinstance can be trusted
        otherinstance = True if iswindows else False
    if not otherinstance and not opts.shutdown_running_calibre:
        return run_gui(opts, args, listener, app, gui_debug=gui_debug)

    communicate(opts, args)

    return 0


if __name__ == "__main__":
    try:
        sys.exit(main())
    except Exception as err:
        if not iswindows:
            raise
        tb = traceback.format_exc()
        from PyQt4.QtGui import QErrorMessage

        logfile = os.path.join(os.path.expanduser("~"), "calibre.log")
        if os.path.exists(logfile):
            log = open(logfile).read().decode("utf-8", "ignore")
            d = QErrorMessage()
            d.showMessage(
                ("<b>Error:</b>%s<br><b>Traceback:</b><br>" "%s<b>Log:</b><br>%s")
                % (unicode(err), unicode(tb).replace("\n", "<br>"), log.replace("\n", "<br>"))
            )
开发者ID:NoxDineen,项目名称:calibre,代码行数:30,代码来源:main.py

示例14: WeatherStation

class WeatherStation(QApplication):
    HOST = "localhost"
    PORT = 4223

    ipcon = None
    lcd = None
    al = None
    hum = None
    baro = None

    projects = []
    active_project = None

    error_msg = None

    def __init__(self, args):
        super(QApplication, self).__init__(args)

        self.error_msg = QErrorMessage()
        self.ipcon = IPConnection()

        signal.signal(signal.SIGINT, self.exit_demo)
        signal.signal(signal.SIGTERM, self.exit_demo)

        timer = QTimer(self)
        timer.setSingleShot(True)
        timer.timeout.connect(self.connect)
        timer.start(1)

    def exit_demo(self, signl=None, frme=None):
        try:
            self.ipcon.disconnect()
            self.timer.stop()
            self.tabs.destroy()
        except:
            pass

        sys.exit()

    def open_gui(self):
        self.main = MainWindow(self)
        self.main.setFixedSize(730, 430)
        self.main.setWindowIcon(QIcon(os.path.join(ProgramPath.program_path(), "demo-icon.png")))
        
        self.tabs = QTabWidget()
        
        widget = QWidget()
        layout = QVBoxLayout()
        layout.addWidget(self.tabs)
        widget.setLayout(layout)

        self.main.setCentralWidget(widget)
        
        self.projects.append(ProjectEnvDisplay(self.tabs, self))
        self.projects.append(ProjectStatistics(self.tabs, self))
        self.projects.append(ProjectXively(self.tabs, self))

        self.tabs.addTab(self.projects[0], "Display Environment Measurements")
        self.tabs.addTab(self.projects[1], "Show Statistics with Button Control")
        self.tabs.addTab(self.projects[2], "Connect to Xively")

        self.active_project = self.projects[0]

        self.tabs.currentChanged.connect(self.tabChangedSlot)

        self.main.setWindowTitle("Starter Kit: Weather Station Demo " + config.DEMO_VERSION)
        self.main.show()

    def connect(self):
        try:
            self.ipcon.connect(WeatherStation.HOST, WeatherStation.PORT)
        except Error as e:
            self.error_msg.showMessage('Connection Error: ' + str(e.description) + "\nBrickd installed and running?")
            return
        except socket.error as e:
            self.error_msg.showMessage('Socket error: ' + str(e) + "\nBrickd installed and running?")
            return

        self.ipcon.register_callback(IPConnection.CALLBACK_ENUMERATE,
                                     self.cb_enumerate)
        self.ipcon.register_callback(IPConnection.CALLBACK_CONNECTED,
                                     self.cb_connected)

        try:
            self.ipcon.enumerate()
        except Error as e:
            self.error_msg.showMessage('Enumerate Error: ' + str(e.description))
            return

        self.open_gui()

    def tabChangedSlot(self, tabIndex):

        if self.lcd is not None:
            self.lcd.clear_display()

        self.active_project = self.projects[tabIndex]

    def cb_illuminance(self, illuminance):
        for p in self.projects:
#.........这里部分代码省略.........
开发者ID:sherckuith,项目名称:weather-station,代码行数:101,代码来源:demo.py

示例15: Blinkenlights

class Blinkenlights(QApplication):
    HOST = "localhost"
    PORT = 4223

    ipcon = None

    projects = []
    active_project = None

    error_msg = None

    def __init__(self, args):
        super(QApplication, self).__init__(args)

        self.error_msg = QErrorMessage()
        self.error_msg.setWindowTitle("Starter Kit: Blinkenlights Demo " + config.DEMO_VERSION)

        signal.signal(signal.SIGINT, self.exit_demo)
        signal.signal(signal.SIGTERM, self.exit_demo)

        self.make_gui()
        self.connect()

    def exit_demo(self, signl=None, frme=None):
        try:
            self.ipcon.disconnect()
            self.timer.stop()
            self.tabs.destroy()
        except:
            pass

        sys.exit()

    def make_gui(self):
        self.main = MainWindow(self)
        self.main.setWindowIcon(QIcon(os.path.join(ProgramPath.program_path(), "demo-icon.png")))

        self.tabs = QTabWidget()

        widget = QWidget()
        layout = QVBoxLayout()
        layout.addWidget(self.tabs)
        widget.setLayout(layout)

        self.main.setCentralWidget(widget)

        self.setup = SetupWidget(self.tabs, self)
        self.tetris = TetrisWidget(self.tabs, self)
        self.pong = PongWidget(self.tabs, self)
        self.fire = FireWidget(self.tabs, self)
        self.text = TextWidget(self.tabs, self)
        self.images = ImagesWidget(self.tabs, self)
        self.rainbow = RainbowWidget(self.tabs, self)

        self.projects.append(self.setup)
        self.projects.append(self.tetris)
        self.projects.append(self.pong)
        self.projects.append(self.fire)
        self.projects.append(self.text)
        self.projects.append(self.images)
        self.projects.append(self.rainbow)

        self.tabs.addTab(self.setup, "Setup")
        self.tabs.addTab(self.tetris, "Tetris")
        self.tabs.addTab(self.pong, "Pong")
        self.tabs.addTab(self.fire, "Fire")
        self.tabs.addTab(self.text, "Text")
        self.tabs.addTab(self.images, "Images")
        self.tabs.addTab(self.rainbow, "Rainbow")

        self.active_project = self.projects[0]

        self.tabs.currentChanged.connect(self.tab_changed_slot)

        self.main.setWindowTitle("Starter Kit: Blinkenlights Demo " + config.DEMO_VERSION)
        self.main.show()

    def connect(self):
        config.UID_LED_STRIP_BRICKLET = None
        self.setup.label_led_strip_found.setText('No')
        self.setup.label_led_strip_uid.setText('None')

        config.UID_MULTI_TOUCH_BRICKLET = None
        self.setup.label_multi_touch_found.setText('No')
        self.setup.label_multi_touch_uid.setText('None')

        config.UID_DUAL_BUTTON_BRICKLET = (None, None)
        self.setup.label_dual_button1_found.setText('No')
        self.setup.label_dual_button1_uid.setText('None')
        self.setup.label_dual_button2_found.setText('No')
        self.setup.label_dual_button2_uid.setText('None')

        config.UID_PIEZO_SPEAKER_BRICKLET = None
        self.setup.label_piezo_speaker_found.setText('No')
        self.setup.label_piezo_speaker_uid.setText('None')

        config.UID_SEGMENT_DISPLAY_4X7_BRICKLET = None
        self.setup.label_segment_display_found.setText('No')
        self.setup.label_segment_display_uid.setText('None')

#.........这里部分代码省略.........
开发者ID:chuangke365,项目名称:blinkenlights,代码行数:101,代码来源:demo.py


注:本文中的PyQt4.QtGui.QErrorMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。