Exemplo n.º 1
0
    def __init__(self, number=1):
        QApplication.__init__(self, sys.argv)
        self.setApplicationName("SphereTest")
        self.mainWindow = QMainWindow()
        self.gl_widget = proPixx480_1440test()
        self.mainWindow.setCentralWidget(self.gl_widget)
        self.mainWindow.setGeometry(
            QtGui.QDesktopWidget().availableGeometry(1))
        self.mainWindow.showFullScreen()
        self.curr_time = time.time()
        self.timer = QTimer()
        self.timer.setInterval(0)
        self.timer.timeout.connect(self.gl_widget.update)
        self.timer.start()
        self.timer2 = QTimer()
        self.timer2.setInterval(3000)
        self.timer2.timeout.connect(self.printFrames)
        self.timer2.start()
        self.gl_widget.mode = number
        self.gl_widget.mouseDoubleClickEvent = lambda x: self.mainWindow.close(
        )
        self.previous_time = 0
        self.previous_total = 0

        my_device = PROPixx()
        if number is 0:  # 480 Hz
            my_device.setDlpSequencerProgram('QUAD4X')
        else:  # 1440 Hz
            my_device.setDlpSequencerProgram('QUAD12X')
        my_device.updateRegisterCache()

        sys.exit(self.exec_())  # Start Qt main loop
Exemplo n.º 2
0
 def testWithParent(self):
     self._destroyed = False
     p = QTimer()
     t = QTimer(p)
     t.destroyed[QObject].connect(self.onObjectDestroyed)
     del p
     self.assert_(self._destroyed)
Exemplo n.º 3
0
    def __init__(self, parent=None):
        # Set up everything
        QMainWindow.__init__(self, parent)
        self.setWindowTitle("USB4000 Control")

        self.make_main_frame()

        self.spectra_timer = QTimer()
        self.spectra_timer.timeout.connect(self.update_spectrum)

        self.temp_timer = QTimer()
        self.temp_timer.timeout.connect(self.update_temp)

        self.worker = Usb4000Thread()
        self.wavelength_mapping = self.worker.dev.get_wavelength_mapping()

        self.curves = []         
        self.persistence_sb.valueChanged.connect(self.change_persistence)
        self.change_persistence()
        
        self.background = 1
        self.bg_min = 0

        self.use_background = False

        self.abs645 = pg.InfiniteLine(angle=90, movable=False)
        self.abs663 = pg.InfiniteLine(angle=90, movable=False)

        self.plot.addItem(self.abs645, ignoreBounds=True)
        self.plot.addItem(self.abs663, ignoreBounds=True)
        
        self.abs645.setPos(645)
        self.abs663.setPos(663)
        
        self.conc_deque = deque(maxlen=20)
Exemplo n.º 4
0
    def __init__(self, width, height, grid):
        super(GameOfLifeWidget, self).__init__()
        self.setWindowTitle('Game Of Life')
        layout = QGridLayout()
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        main_layout = QVBoxLayout()
        self.buttons = []
        self.grid = grid
        self.width = width
        self.height = height
        self.timer = QTimer()
        self.timer.setInterval(INTERVAL)
        self.timer.timeout.connect(self._handle_timeout)

        self.start_button = QPushButton("Start")
        self.start_button.clicked.connect(self._handle_start)
        self.clear_button = QPushButton("Clear")
        self.clear_button.clicked.connect(self._handle_clear)

        main_layout.addLayout(layout)
        main_layout.addWidget(self.start_button)
        main_layout.addWidget(self.clear_button)
        self.setLayout(main_layout)
        for y_pos in range(height):
            row = []
            self.buttons.append(row)
            for x_pos in range(width):
                button = QPushButton()
                row.append(button)
                button.setMaximumWidth(20)
                button.setMaximumHeight(20)
                button.clicked.connect(self._handle_click)
                layout.addWidget(button, y_pos, x_pos)
        self._update_gui()
Exemplo n.º 5
0
 def __init__(self, myInput, parent=None):
     super(FlashingInputButton, self).__init__(myInput, parent)
     self.flashing = False
     self._flashState = 0
     self._timer = QTimer()
     self._timer.timeout.connect(self._flash)
     self._timer.start(500)
Exemplo n.º 6
0
 def __init__(self, text, replaceColor=Qt.yellow, highlightColor=Qt.red, replaceTimeout=2):
   super(SearchReplaceLabel, self).__init__(text, highlightColor)
   self._replace_color = replaceColor
   self.replace_committed.connect(self._replaceText)
   self._replacement_fade_timer = QTimer()
   self._replacement_fade_timer.setSingleShot(replaceTimeout)
   self._replacement_fade_timer.timeout.connect(self._putOriginalText)
Exemplo n.º 7
0
    def __init__(self, qpart, model):
        QListView.__init__(self, qpart.viewport())
        self.setItemDelegate(HTMLDelegate(self))
        
        self._qpart = qpart
        self.setFont(qpart.font())
        
        self.setCursor(QCursor(Qt.PointingHandCursor))
        self.setFocusPolicy(Qt.NoFocus)
        
        self.setModel(model)
        
        self._selectedIndex = -1
        
        # if cursor moved, we shall close widget, if its position (and model) hasn't been updated
        self._closeIfNotUpdatedTimer = QTimer()
        self._closeIfNotUpdatedTimer.setInterval(200)
        self._closeIfNotUpdatedTimer.setSingleShot(True)

        self._closeIfNotUpdatedTimer.timeout.connect(self._afterCursorPositionChanged)
        
        qpart.installEventFilter(self)
        
        qpart.cursorPositionChanged.connect(self._onCursorPositionChanged)
        
        self.clicked.connect(lambda index: self.itemSelected.emit(index.row()))
        
        self.updateGeometry()
        self.show()
        
        qpart.setFocus()
Exemplo n.º 8
0
    def __init__(self):

        global gEnableResourceMonitoring
        self.enableResourceMonitoring = gEnableResourceMonitoring
        self.bar = hiero.ui.mainWindow().statusBar()

        self.updateMonitorIntervalMS = gUpdateIntervalMS  # The monitor update time in milliseconds.
        self.timer = QTimer()
        self.timer.setSingleShot(False)
        self.timer.timeout.connect(self.updateStatusBar)

        self.currentDiskIOBytes = psutil.disk_io_counters().read_bytes
        self.currentNetworkBytesReceived = psutil.net_io_counters().bytes_recv

        # This observes the current pid (the App process id) via psutil, and reports back
        if self.enableResourceMonitoring:
            self.processHelper = PSUtilProcessWrapper()

        # The frameServer instance
        self.frameServerInstance = nukestudio.frameServer

        # Initialise the Status Bar
        self.setupUI()

        # We haven't started monitoring at this point
        self.isMonitoring = False

        # Begin monitoring after a few secs to give frame server time to start up properly
        QTimer.singleShot(gInitialDelayMS, self.startMonitoring)
Exemplo n.º 9
0
    def test_encode_wrong_order_id(self):
        # python test_edit_timetracks.py TestEditTimetracks.test_encode_wrong_order_id
        app = self.app
        widget = self.widget
        today = date.today()
        widget.set_employee_and_date(self.employee.employee_id, today)
        QTest.keyEvent(QTest.Click, app.focusWidget(), Qt.Key_F5, Qt.ShiftModifier) # modifier, delay
        app.processEvents()

        QTest.keyEvent(QTest.Click, app.focusWidget(), Qt.Key_9) # modifier, delay
        app.processEvents()
        QTest.keyEvent(QTest.Click, app.focusWidget(), Qt.Key_9) # modifier, delay
        app.processEvents()
        QTest.keyEvent(QTest.Click, app.focusWidget(), Qt.Key_9) # modifier, delay
        app.processEvents()

        timer = QTimer()
        timer.timeout.connect(self._click_order_inexistant_box)
        timer.setSingleShot(True)
        timer.start(250)
        self.test_sucess = False

        QTest.keyEvent(QTest.Click, app.focusWidget(), Qt.Key_Enter)
        app.processEvents()

        assert self.test_sucess
Exemplo n.º 10
0
    def __init__(self,):
        QObject.__init__(self,)
        self.thread = None
        self._balance = '<b>0.00</b>000000'
        self._fiatSymbol = u'€'
        self._fiatRate = 0
        self._fiatBalance = u'0 €'
        self._wallet = Wallet()
        self._wallet.onNewTransaction.connect(self.notifyNewTx)
        self._walletUnlocked = False
        self.settings = Settings()
        self.addressesModel = AddressesModel()
        self.transactionsModel = TransactionsModel()
        self.timer = QTimer(self)
        self.timer.setInterval(900000)  # 15 min update
        self.timer.timeout.connect(self.update)
        self.timer.start()

        if self.settings.storePassKey:
            self._currentPassKey = self.settings.passKey
            try:
                self.unlockWallet(self._currentPassKey)
            except:
                self.onError.emit('Stored pass phrase is invalid')
        else:
            self._currentPassKey = None
        self._currentAddressIndex = 0
Exemplo n.º 11
0
 def __init__(self, home, parent=None, *, stayOnTop=False, debug=False):
     super().__init__(parent)
     if stayOnTop:
         flags = self.windowFlags()
         flags |= Qt.WindowStaysOnTopHint
         self.setWindowFlags(flags)
     self.home = home
     self.debug = debug
     self.filenamesForWord = {}
     self.titleForFilename = {}
     self.createWidgets()
     self.createLayout()
     self.createConnections()
     self.createShortcuts()
     self.changePage(self.home)
     self.updateUi()
     if self.debug:
         self.mtime = 0
         self.timer = QTimer(self)
         self.timer.start(250)
         self.timer.timeout.connect(self.timeout)
     self.loadSettings()
     with open(Lib.get_path("doc/xix_style.css"), "r",
               encoding=UTF8) as file:
         self.css = file.read()
     self.browser.setFocus()
     self.setWindowTitle("Help — {}".format(
         QApplication.applicationName()))
Exemplo n.º 12
0
    def __init__(self, parent=None):
        QWidget.__init__(self)
        self.setMinimumSize(640, 480)
        self.setMaximumSize(self.minimumSize())

        # register this callbacks to interact with the faces and the camera
        # image before the widget will view the frame
        self.image_callback = None
        self.face_callback = None

        # init view with correct size, depth, channels
        self.frame = cv.CreateImage((640, 480), cv.IPL_DEPTH_8U, 3)

        self.storage = cv.CreateMemStorage()
        self.capture = cv.CaptureFromCAM(0)
        self.face_cascade = cv.Load(CSC_PATH +
                                    "haarcascade_frontalface_alt.xml")
        self.fd_wait_frames = 1
        self._fd_wait = self.fd_wait_frames

        # get first frame
        self._query_frame()

        # set refresh rate
        self.timer = QTimer(self)
        self.timer.timeout.connect(self._query_frame)
        self.timer.start(75)
Exemplo n.º 13
0
    def __init__(self, process, input_queue, output_queue):
        super(MainWidget, self).__init__()
        self.done = False
        layout = QtGui.QVBoxLayout()

        logo = QtGui.QLabel()
        logo.setPixmap('./data/logo.png')
        logo.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
        layout.addWidget(logo)

        status_list = self.status_list = QtGui.QListWidget()
        status_list.addItem('Chowdren, the blazingly fast runtime for '
                            'Clickteam Fusion.')
        status_list.addItem(u'Copyright (c) Mathias K\xe6rlev 2012-2015.')
        status_list.addItem('Applications made with Chowdren are subject to '
                            'the GNU General Public License.')

        layout.addWidget(status_list)

        self.setLayout(layout)

        timer = QTimer(self)
        timer.setInterval(100)
        timer.timeout.connect(self.process_console)
        timer.start()

        self.process = process
        self.output_queue = output_queue
        self.input_queue = input_queue

        self.log = open('chowdrenlog.txt', 'wb')
Exemplo n.º 14
0
    def __init__(self, parent=None):
        super(LoginForm, self).__init__(parent)
        self.setWindowTitle("Login")

        self.status_icon = QIcon.fromTheme("user-offline")
        self.setWindowIcon(self.status_icon)

        self.server_status = QLabel()
        self.server_status.setAlignment(Qt.AlignCenter)
        self.server_status.setPixmap(self.status_icon.pixmap(64))

        self.username = QLineEdit("Username")

        self.password = QLineEdit("Password")
        self.password.setEchoMode(QLineEdit.Password)

        self.login_button = QPushButton("Getting server status...")
        self.login_button.setEnabled(False)
        self.login_button.clicked.connect(self.login)
        self.login_button.setIcon(self.status_icon)

        self.ping_timer = QTimer(self)
        self.connect(self.ping_timer, SIGNAL("timeout()"), self.is_server_up)
        self.ping_timer.start(1000)

        layout = QVBoxLayout()
        for w in (self.server_status, self.username, self.password,
                  self.login_button):
            layout.addWidget(w)
        self.setLayout(layout)

        self.logged_in.connect(qtclient.login)
Exemplo n.º 15
0
    def __init__(self, worldviewer, parent=None):
        global client
        super(WorldViewerDebug, self).__init__(parent)

        self.setWindowTitle("World Viewer Debug")
        pos = QApplication.instance().desktop().availableGeometry()
        self.move(pos.width() / 2, 0)

        self.worldviewer = worldviewer

        self.objects_tree = QTreeWidget()
        self.objects_tree.setColumnCount(2)
        self.objects_tree.setHeaderLabels([
            "ID", "Name", "Location", "Resource", "Last Modified",
            "Dist to Player"
        ])
        self.objects_tree.setSortingEnabled(True)

        layout = QVBoxLayout()
        for w in (self.objects_tree, ):
            layout.addWidget(w)
        self.setLayout(layout)

        self.obj_update_timer = QTimer(self)
        self.connect(self.obj_update_timer, SIGNAL("timeout()"), self.update)
        self.obj_update_timer.start(CLIENT_UPDATE_FREQ)
Exemplo n.º 16
0
 def set_holding(self, button):
   self._hold_button = button
   if (self._hold_timer is None):
     self._hold_timer = QTimer(self)
     self._hold_timer.timeout.connect(self.on_hold)
   self._hold_timer.setInterval(500)
   self._hold_timer.start()
Exemplo n.º 17
0
 def __init__(self, countdown, parent=None):
     QLabel.__init__(self, parent)
     self.countdown = countdown
     self.setText(self.countdown.toString(Qt.ISODate))
     # setup the countdown timer
     self.timer = QTimer(self)
     self.timer.timeout.connect(self._update_time)
Exemplo n.º 18
0
    def run(self):
        self._timeout = QTimer()
        self._timeout.setInterval(2000)
        self._timeout.timeout.connect(self.__onTimeout)

        try:
            self._serial = serial.Serial(self._port,
                                         baudrate=19200,
                                         bytesize=serial.SEVENBITS,
                                         stopbits=serial.STOPBITS_ONE,
                                         parity=serial.PARITY_ODD,
                                         timeout=1)
            self._serial.dtr = True
            self._serial.rts = False

            while not self._cancel:
                if not self._timeout.isActive():
                    self._timeout.start()
                data = self._serial.readline()
                data = data.strip()
                if len(data) == 12:
                    timestamp = time.time()
                    result = self._parser.parse(data, timestamp)
                    if result is not None:
                        self._timeout.stop()
                        self.data.emit(result)
                    else:
                        self.warning.emit('Invalid data received')
                QApplication.processEvents()
            self._serial.close()
        except serial.SerialException as e:
            self.error.emit(e.message)
Exemplo n.º 19
0
    def __init__(self, media, parent):
        super(MediaView, self).__init__(parent)
        self._parent = parent
        self._id = media['id']
        self._type = media['type']
        self._duration = media['duration']
        self._render = media['render']
        self._options = media['options']
        self._raws = media['raws']

        self._layout_id = media['_layout_id']
        self._schedule_id = media['_schedule_id']
        self._region_id = media['_region_id']
        self._save_dir = media['_save_dir']

        self._widget = None
        self._play_timer = QTimer(self)

        self._started = 0
        self._finished = 0

        self._errors = None
        # self.setObjectName('Media-%s-%s' % (self._type, self._id))
        # self._play_timer.setObjectName('%s-timer' % self.objectName())
        self._connect_signals()
Exemplo n.º 20
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)

        self.setWindowIcon(QIcon(':/ifmon.png'))

        try:
            self.model = BandwidthTableModel(self)
        except dberrors.OperationalError as e:
            QMessageBox.critical(self, 'Database Error',
                    'Could not access database.\nERROR: %s' % e)
            sys.exit(QApplication.exit())

        self.tableView.setModel(self.model)
        self.tableView.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        self.tableView.horizontalHeader().setResizeMode(0, QHeaderView.ResizeToContents)
        self.tableView.setAlternatingRowColors(True)

        self.dateFrom.setDate(self.model.settings.start)
        self.dateTo.setDate(self.model.settings.start + timedelta(days=29))
        self.updateTotal()

        self.actionAbout.triggered.connect(self.about)

        self.timer = QTimer()
        self.timer.setInterval(1000)
        self.timer.timeout.connect(self.updateUsage)
        self.timer.start()
Exemplo n.º 21
0
 def statusBarTimer(self):
   q = self.q
   ret = QTimer(q)
   ret.setSingleShot(True)
   ret.setInterval(5000)
   ret.timeout.connect(q.statusBar().hide)
   return ret
Exemplo n.º 22
0
    def __init__(self, opc=None):
        super(MainWindow, self).__init__()

        self.opc = opc

        self.setWindowTitle('OPC DA Datalogger')

        self.layout = QHBoxLayout(self)

        self.configuration = Configuration(self, opc)
        self.configuration_dock = QDockWidget("Configuration", self)
        self.configuration_dock.setWidget(self.configuration)
        self.configuration_dock.setFeatures(QDockWidget.NoDockWidgetFeatures)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.configuration_dock)

        self.logging_area = LoggingArea(self)
        self.logging_dock = QDockWidget("Logging", self)
        self.logging_dock.setWidget(self.logging_area)
        self.logging_dock.setFeatures(QDockWidget.NoDockWidgetFeatures)
        self.addDockWidget(Qt.RightDockWidgetArea, self.logging_dock)

        self.setLayout(self.layout)
        self.resize(900, 600)

        self.logging_timer = QTimer(self)
        self.logging_timer.timeout.connect(self._loogging_callback)
    def __init__(self, url, filename, image_crop, translate_page, parent=None):
        super(Render, self).__init__(parent)
        self.image_crop = image_crop
        self.fileName = time.strftime("%Y%m%d%H%M%S",
                                      time.localtime()) + "_test.jpg"
        self.finished = False

        # Settings
        s = self.page().settings()
        s.setAttribute(QWebSettings.AutoLoadImages, True)
        s.setAttribute(QWebSettings.PluginsEnabled, True)
        s.setAttribute(QWebSettings.JavascriptEnabled, True)
        s.setAttribute(QWebSettings.JavaEnabled, False)
        s.setAttribute(QWebSettings.JavascriptCanOpenWindows, False)
        s.setAttribute(QWebSettings.DeveloperExtrasEnabled, True)

        #self.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
        self.page().mainFrame().setScrollBarPolicy(Qt.Vertical,
                                                   Qt.ScrollBarAlwaysOff)

        self.timerScreen = QTimer()
        self.timerScreen.setInterval(10000)
        self.timerScreen.setSingleShot(True)
        self.timerScreen.timeout.connect(self.takeScreenshot)

        self.loadFinished.connect(self.timerScreen.start)
        self.load(QUrl(url))
Exemplo n.º 24
0
    def test_print_preorder(self):
        # python test_integration.py TestEditOrderParts.test_print_preorder

        app = self.app
        widget = self.widget
        self._make_basic_preorder()
        self._encode_imputable_operation("Description2")
        self._encode_imputable_operation("Description3")
        QTest.keyEvent(QTest.Click, app.focusWidget(), Qt.Key_S,
                       Qt.ControlModifier)  # modifier, delay
        app.processEvents()

        # We're going to have a modal dialog for the
        # preorder print. So we prepare to click on it.

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

        self.prepare_to_click_dialog("set_preorder_sent_state", 3)
        widget.preorderPrint()

        order = dao.order_dao.find_by_id(widget._current_order.order_id)
        self.assertEqual("ZuluHeader", order.preorder_print_note)
        self.assertEqual("ZuluFooter", order.preorder_print_note_footer)
Exemplo n.º 25
0
def install(app=None, timeout=0.02, engine=None):
    """
    Creates a :class:`~PySide.QtCore.QTimer` instance that will be triggered
    continuously to call :func:`Engine.poll() <pants.engine.Engine.poll>`,
    ensuring that Pants remains responsive.

    =========  ========  ============
    Argument   Default   Description
    =========  ========  ============
    app        None      *Optional.* The :class:`~PySide.QtCore.QCoreApplication` to attach to. If no application is provided, it will attempt to find an existing application in memory, or, failing that, create a new application instance.
    timeout    ``0.02``  *Optional.* The maximum time to wait, in seconds, before running :func:`Engine.poll() <pants.engine.Engine.poll>`.
    engine               *Optional.* The :class:`pants.engine.Engine` instance to use.
    =========  ========  ============
    """
    global timer
    global _timeout
    global _engine

    _engine = engine or Engine.instance()
    _engine._install_poller(_Qt())

    if app is None:
        app = QCoreApplication.instance()
    if app is None:
        app = QCoreApplication([])

    _timeout = timeout * 1000

    timer = QTimer(app)
    timer.timeout.connect(do_poll)
    timer.start(_timeout)
Exemplo n.º 26
0
    def __init__(self,parent=None):
        super(LinesChart,self).__init__(parent)

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.timer_tick) # timerUpdate)
        self.timer.start(400)
        self.timer_ticks = 0

        self.gride_lines_number = 0
        self._create_pens()
        self.stacked = False
        self.title = "Sic transit gloria mundi"
        self.title_font = self.thinfont = QFont("Arial",10,QFont.Bold)

        self.margin = 10
        self.total_width = 0
        self.legend_labels_bounding_boxes = []

        self.ndx_best_serie = -1
        self.best_serie_intra_ndx = None
        self.no_draw = True # Set to True if we can't draw (because of numerical problems or non initialized data for example)
        self.data = None

        # When set to true, if the x axis values are dates
        # then, they'll be shown as month (so intead of 31/12/2014,
        # you'll get something like 12/14)
        self.x_axis_as_months = False
        self.set_mini_maxi(None, None)
        self.set_horizontal_ruler(None,None)

        self.forced_maxi = None
        self.forced_mini = None
Exemplo n.º 27
0
 def start_video(self, framerate=None):
     timer = QTimer()
     timer.timeout.connect(self._wait_for_frame)
     self.camera.start_live_video(framerate)
     timer.start(int(1000 / self.camera.framerate))
     self.timer = timer
     self.centerOn(self.camera.width / 2, self.camera.height / 2)
Exemplo n.º 28
0
    def __init__(self, q):
        self._queue = []  # [dataman.Comment]

        t = self._shiftTimer = QTimer(q)
        t.setSingleShot(True)
        t.setInterval(500)
        t.timeout.connect(self._shift)
Exemplo n.º 29
0
    def __init__(self, q):
        self._queue = []  # list of functions

        t = self.flushTimer = QTimer(q)
        t.setSingleShot(True)
        #t.setInterval(100) # btw, ITH's split time is 200
        t.timeout.connect(self._flush)
Exemplo n.º 30
0
 def connect(self, login, passwd):
     """ Процедура инициализации соединения
     Является слотом QT (для получения логина и пароля из QML)
     """
     self.port = 0
     port = self.getNextAvailablePort()
     # Если логин и пароль пусты или дефолтные то не соединяемся
     if (not login) or (not passwd) \
         or (login == "Login") or (passwd == "password"):
         return
     self.login = login
     self.password = passwd
     # если стоит галочка запомнить пароль TODO: убрать конструкцию
     if self.view.remember():
         self.write_settings(login, passwd, remember=True)
     else:
         self.write_settings("", "")
     # Пробуем запустить OpenVPN, не получается - не подключаемся
     try:
         self.process = subprocess.Popen([
             self.ovpnexe, '--config', self.ovpnconfigpath + 'Soloway.ovpn',
             '--management', '127.0.0.1', '{0}'.format(port),
             '--management-query-passwords', '--management-log-cache',
             '200', '--management-hold'
         ],
                                         cwd=self.ovpnconfigpath)
     except Exception as e:
         self.logger.error("OpenVPN process failed to execute " + str(e))
         return
     self.logger.debug("Subprocess started")
     # Задаем таймер для asyncore loop устанавливаем на 1 раз в секунду
     self.timer = QTimer()
     self.timer.connect(SIGNAL("timeout()"), self.looper)
     self.timer.start(500)
     self.port = port
     """ Устанавливаем однократный таймер для запуска обработчика OpenVPN
     Без таймера openvpn не успевает запуститься, так что при
     попытке соединения с ним asyncore.async_chat выпадает 
     """
     self.atimer = QTimer()
     self.atimer.setSingleShot(True)
     self.atimer.timeout.connect(self.manage_process)
     self.atimer.start(1000)
     # Записываем время старта, через 20 секунд без подключения - disconnect
     self.start_time = datetime.now()
     # Отправляем сигнал в QML о начале соединения
     self.emit_signal("100")