Esempio n. 1
0
 def sleep(self, ms):
     startTime = QTime.currentTime()
     while True:
         QApplication.processEvents(QEventLoop.AllEvents, 25)
         if startTime.msecsTo(QTime.currentTime()) > ms:
             break
         usleep(0.005)
Esempio n. 2
0
    def handleMouseMove(self, event):

        event.ignore()

        if not (event.buttons() & Qt.LeftButton):
            return

        if event in self.d.ignoreList:
            self.d.ignoreList.remove(event)
            return

        if self.d.state in (FlickablePrivate.Pressed, FlickablePrivate.Stop):
            delta = event.pos() - self.d.pressPos
            if delta.x() > self.d.threshold or delta.x() < -self.d.threshold or \
               delta.y() > self.d.threshold or delta.y() < -self.d.threshold:

                self.d.timeStamp = QTime.currentTime()
                self.d.state = FlickablePrivate.ManualScroll
                self.d.delta = QPoint(0, 0)
                self.d.pressPos = QPoint(event.pos())
                #event.accept()

        elif self.d.state == FlickablePrivate.ManualScroll:
            event.accept()
            delta = event.pos() - self.d.pressPos
            self.setScrollOffset(self.d.offset - delta)
            if self.d.timeStamp.elapsed() > 50:
                self.d.timeStamp = QTime.currentTime()
                self.d.speed = delta - self.d.delta
                self.d.delta = delta
                print("Delta", self.d.delta)
                self.emit(SIGNAL("scroll_to"), self.d.pressPos, self.d.delta)
Esempio n. 3
0
    def handleMouseMove(self, event):

        event.ignore()

        if not (event.buttons() & Qt.LeftButton):
            return

        if event in self.d.ignoreList:
            self.d.ignoreList.remove(event)
            return

        if self.d.state in (FlickablePrivate.Pressed, FlickablePrivate.Stop):
            delta = event.pos() - self.d.pressPos
            if delta.x() > self.d.threshold or delta.x() < -self.d.threshold or \
               delta.y() > self.d.threshold or delta.y() < -self.d.threshold:

                self.d.timeStamp = QTime.currentTime()
                self.d.state = FlickablePrivate.ManualScroll
                self.d.delta = QPoint(0, 0)
                self.d.pressPos = QPoint(event.pos())
                #event.accept()

        elif self.d.state == FlickablePrivate.ManualScroll:
            event.accept()
            delta = event.pos() - self.d.pressPos
            self.setScrollOffset(self.d.offset - delta)
            if self.d.timeStamp.elapsed() > 50:
                self.d.timeStamp = QTime.currentTime()
                self.d.speed = delta - self.d.delta
                self.d.delta = delta
                print("Delta", self.d.delta)
                self.emit(SIGNAL("scroll_to"), self.d.pressPos, self.d.delta)
Esempio n. 4
0
 def sleep(self, ms):
     startTime = QTime.currentTime()
     while True:
         QApplication.processEvents(QEventLoop.AllEvents, 25)
         if startTime.msecsTo(QTime.currentTime()) > ms:
             break
         usleep(0.005)
Esempio n. 5
0
    def __init__(self, parent=None):

        super(MainWindow, self).__init__(parent)
        uic.loadUi('mainwindow.ui', self)
        self.setWindowTitle('Merlins AFM sketching tool')
        self.setGeometry(500,100,1200,1000)
        self.plotFrame = PlotFrame()
        self.plotSplitter.addWidget(self.plotFrame)
        # self.splitter.setStretch(1,1)
        self.splitter.setStretchFactor(1,1)
        # self.tree_splitter.set

        self.show()
        # Set delegate
        self.tree_file.setItemDelegateForColumn(2,DoubleSpinBoxDelegate(self))
        self.tree_file.setItemDelegateForColumn(4,DoubleSpinBoxDelegate(self))

        self.settings = {}
        self.settings['measure'] = {}
        self.settings['plot'] = {}
        self.settings['measure']['time'] = QTime()

        self.s_time = str(QDate.currentDate().toString('yyyy-MM-dd_') + QTime.currentTime().toString('HH-mm-ss'))
        self.timer = QTime.currentTime()
        self.nextPosition = np.array([np.nan,np.nan])
        self.sketching = False

        self.outDir = 'U:/'
        self.afmImageFolder = 'D:/lithography/afmImages/'
        self.storeFolder = 'D:/lithography/sketches/' + self.s_time + '/'
        self.sketchSubFolder = './'


        print ''
        print ''

        self.addToolbars()
        self.init_stores()
        self.newstores = False
        self.init_sketching()
        self.init_measurement()

        self.tree_settings.hide()

        # # Tree view
        # self.set_model = SetTreeModel(headers = ['Parameter', 'Value', 'type'], data = self.settings)
        # self.tree_settings.setModel(self.set_model)
        # self.tree_settings.setAlternatingRowColors(True)
        # self.tree_settings.setSortingEnabled(True)
        # self.tree_settings.setHeaderHidden(False)
        # self.tree_settings.expandAll()

        # for column in range(self.set_model.columnCount()):
        #     self.tree_settings.resizeColumnToContents(column)

        # QtCore.QObject.connect(self.set_model, QtCore.SIGNAL('itemChanged(QModelIndex)'), self.test)
        # QtCore.QObject.connect(self.tree_settings, QtCore.SIGNAL('valueChanged(QModelIndex)'), self.test)


        self.log('log', 'init')
 def writeDataToSocket(self):
     hour = "%02d"%(QTime.currentTime().hour())
     minute = "%02d"%(QTime.currentTime().minute())
     second = "%02d"%(QTime.currentTime().second())
     if self.teacherIp != "":
         ip = self.teacherIp
         name = "client-" + self.clientuuid
         data = name + "#" + hour + minute + second
         self.udpSocket.writeDatagram(data, QHostAddress(ip), self.porttwo)
Esempio n. 7
0
    def run(self):

        while not self.quit:
            try:
                self.error.emit("can't not open %s,error code:%d" %
                                ("com3", 12345))
                self.timeout.emit("Wait write response timeout %s" %
                                  (QTime.currentTime().toString()))
                self.request.emit("RequesData: %s" %
                                  (QTime.currentTime().toString()))
            except TypeError as e:
                print('Got Error', e)
            finally:
                print("Continus working ...")
            time.sleep(0.5)
Esempio n. 8
0
def main():
    if settings.get('log:errors'):
        log_filename = settings.get('log:filename')
        if log_filename:
            try:
                log_file = open(log_filename, "w")
                print('Redirecting stderr/stdout... to %s' % log_filename)
                sys.stderr = log_file
                sys.stdout = log_file
            except IOError:
                print "Lector could not open log file '%s'!\n" % log_filename \
                      + " Redirecting will not work."
        else:
            print "Log file is not set. Pleaase set it in settings."

    app = QApplication(sys.argv)
    opts = [str(arg) for arg in app.arguments()[1:]]
    if '--no-scanner' in opts:
        scanner = False
    else:
        scanner = True
    qsrand(QTime(0, 0, 0).secsTo(QTime.currentTime()))

    locale = settings.get('ui:lang')
    if not locale:
        locale = QLocale.system().name()
    qtTranslator = QTranslator()
    if qtTranslator.load(":/translations/ts/lector_" + locale, 'ts'):
        app.installTranslator(qtTranslator)

    window = Window(scanner)
    window.show()
    app.exec_()
Esempio n. 9
0
 def showIP(self):
     self.ui.ips.clear()
     for i in self.h3c.listHost():
         item = QtGui.QListWidgetItem(i)
         current_time = QTime.currentTime()
         self.ui.ips.addItem(item)
         self.ui.ips.addItem(current_time)
Esempio n. 10
0
def main():
    if settings.get('log:errors'):
        log_filename = settings.get('log:filename')
        if log_filename:
            try:
                log_file = open(log_filename,"w")
                print ('Redirecting stderr/stdout... to %s' % log_filename)
                sys.stderr = log_file
                sys.stdout = log_file
            except IOError:
                print "Lector could not open log file '%s'!\n" % log_filename \
                      + " Redirecting will not work."
        else:
            print "Log file is not set. Pleaase set it in settings."

    app = QApplication(sys.argv)
    opts = [str(arg) for arg in app.arguments()[1:]]
    if '--no-scanner' in opts:
        scanner = False
    else:
        scanner = True
    qsrand(QTime(0, 0, 0).secsTo(QTime.currentTime()))

    locale = settings.get('ui:lang')
    if not locale:
        locale = QLocale.system().name()
    qtTranslator = QTranslator()
    if qtTranslator.load(":/translations/ts/lector_" + locale, 'ts'):
        app.installTranslator(qtTranslator)

    window = Window(scanner)
    window.show()
    app.exec_()
Esempio n. 11
0
    def saveSketch(self):
        self.settings['measure']['time'].elapsed()
        self.sketchSubFolder = QDate.currentDate().toString('yyyy-MM-dd_') + QTime.currentTime().toString('HH-mm-ss')

        if not os.path.exists(self.storeFolder + self.sketchSubFolder):
            os.makedirs(self.storeFolder + self.sketchSubFolder)


        data = self.sketchFile
        self.sketchOutDir = str(self.storeFolder + self.sketchSubFolder+'/')
        fname = self.sketchOutDir + 'out.txt'
        f = open(fname, 'w')
        f.write(data)
        f.close()
        try:
            self.plotFrame.savePlot(self.sketchOutDir+'currentSketchView.png')
        except:
            pass
        try:
            filename = sorted(os.listdir(self.afmImageFolder))[-1]
            shutil.copy2(self.afmImageFolder + filename,self.sketchOutDir+filename)
            shutil.copy2('D:/lithography/current.png',self.sketchOutDir+'currentAFMImage.png')
        except:
            pass

        self.log('sketch', str(self.storeFolder + self.sketchSubFolder))
Esempio n. 12
0
def main():
    """Function, executed on start
    """
    
    # create application
    app = QApplication (sys.argv)
    app.setApplicationName( "fresh-examples" )
    
    qsrand( QTime( 0, 0, 0 ).secsTo( QTime.currentTime() ) )
    
    pSettings.setDefaultProperties(pSettings.Properties(app.applicationName(), \
                                   "1.0.0",
                                   pSettings.Portable))

    window = MainWindow()
    window.setWindowTitle( app.applicationName() )
    window.show()

    # connection
    app.lastWindowClosed.connect(app.quit)

    # start application
    result = app.exec_()
    del window
    
    return result
Esempio n. 13
0
 def get_talks_by_room_and_time(self, room):
     """Returns the talks hosted in a specified room, starting from the current date and time"""
     current_date = QDate.currentDate().toString(1)  # yyyy-mm-dd
     current_time = QTime.currentTime().toString()  # hh:mm:ss
     return QtSql.QSqlQuery('''SELECT * FROM presentations
                               WHERE Room='{}' AND Date='{}'
                               AND StartTime >= '{}' ORDER BY StartTime ASC'''.format(room, current_date, current_time))
Esempio n. 14
0
 def get_talks_by_room_and_time(self, room):
     """Returns the talks hosted in a specified room, starting from the current date and time"""
     current_date = QDate.currentDate().toString(1)  # yyyy-mm-dd
     current_time = QTime.currentTime().toString()  # hh:mm:ss
     return QtSql.QSqlQuery('''SELECT * FROM presentations
                               WHERE Room='{}' AND Date='{}'
                               AND StartTime >= '{}' ORDER BY StartTime ASC'''.format(room, current_date, current_time))
Esempio n. 15
0
    def __init__(self, book=10, chapter=1, verseFrom=6, verseTo=6, parent=None):
        "Initialises a Game given a book, a chapter, and the verses."
        QWidget.__init__(self)
        Ui_Game.__init__(self)

        # User interface configuration.
        self.setupUi(self)

        # Hide some stuff
        self.pushButton_cheatText.setChecked(False)
        self.pushButton_cheatText.setVisible(False)


        # Strong Parser
        self.StrongParser = StrongParser()
        self._highlighter = myHighlighter(self.plainTextEdit_original, self)

        # Settings
        self._book = book
        self._chapter = chapter
        self._verseFrom = verseFrom
        self._verseTo = verseTo
        self.BibleLoader = parent.BibleLoader
        self._startTime = QTime.currentTime()
        self._testLexicalForm = parent.comboBox_testLexicalForm.currentIndex()\
                                == 1
        self._lessThan = parent.checkBox_lessThanOccurences.isChecked() * \
                         int(parent.comboBox_lessThanOccurences.currentText())
        self._moreThan = parent.checkBox_moreThanOccurences.isChecked() * \
                         int(parent.comboBox_moreThanOccurences.currentText())
        self._listDefRandom = parent.comboBox_sort.currentIndex() == 0

        # Internal lists
        self._words = []            # Words as in the text
        self._lexicals = []         # Lexical form of the word
        self._strongs = []          # Strong number
        self._definitions = []      # Definition
        self._grammars = []         # Grammatical informations
        self._alreadyGuessed = []   # list of words ID already guessed

        # Signal / Slots
        self.listWidget_original.itemSelectionChanged\
                                .connect(self._highlighter.rehighlight)
        self.listWidget_original.itemDoubleClicked.connect(self.guessOnList)
        self.listWidget_translation.itemDoubleClicked.connect(self.guessOnList)
        self.listWidget_guesses.itemDoubleClicked.connect(self.undoGuess)
        self.pushButton_guess.clicked.connect(self.testGuess)
        self.pushButton_undoGuess.clicked.connect(self.undoGuess)
        self.plainTextEdit_original.cursorPositionChanged\
                                   .connect(self.textSelectionChanged)
        self.pushButton_Validate.clicked.connect(self.validate)
        #self.pushButton_Validate.setEnabled(False)

        self.listWidget_original.setSortingEnabled(False)
        if self._listDefRandom:
            self.listWidget_translation.setSortingEnabled(False)

        # Get the party going
        self.loadText()
Esempio n. 16
0
 def onRecvData(self, data):
     text = data
     if not self.hideSRFlag_checkBox.isChecked():
         text = 'RECV (%s)\n%s' % (util.QStringToStr(QTime.currentTime().toString()), data)
     
     self.recv_TextBrowser.setPlainTextWithNoNL(text)
     
     if self.autoLF_checkBox.isChecked():
         self.recv_TextBrowser.setPlainTextWithNoNL("\n")
Esempio n. 17
0
 def showTime(self):
     """
     Update the Hour and Minute Hands
     """
     #Get the Time and work out what angle the hands should be at
     self.time = QTime.currentTime()
     hour=30.0 * ((self.time.hour() + self.time.minute() / 60.0))-90
     minute=6.0 * (self.time.minute() + self.time.second() / 60.0)-90
     #Rotate the hands into place
     self.svgHour.setTransform(QTransform().translate(self.ixoffset, self.iyoffset).rotate(hour).translate(self.xoffset, self.yoffset))
     self.svgMinute.setTransform(QTransform().translate(self.ixoffset, self.iyoffset).rotate(minute).translate(self.xoffset, self.yoffset))
Esempio n. 18
0
 def calibrateTime(self):
     #due to inaccuracies of the seconds timer we recalibrate the second hand every 10 secs
     if self._static:
         return
     self.secTimer.stop()
     self.calibrateTimer.stop()
     self.time = QTime.currentTime()
     self.pSecond=(self.time.second()*6)-90
     self.svgSecond.setTransform(QTransform().translate(self.ixoffset, self.iyoffset).rotate(self.pSecond).translate(self.xoffset, self.yoffset))
     self.secTimer.start(self.secTimerType, self)
     self.calibrateTimer.start(6000)
Esempio n. 19
0
 def onSendData(self, data, _type=config.ASCII_TYPE):
     if self.clearSentText_checkBox.isChecked() and not self.autoSend_checkBox.isChecked():
         self.send_TextEdit.clear()
         
     if not self.showSent_checkBox.isChecked():
         return
         
     text = data
     if not self.hideSRFlag_checkBox.isChecked():
         text = 'SEND (%s)\n%s\n' % (util.QStringToStr(QTime.currentTime().toString()), data)
         
     self.recv_TextBrowser.setPlainTextWithNoNL(text)
Esempio n. 20
0
    def __update_weatherdata(self):

        if self.lastUpdate == None:
            #print("Update Weather data because of None")
            #self.emit(SIGNAL("start_loading"))
            if self.__service_available():
                self.weatherdata = weather.get_weather_from_weather_com(self.LOCATION_ID)
                #self.emit(SIGNAL("stop_loading"))
                self.lastUpdate = [QTime.hour(QTime.currentTime()), QTime.minute(QTime.currentTime())]
                return True, True
            else:
                self.lastUpdate = None
                return False, True
        elif self.lastUpdate[0] < QTime.hour(QTime.currentTime()) or \
                        self.lastUpdate[1] < (QTime.minute(QTime.currentTime()) -10):
            #print("Update Weather data because of long periode without update")
            self.emit(SIGNAL("start_loading"))
            if self.__service_available():
                self.weatherdata = weather.get_weather_from_weather_com(self.LOCATION_ID)
                self.emit(SIGNAL("stop_loading"))
                self.lastUpdate = [QTime.hour(QTime.currentTime()), QTime.minute(QTime.currentTime())]
                return True, True
            else:
                self.lastUpdate = None
                return False, True
        else:
            #print("It is just a few minutes ago that i updated the weather data... not again :-)")
            return True, False # Data is up to date, available but with no changes...
Esempio n. 21
0
    def init_stores(self):
        c_time = str(QDate.currentDate().toString('yyyy-MM-dd_') + QTime.currentTime().toString('HH-mm-ss'))

        if not os.path.exists(self.storeFolder):
            os.makedirs(self.storeFolder)

        self.log_store = DataStore(filename=self.storeFolder+c_time +'_logging.h5')

        self.ni_store_columns = ['time', 'current','r2p','r4p']
        self.ni_store = RingBuffer(360000, filename=self.storeFolder+c_time +'_ni_data.h5',cols = self.ni_store_columns)

        self.dht_store_columns = ['time', 'temperature', 'humidity']
        self.dht_store = RingBuffer(360000, filename=self.storeFolder+c_time +'_dht_data.h5',cols = self.dht_store_columns)
Esempio n. 22
0
    def __init__(self,
                 model_name,
                 rali_mode,
                 total_images,
                 batch_size,
                 container_logo,
                 parent=None):
        super(inference_viewer, self).__init__(parent)
        self.model_name = model_name
        self.rali_mode = rali_mode
        self.total_images = total_images
        self.batch_size = batch_size
        self.imgCount = 0
        self.frameCount = 9
        self.container_index = (int)(container_logo)
        # self.origImageQueue = Queue.Queue()
        # self.augImageQueue = Queue.Queue()

        self.graph = None
        self.totalCurve = None
        self.augCurve = None
        self.x = [0]
        self.y = [0]
        self.augAccuracy = []
        self.pen = pg.mkPen('w', width=4)
        self.time = QTime.currentTime()

        self.runState = False
        self.pauseState = False
        self.progIndex = 0
        self.augIntensity = 0.0
        self.lastIndex = self.frameCount - 1

        self.AMD_Radeon_pixmap = QPixmap("./data/images/AMD_Radeon.png")
        self.AMD_Radeon_white_pixmap = QPixmap(
            "./data/images/AMD_Radeon-white.png")
        self.MIVisionX_pixmap = QPixmap("./data/images/MIVisionX-logo.png")
        self.MIVisionX_white_pixmap = QPixmap(
            "./data/images/MIVisionX-logo-white.png")
        self.EPYC_pixmap = QPixmap("./data/images/EPYC-blue.png")
        self.EPYC_white_pixmap = QPixmap("./data/images/EPYC-blue-white.png")
        self.docker_pixmap = QPixmap("./data/images/Docker.png")
        self.singularity_pixmap = QPixmap("./data/images/Singularity.png")
        self.rali_pixmap = QPixmap("./data/images/RALI.png")
        self.rali_white_pixmap = QPixmap("./data/images/RALI-white.png")
        self.graph_image_pixmap = QPixmap("./data/images/Graph-image.png")
        self.graph_image_white_pixmap = QPixmap(
            "./data/images/Graph-image-white.png")
        self.initUI()

        self.show()
Esempio n. 23
0
    def __init__(self):

        self.d = FlickablePrivate()
        self.d.state = FlickablePrivate.Steady
        self.d.threshold = 10
        self.d.ticker = FlickableTicker(self)
        self.d.timeStamp = QTime.currentTime()
        self.d.target = 0

        self.d.pressPos = QPoint()
        self.d.offset = QPoint()
        self.d.delta = QPoint()
        self.d.speed = QPoint()
        self.d.ignoreList = []
Esempio n. 24
0
    def __init__(self):

        self.d = FlickablePrivate()
        self.d.state = FlickablePrivate.Steady
        self.d.threshold = 10
        self.d.ticker = FlickableTicker(self)
        self.d.timeStamp = QTime.currentTime()
        self.d.target = 0

        self.d.pressPos = QPoint()
        self.d.offset = QPoint()
        self.d.delta = QPoint()
        self.d.speed = QPoint()
        self.d.ignoreList = []
Esempio n. 25
0
    def check_time(self, name):
        if not self.tradable:
            return False

        if name not in run_time_dict.keys():
            return False

        now = QTime.currentTime()
        time_range_arr = run_time_dict[name]
        for item in time_range_arr:
            if now > item[0] and now < item[1]:
                #log_helper.info('now:{0}, begin:{1}, end:{2}'.format(now, item[0], item[1]))
                return True

        return False
Esempio n. 26
0
    def showIP(self):
        self.ui.ips.clear()
        for i in self.h3c.listHost():
            current_time = QTime.currentTime()
            strTime = current_time.toString("h:m:s ap")
            qtime = unicode(strTime)  #curerntTime
            #print strTime
            if not '310' in i: continue
            i = i.split(';')[1:]
            if i[1] in ALLIP: i.append(u'已标定过')
            else: i.append(u'即将标定')

            i = '\t'.join(i)
            item = QtGui.QListWidgetItem(i)
            self.ui.ips.addItem(item)
Esempio n. 27
0
    def resetViewer(self):
        self.imgCount = 0
        del self.x[:]
        self.x.append(0)
        del self.y[:]
        self.y.append(0)
        del self.augAccuracy[:]
        for augmentation in range(self.batch_size):
            self.augAccuracy.append([0])

        self.time = QTime.currentTime()
        self.lastTime = 0
        self.progIndex = 0
        self.lastIndex = self.frameCount - 1
        self.totalCurve.clear()
        self.augCurve.clear()
Esempio n. 28
0
    def handleMouseRelease(self, event):

        event.ignore()

        if event.button() != Qt.LeftButton:
            return

        if event in self.d.ignoreList:
            self.d.ignoreList.remove(event)
            return

        if self.d.state == FlickablePrivate.Pressed:
            event.accept()
            self.d.state = FlickablePrivate.Steady
            if self.d.target:
                event1 = QMouseEvent(QEvent.MouseButtonPress,
                                     self.d.pressPos, Qt.LeftButton,
                                     Qt.LeftButton, Qt.NoModifier)
                event2 = QMouseEvent(event)
                self.d.ignoreList.append(event1)
                self.d.ignoreList.append(event2)
                QApplication.postEvent(self.d.target, event1)
                QApplication.postEvent(self.d.target, event2)

        elif self.d.state == FlickablePrivate.ManualScroll:
            event.accept()
            delta = event.pos() - self.d.pressPos
            if self.d.timeStamp.elapsed() > 100:
                self.d.timeStamp = QTime.currentTime()
                self.d.speed = delta - self.d.delta
                self.d.delta = delta

            self.d.offset = self.scrollOffset()
            self.d.pressPos = QPoint(event.pos())
            if self.d.speed == QPoint(0, 0):
                self.d.state = FlickablePrivate.Steady
            else:
                self.d.speed /= 4
                self.d.state = FlickablePrivate.AutoScroll
                self.d.ticker.start(20)

        elif self.d.state == FlickablePrivate.Stop:
            event.accept()
            self.d.state = FlickablePrivate.Steady
            self.d.offset = self.scrollOffset()
Esempio n. 29
0
    def handleMouseRelease(self, event):

        event.ignore()

        if event.button() != Qt.LeftButton:
            return

        if event in self.d.ignoreList:
            self.d.ignoreList.remove(event)
            return

        if self.d.state == FlickablePrivate.Pressed:
            event.accept()
            self.d.state = FlickablePrivate.Steady
            if self.d.target:
                event1 = QMouseEvent(QEvent.MouseButtonPress, self.d.pressPos,
                                     Qt.LeftButton, Qt.LeftButton,
                                     Qt.NoModifier)
                event2 = QMouseEvent(event)
                self.d.ignoreList.append(event1)
                self.d.ignoreList.append(event2)
                QApplication.postEvent(self.d.target, event1)
                QApplication.postEvent(self.d.target, event2)

        elif self.d.state == FlickablePrivate.ManualScroll:
            event.accept()
            delta = event.pos() - self.d.pressPos
            if self.d.timeStamp.elapsed() > 100:
                self.d.timeStamp = QTime.currentTime()
                self.d.speed = delta - self.d.delta
                self.d.delta = delta

            self.d.offset = self.scrollOffset()
            self.d.pressPos = QPoint(event.pos())
            if self.d.speed == QPoint(0, 0):
                self.d.state = FlickablePrivate.Steady
            else:
                self.d.speed /= 4
                self.d.state = FlickablePrivate.AutoScroll
                self.d.ticker.start(20)

        elif self.d.state == FlickablePrivate.Stop:
            event.accept()
            self.d.state = FlickablePrivate.Steady
            self.d.offset = self.scrollOffset()
Esempio n. 30
0
    def paintEvent(self, e):
        time = QTime.currentTime()
        qp = QPainter()

        qp.begin(self)
        #qp.setRenderHint(QPainter.Antialiasing)  # 开启这个抗锯齿,会很占cpu的!
        qp.translate(self.width() / 2, self.height() / 2)
        qp.scale(self.side / 200.0, self.side / 200.0)

        qp.setPen(QtCore.Qt.NoPen)
        qp.setBrush(self.hourColor)
        qp.save()
        qp.rotate(30.0 * ((time.hour() + time.minute() / 60.0)))
        qp.drawConvexPolygon(self.hourHand)
        qp.restore()

        qp.setPen(self.hourColor)
        for i in range(12):
            qp.drawLine(88, 0, 96, 0)
            qp.rotate(30.0)

        qp.setPen(QtCore.Qt.NoPen)
        qp.setBrush(self.minuteColor)
        qp.save()

        qp.rotate(6.0 * ((time.minute() +
                          (time.second() + time.msec() / 1000.0) / 60.0)))
        qp.drawConvexPolygon(self.minuteHand)
        qp.restore()

        qp.setPen(self.minuteColor)
        for i in range(60):
            if (i % 5) is not 0:
                qp.drawLine(92, 0, 96, 0)
            qp.rotate(6.0)

        qp.setPen(QtCore.Qt.NoPen)
        qp.setBrush(self.secondColor)
        qp.save()
        qp.rotate(6.0 * (time.second() + time.msec() / 1000.0))
        qp.drawConvexPolygon(self.secondHand)

        qp.restore()
        qp.end()
Esempio n. 31
0
File: clock.py Progetto: BlueAaron/-
    def paintEvent(self, e): 
        time = QTime.currentTime() 
        qp = QPainter()

        qp.begin(self)
        #qp.setRenderHint(QPainter.Antialiasing)  # 开启这个抗锯齿,会很占cpu的!
        qp.translate(self.width() / 2, self.height() / 2) 
        qp.scale(self.side / 200.0, self.side / 200.0)
 
        qp.setPen(QtCore.Qt.NoPen)
        qp.setBrush(self.hourColor)
        qp.save()
        qp.rotate(30.0 * ((time.hour() + time.minute()/ 60.0)))
        qp.drawConvexPolygon(self.hourHand)
        qp.restore()
        
        qp.setPen(self.hourColor)
        for i in range(12): 
            qp.drawLine(88, 0, 96, 0)
            qp.rotate(30.0) 
        
        qp.setPen(QtCore.Qt.NoPen)
        qp.setBrush(self.minuteColor)
        qp.save()
        
        qp.rotate(6.0 * ((time.minute() + (time.second()+time.msec()/1000.0) / 60.0)))
        qp.drawConvexPolygon(self.minuteHand)
        qp.restore()
        
        
        qp.setPen(self.minuteColor)
        for i in range(60): 
            if (i % 5) is not 0:
                qp.drawLine(92, 0, 96, 0)
            qp.rotate(6.0) 
        
        qp.setPen(QtCore.Qt.NoPen)
        qp.setBrush(self.secondColor)
        qp.save()
        qp.rotate(6.0*(time.second()+time.msec()/1000.0))
        qp.drawConvexPolygon(self.secondHand)

        qp.restore() 
        qp.end() 
Esempio n. 32
0
 def startTimers(self): 
     if self._static:
         return
     #set up the Qt Seconds Timers using lightweight QBasic timer
     self.secTimer.start(self.secTimerType, self)
     #set up the Qt Minute Timer every 5 secs for Auto,10 seconds for Quartz,60 secs for Eco
     if self.clockMode == self.ECO:
             self.svgSecond.setOpacity(0.0)
             self.connect(self.syncTimer, SIGNAL("timeout()"), self.startMin)
             self.time = QTime.currentTime()
             self.syncTimer.setSingleShot(1)
             self.syncTimer.start((60-self.time.second())*1000)
     else : 
             self.svgSecond.setOpacity(1.0)
             self.connect(self.minTimer, SIGNAL("timeout()"), self.showTime)
             self.minTimer.start(self.minTimerType)
     #set up the recalibrate timer every 10Secs
     self.connect(self.calibrateTimer, SIGNAL("timeout()"), self.calibrateTime)
     self.calibrateTimer.start(6000)
Esempio n. 33
0
    def resetViewer(self):
        self.imgCount = 0
        del self.x[:]
        self.x.append(0)
        del self.y[:]
        self.y.append(0)
        del self.augAccuracy[:]
        for augmentation in range(self.batch_size_int):
            self.augAccuracy.append([0])

        self.lastTime = 0
        self.elapsedTime = QTime.currentTime()
        self.totalElapsedTime = 0.0
        self.progIndex = 0
        self.showAug = False
        self.lastIndex = self.frameCount - 1
        self.totalCurve.clear()
        self.augCurve.clear()
        self.name_label.setText("Model: %s" % (self.model_name))
        self.legend.removeItem(self.lastAugName)
Esempio n. 34
0
	def StartWorking(self):
		if not self.running:
			self.running=True
			secTimer=QTimer(self)
			secTimer.start(1000)
			self.secTimer=secTimer
			self.time=QTime.currentTime()
			self.textEdit.setText(self.time.toString("hh:mm:ss"))
			secTimer=QTimer(self)
			secTimer.start(3000)
			self.secTimer=secTimer
			self.connect(secTimer,SIGNAL("timeout()"),self.UpdateText)

			secTimerCls=QTimer(self)
			secTimerCls.start(180000)
			self.secTimerCls=secTimerCls
			self.connect(secTimerCls,SIGNAL("timeout()"),self.ClearText)


		else:
			self.running=False
			self.secTimer.stop()
    def __update_weatherdata(self):

        if self.lastUpdate == None:
            #print("Update Weather data because of None")
            #self.emit(SIGNAL("start_loading"))
            if self.__service_available():
                try:
                    self.weatherdata = weather.get_weather_from_weather_com(
                        self.LOCATION_ID)
                    #self.emit(SIGNAL("stop_loading"))
                    self.lastUpdate = [
                        QTime.hour(QTime.currentTime()),
                        QTime.minute(QTime.currentTime())
                    ]
                    return True, True
                except:  # it can still go something wrong with the API of weather.com ... if so, I have to avoid a crash
                    self.lastUpdate = None
                    return False, True
            else:
                self.lastUpdate = None
                return False, True
        elif self.lastUpdate[0] < QTime.hour(QTime.currentTime()) or \
                        self.lastUpdate[1] < (QTime.minute(QTime.currentTime()) -10):
            #print("Update Weather data because of long periode without update")
            self.emit(SIGNAL("start_loading"))
            if self.__service_available():
                try:
                    self.weatherdata = weather.get_weather_from_weather_com(
                        self.LOCATION_ID)
                    self.emit(SIGNAL("stop_loading"))
                    self.lastUpdate = [
                        QTime.hour(QTime.currentTime()),
                        QTime.minute(QTime.currentTime())
                    ]
                    return True, True
                except:  # it can still go something wrong with the API of weather.com ... if so, I have to avoid a crash
                    self.lastUpdate = None
                    return False, True
            else:
                self.lastUpdate = None
                return False, True
        else:
            #print("It is just a few minutes ago that i updated the weather data... not again :-)")
            return True, False  # Data is up to date, available but with no changes...
Esempio n. 36
0
	def SetupUi(self):
		toggleButton=QPushButton("Start!",self)
		clearButton=QPushButton("Clear!",self)
		statusBar=QStatusBar()
		self.statusBar=statusBar
		self.toggleButton=toggleButton
		self.clearButton=clearButton

		textEdit=QTextEdit()
		self.textEdit=textEdit

		self.date=QDate.currentDate()
		self.time=QTime.currentTime()
		statusText=self.time.toString("hh:mm:ss")
		statusText="Start up @ " +self.date.toString("yyyy-MM-dd")+" "+statusText
		self.statusBar.showMessage(statusText)
		
		grid=QGridLayout()
		grid.addWidget(textEdit,1,0)
		grid.addWidget(toggleButton,2,1)
		grid.addWidget(clearButton,2,2)
		grid.addWidget(statusBar,2,0)
		self.setLayout(grid)
		self.resize(500,500)
    def update_widget(self):
        weatherDataUpToDate, changes = self.__update_weatherdata()
        print("Set new name to Hometownlabel of weatherwidget")
        self.lbl_hometown.setText(self.LOCATION_NAME)
        if weatherDataUpToDate:
            if not changes:
                #print("No Changes... do not repopulate the icons...")
                return
            ############################################Current Condition#############################################
            #print("Startpopulating", QTime.currentTime())
            #print("Startpopulating", self.weatherdata["current_conditions"])
            self.lbl_cur_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER,
                             self.weatherdata['current_conditions']['icon']))
            self.lbl_cur_temp.setText(
                self.weatherdata['current_conditions']['temperature'])
            self.lbl_cur_temp_feel.setText(
                self.weatherdata['current_conditions']['feels_like'])

            if QTime.currentTime() < dayend_definition:
                possible_rain = int(
                    self.weatherdata['forecasts'][0]['day']['chance_precip'])
                self.lbl_cur_rain.setText(
                    str(possible_rain) if possible_rain != 100 else "99")
            else:
                possible_rain = int(
                    self.weatherdata['forecasts'][0]['night']['chance_precip'])
                self.lbl_cur_rain.setText(
                    str(possible_rain) if possible_rain != 100 else "99")

            windspeed = self.weatherdata['current_conditions']['wind']['speed']
            if windspeed == "calm" or windspeed == "CALM":
                windspeed = "0"
            self.lbl_cur_wind.setText(windspeed)
            winddirection = self.weatherdata['current_conditions']['wind'][
                'text']
            if winddirection == "calm" or winddirection == "CALM":
                winddirection = "--"
            self.lbl_cur_wind_direction.setText('"{0}"'.format(winddirection))
            self.lbl_cur_sunrise.setText(
                self.weatherdata['forecasts'][0]['sunrise'])
            self.lbl_cur_sunset.setText(
                self.weatherdata['forecasts'][0]['sunset'])
            ########################################## Forcast Area ##################################################
            ###############################Day 1 #####################################################################
            self.label_15.setText(
                self.tr(self.weatherdata['forecasts'][0]['day_of_week']))
            self.lbl_day_0_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER,
                             self.weatherdata['forecasts'][0]['day']['icon'],
                             "static"))
            self.lbl_night_0_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER,
                             self.weatherdata['forecasts'][0]['night']['icon'],
                             "static"))
            self.lbl_day_0_temp.setText(
                self.weatherdata['forecasts'][0]['high'])
            possible_rain0_day = int(
                self.weatherdata['forecasts'][0]['day']['chance_precip'])
            self.lbl_day_0_rain.setText(
                str(possible_rain0_day) if possible_rain0_day != 100 else "99")
            self.lbl_night_0_temp.setText(
                self.weatherdata['forecasts'][0]['low'])
            possible_rain0_night = int(
                self.weatherdata['forecasts'][0]['night']['chance_precip'])
            self.lbl_night_0_rain.setText(
                str(possible_rain0_night
                    ) if possible_rain0_night != 100 else "99")
            ###############################Day 2 #####################################################################
            self.label_16.setText(
                self.tr(self.weatherdata['forecasts'][1]['day_of_week']))
            self.lbl_day_1_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER,
                             self.weatherdata['forecasts'][1]['day']['icon'],
                             "static"))
            self.lbl_night_1_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER,
                             self.weatherdata['forecasts'][1]['night']['icon'],
                             "static"))
            self.lbl_day_1_temp.setText(
                self.weatherdata['forecasts'][1]['high'])
            possible_rain1_day = int(
                self.weatherdata['forecasts'][1]['day']['chance_precip'])
            self.lbl_day_1_rain.setText(
                str(possible_rain1_day) if possible_rain1_day != 100 else "99")
            self.lbl_night_1_temp.setText(
                self.weatherdata['forecasts'][1]['low'])
            possible_rain1_night = int(
                self.weatherdata['forecasts'][1]['night']['chance_precip'])
            self.lbl_night_1_rain.setText(
                str(possible_rain1_night
                    ) if possible_rain1_night != 100 else "99")
            ###############################Day 3 #####################################################################
            self.label_17.setText(
                self.tr(self.weatherdata['forecasts'][2]['day_of_week']))
            self.lbl_day_2_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER,
                             self.weatherdata['forecasts'][2]['day']['icon'],
                             "static"))
            self.lbl_night_2_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER,
                             self.weatherdata['forecasts'][2]['night']['icon'],
                             "static"))
            self.lbl_day_2_temp.setText(
                self.weatherdata['forecasts'][2]['high'])
            possible_rain2_day = int(
                self.weatherdata['forecasts'][2]['day']['chance_precip'])
            self.lbl_day_2_rain.setText(
                str(possible_rain2_day) if possible_rain2_day != 100 else "99")
            self.lbl_night_2_temp.setText(
                self.weatherdata['forecasts'][2]['low'])
            possible_rain2_night = int(
                self.weatherdata['forecasts'][2]['night']['chance_precip'])
            self.lbl_night_2_rain.setText(
                str(possible_rain2_night
                    ) if possible_rain2_night != 100 else "99")

            #print("End Polulating", QTime.currentTime())

        else:
            #print("Setting Fallback")
            ############################################Current Condition#############################################
            self.lbl_cur_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER, ""))
            self.lbl_cur_temp.setText("--")
            self.lbl_cur_temp_feel.setText("--")
            self.lbl_cur_rain.setText("--")
            self.lbl_cur_wind.setText("--")
            self.lbl_cur_wind_direction.setText("--")
            self.lbl_cur_sunrise.setText("--")
            self.lbl_cur_sunset.setText("--")
            ########################################## Forcast Area ##################################################
            ###############################Day 1 #####################################################################
            self.label_15.setText(" No Connection ")
            self.lbl_day_0_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER, ""))
            self.lbl_night_0_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER, ""))
            self.lbl_day_0_temp.setText("--")
            self.lbl_day_0_rain.setText("--")
            self.lbl_night_0_temp.setText("--")
            self.lbl_night_0_rain.setText("--")
            ###############################Day 2 #####################################################################
            self.label_16.setText(" No Connection ")
            self.lbl_day_1_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER, ""))
            self.lbl_night_1_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER, ""))
            self.lbl_day_1_temp.setText("--")
            self.lbl_day_1_rain.setText("--")
            self.lbl_night_1_temp.setText("--")
            self.lbl_night_1_rain.setText("--")
            ###############################Day 3 #####################################################################
            self.label_17.setText(" No Connection ")
            self.lbl_day_2_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER, ""))
            self.lbl_night_2_icon.setPicturePath(
                os.path.join(self.WEATHER_ICONS_FOLDER, ""))
            self.lbl_day_2_temp.setText("--")
            self.lbl_day_2_rain.setText("--")
            self.lbl_night_2_temp.setText("--")
            self.lbl_night_2_rain.setText("--")

            print("Failed COnnections: ", self.failedConnections)
            if self.failedConnections < 3:
                QTimer.singleShot(10000, self.update_widget)
            else:
                self.failedConnections = 0
                QTimer.singleShot(100000, self.update_widget)
            #    print("No Connection to weathersurver possible delay ")

        self.update()
Esempio n. 38
0
 def on_upload_thread_information(self, info):
     time = QTime(QTime.currentTime())
     self.textBrowser.append(u"[%s] %s" % (time.toString(), info))
import pickle
import multiprocessing
from multiprocessing import Process, Pipe, Event
import time
import numpy as np
import sys
from source.generator import reader, writer
print('\n\n')

from PyQt4.QtCore import QTime, QTimer, QDate

if __name__=='__main__':
    timer = QTime.currentTime()
    terminate_measurement = Event()
    pipe_read, pipe_write = Pipe()
    tasks = multiprocessing.Queue()
    mgr = multiprocessing.Manager()
    settings = mgr.dict()
    settings['time'] = timer
    settings['kkk'] = 1
    settings['measure'] = False

    reader_p = reader(pipe_read,terminate_measurement,tasks,settings)
    reader_p.daemon = True

    writer_p = writer(pipe_write,terminate_measurement,tasks,settings)
    writer_p.daemon = True

    # del writer_p.context
    # del reader_p.process
Esempio n. 40
0
    def __init__(self, model_name, model_format, image_dir, model_location,
                 label, hierarchy, image_val, input_dims, output_dims,
                 batch_size, output_dir, add, multiply, verbose, fp16, replace,
                 loop, rali_mode, gui, container_logo, fps_file, cpu_name,
                 gpu_name, parent):
        super(InferenceViewer, self).__init__(parent)
        self.parent = parent

        self.model_name = model_name
        self.model_format = model_format
        self.image_dir = image_dir
        self.model_location = model_location
        self.label = label
        self.hierarchy = hierarchy
        self.image_val = image_val
        self.input_dims = input_dims
        self.output_dims = output_dims
        self.batch_size = batch_size
        self.batch_size_int = (int)(batch_size)
        self.output_dir = output_dir
        self.add = add
        self.multiply = multiply
        self.gui = True if gui == 'yes' else False
        self.fp16 = fp16
        self.replace = replace
        self.verbose = verbose
        self.loop = loop
        self.rali_mode = rali_mode
        inputImageDir = os.path.expanduser(image_dir)
        self.total_images = len(os.listdir(inputImageDir))
        self.origImageQueue = Queue.Queue()
        self.augImageQueue = Queue.Queue()
        self.fps_file = fps_file
        self.inferenceEngine = None
        self.receiver_thread = None

        self.initEngines()

        if self.gui:
            self.container_index = (int)(container_logo)
            self.cpu_name = cpu_name
            self.gpu_name = gpu_name
            self.pauseState = False
            self.showAug = False
            self.elapsedTime = QTime.currentTime()
            self.lastTime = 0
            self.totalElapsedTime = 0.0
            self.totalAccuracy = 0
            self.progIndex = 0
            self.augIntensity = 0.0
            self.imgCount = 0
            self.frameCount = 9
            self.lastIndex = self.frameCount - 1
            self.x = [0]
            self.y = [0]
            self.augAccuracy = []
            self.totalCurve = None
            self.augCurve = None
            self.graph = None
            self.legend = None
            self.lastAugName = None
            self.pen = pg.mkPen('w', width=4)
            self.AMD_Radeon_pixmap = QPixmap("./data/images/AMD_Radeon.png")
            self.AMD_Radeon_white_pixmap = QPixmap(
                "./data/images/AMD_Radeon-white.png")
            self.MIVisionX_pixmap = QPixmap("./data/images/MIVisionX-logo.png")
            self.MIVisionX_white_pixmap = QPixmap(
                "./data/images/MIVisionX-logo-white.png")
            self.EPYC_pixmap = QPixmap("./data/images/EPYC-blue.png")
            self.EPYC_white_pixmap = QPixmap(
                "./data/images/EPYC-blue-white.png")
            self.docker_pixmap = QPixmap("./data/images/Docker.png")
            self.singularity_pixmap = QPixmap("./data/images/Singularity.png")
            self.rali_pixmap = QPixmap("./data/images/RALI.png")
            self.rali_white_pixmap = QPixmap("./data/images/RALI-white.png")
            self.graph_image_pixmap = QPixmap("./data/images/Graph-image.png")
            self.graph_image_white_pixmap = QPixmap(
                "./data/images/Graph-image-white.png")

            self.initUI()
            self.updateTimer = QTimer()
            self.updateTimer.timeout.connect(self.update)
            self.updateTimer.timeout.connect(self.plotGraph)
            self.updateTimer.timeout.connect(self.setProgressBar)
            self.updateTimer.start(40)
Esempio n. 41
0
    def __init__(self, parent=None):
        '''
        Constructor
        '''
        QWidget.__init__(self, parent)
        self.mainLayout = QVBoxLayout()
        self.setLayout(self.mainLayout)

        self.addTalkGroupBox = QGroupBox("Add Talk")
        self.mainLayout.addWidget(self.addTalkGroupBox)

        self.addTalkLayout = QFormLayout()
        self.addTalkGroupBox.setLayout(self.addTalkLayout)

        # Title
        self.titleLabel = QLabel("Title")
        self.titleLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.titleLineEdit.setPlaceholderText("Title of the presentation")
        self.titleLabel.setBuddy(self.titleLineEdit)
        self.addTalkLayout.addRow(self.titleLabel, self.titleLineEdit)

        # Presenter
        self.presenterLabel = QLabel("Presenter")
        self.presenterLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.presenterLineEdit.setPlaceholderText("Name person or people presenting (comma separated)")
        self.presenterLabel.setBuddy(self.presenterLineEdit)
        self.addTalkLayout.addRow(self.presenterLabel, self.presenterLineEdit)

        # Event
        self.eventLabel = QLabel("Event")
        self.eventLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.eventLineEdit.setPlaceholderText("The name of the Event this talk is being presented at")
        self.eventLabel.setBuddy(self.eventLineEdit)
        self.addTalkLayout.addRow(self.eventLabel, self.eventLineEdit)

        # Room
        self.roomLabel = QLabel("Room")
        self.roomLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.roomLineEdit.setPlaceholderText("The Room in which the presentation is taking place")
        self.roomLabel.setBuddy(self.roomLineEdit)
        self.addTalkLayout.addRow(self.roomLabel, self.roomLineEdit)

        # Date
        current_date = QDate()
        self.dateLabel = QLabel("Date")
        self.dateEdit = QDateEdit()
        self.dateEdit.setDate(current_date.currentDate())
        self.dateLabel.setBuddy(self.dateEdit)
        self.addTalkLayout.addRow(self.dateLabel, self.dateEdit)

        self.dateEdit.setCalendarPopup(True)

        # Time
        current_time = QTime()
        self.timeLabel = QLabel("Time")
        self.timeEdit = QTimeEdit()
        self.timeEdit.setTime(current_time.currentTime())
        self.timeLabel.setBuddy(self.dateEdit)
        self.addTalkLayout.addRow(self.timeLabel, self.timeEdit)

        # Buttons
        addIcon = QIcon.fromTheme("list-add")
        cancelIcon = QIcon.fromTheme("edit-clear")

        self.buttonsWidget = QHBoxLayout()
        self.addButton = QPushButton("Add")
        self.addButton.setIcon(addIcon)
        self.cancelButton = QPushButton("Cancel")
        self.cancelButton.setIcon(cancelIcon)
        self.buttonsWidget.addWidget(self.addButton)
        self.buttonsWidget.addWidget(self.cancelButton)
        self.addTalkLayout.addRow(None, self.buttonsWidget)
 def updateTime(self):
     global s11,l_1
     time = QTime.currentTime().toString()
     x = random.randint(49,50)
     self.update_value(x)
Esempio n. 43
0
 def __postText(self, text):
     if self.checkBoxTimestamp.isChecked():
         time = QTime.currentTime().toString()
         self.textEditTraffic.append("%s - %s" % (time, text))
     else:
         self.textEditTraffic.append(text)
    def reset_form(self):
        """
        Reset fields in UI to default.
        :return: None
        """
        self.check = 0
        self.home = [self.loadError, self.autoFillError]

        self.layInfo = [
            self.abs, self.atitle, self.hlName, self.purpose, self.title
        ]

        self.contact = [
            self.city1, self.city2, self.country1, self.country2, self.dadd1,
            self.dadd2, self.email1, self.email2, self.fas1, self.fas2,
            self.iName1, self.iName2, self.oName1, self.oName2, self.pName1,
            self.pName2, self.postCode1, self.postCode2, self.role1,
            self.role2, self.voice1, self.voice2
        ]

        self.idenInfo = [
            self.date, self.lineage, self.maintenance, self.status,
            self.spatialrep, self.resolutionText, self.westExtent,
            self.northExtent, self.southExtent, self.eastExtent,
            self.topicCategory
        ]

        self.security = [
            self.metSecClass, self.metadataConCopyright,
            self.metadataConLicense, self.resSecClass,
            self.resourceConCopyright, self.resourceConLicense
        ]

        self.summaryF = [self.validationLog, self.summary, self.metadataTable]

        self.hideF = [
            self.iNameError1, self.iNameError2, self.oNameError1,
            self.oNameError2, self.pNameError1, self.pNameError2,
            self.voiceError1, self.voiceError2, self.fasError1, self.fasError2,
            self.dadd1Error, self.cityError1, self.cityError2,
            self.countryError1, self.postCode2Error, self.emailError1,
            self.emailError2, self.roleError1, self.roleError2,
            self.hlNameError, self.titleError, self.purposeError,
            self.resSecClassError, self.dadd2Error, self.metSecClassError,
            self.resourceConCopyrightError, self.statusError,
            self.resourceConLicenseError, self.lineageError,
            self.metadataConCopyrightError, self.atitleError,
            self.metadataConLicenseError, self.dONUCheckError,
            self.geogDesListError, self.absError, self.geoBBNorthLabelError,
            self.temporalCheckError, self.referenceSysError,
            self.spatialrepError, self.maintenanceError, self.keywordListError,
            self.topicCategoryError, self.scaleRadioButtonError,
            self.postCode1Error, self.resolutionRadioButtonError,
            self.countryError2, self.resourceCreateCheckError, self.fixError,
            self.publishMetadata, self.bbError
        ]

        self.clear = (self.layInfo + self.contact + self.idenInfo + self.home +
                      self.security + self.summaryF)

        self.checked = [
            self.scale, self.endTimeCheck, self.resourceCreateCheck,
            self.resourcePublishCheck, self.resourceUpdateCheck,
            self.temporalCheck, self.endDateCheck, self.dONUCheck,
            self.startTimeCheck
        ]

        self.enabled = [
            self.createMetadata, self.date, self.resolutionText, self.rUnits,
            self.scaleFrame, self.resourceCreate, self.resourcePublish,
            self.resourceUpdate, self.endTime, self.startDate, self.startTime,
            self.endDateCheck, self.startTimeCheck, self.endDate,
            self.endTimeCheck
        ]

        self.curDate = [
            self.date, self.resourceCreate, self.resourcePublish,
            self.resourceUpdate, self.startDate, self.endDate
        ]

        self.curTime = [self.startTime, self.endTime]

        self.curIndex = [self, self.rUnits]
        for field in self.hideF:
            field.hide()

        for field in self.clear:
            field.clear()

        for field in self.curIndex:
            field.setCurrentIndex(0)

        for field in self.enabled:
            field.setEnabled(False)

        for field in self.checked:
            field.setChecked(False)

        for field in self.curDate:
            field.setDate(QDate.currentDate())

        for field in self.curTime:
            field.setTime(QTime.currentTime())

        self.scaleWidget.setScaleString("0")

        for i in range(self.keywordList.count()):
            item = self.keywordList.item(i)
            item.setSelected(False)

        for i in range(self.geogDesList.count()):
            item = self.geogDesList.item(i)
            item.setSelected(False)

        for i in range(1, self.count()):
            self.setTabEnabled(i, False)
Esempio n. 45
0
    def newDocument( self ):
        """
        cargar todos los modelos para la edición
        """
        query = QSqlQuery()
        try:
            if not self.database.isOpen():
                if not self.database.open():
                    raise UserWarning( u"No se pudo establecer la conexión con la base de datos" )
            for window in self.parentWindow.findChild( QMdiArea ).subWindowList():
                if window.widget():
                    raise UserWarning( u"Por favor cierre las otras pestañas"
                                       + u" de la aplicación antes de continuar"
                                       + " con el arqueo" )


            self.editmodel = ArqueoModel( self.sesion )

            self.editmodel.datetime.setDate( self.sesion.fecha )
            self.editmodel.datetime.setTime( QTime.currentTime() )


            self.__dolar_proxy.setSourceModel( self.editmodel )
            self.__dolar_proxy.setFilterKeyColumn( MONEDA )
            self.__dolar_proxy.setFilterRegExp( r"^%d$" % constantes.IDDOLARES )
            self.__dolar_proxy.setDynamicSortFilter( True )


            self.__cordoba_proxy.setSourceModel( self.editmodel )
            self.__cordoba_proxy.setFilterKeyColumn( MONEDA )
            self.__cordoba_proxy.setFilterRegExp( r"^%d$" % constantes.IDCORDOBAS )
            self.__cordoba_proxy.setDynamicSortFilter( True )

            self.tabledetailsC.setModel( self.__cordoba_proxy )
            self.tabledetailsD.setModel( self.__dolar_proxy )

            if not self.database.isOpen():
                if not self.database.open():
                    raise UserWarning( "No se pudo conectar con la base de datos" )

            #verificar si hay documentos pendientes de aprobación
            q = """
            SELECT
                CONCAT_WS(' ', td.descripcion, d.ndocimpreso)
            FROM documentos sesion
            JOIN docpadrehijos dpd ON dpd.idpadre = sesion.iddocumento
            JOIN documentos d ON dpd.idhijo  = d.iddocumento
            JOIN tiposdoc td ON td.idtipodoc = d.idtipodoc
            WHERE d.idestado NOT IN ( %d,%d)
            """ % ( constantes.CONFIRMADO,
                    constantes.ANULADO )
            if not query.exec_( q ):
                raise Exception( u"No se pudo ejecutar la consulta para "\
                                 + "determinar si existen documentos "
                                 + "pendientes de aprobación" )
            if not query.size() == 0:
                raise UserWarning( u"Existen documentos pendientes de "\
                                   + "aprobación en la sesión" )


            #Obtener los datos de la sesión
            q = """
            CALL spConsecutivo( %d, NULL )
            """ % constantes.IDARQUEO
            #query.prepare( q )

            if not query.exec_( q ):
                raise Exception( u"No se pudo ejecutar la consulta para "\
                                 + "obtener el numero del arqueo" )
            if not query.size() > 0:
                raise Exception( u"La consulta para obtener el numero del "\
                                 + "arqueo no devolvio ningún valor" )
            query.first()

            self.editmodel.printedDocumentNumber = query.value( 0 ).toString()
            self.editmodel.exchangeRateId = self.sesion.tipoCambioId
            self.editmodel.exchangeRate = self.sesion.tipoCambioOficial

            self.editmodel.datetime.setDate( self.sesion.fecha )

            q = """
            CALL spTotalesSesion(%d);
            """ % self.sesion.sesionId

            if not query.exec_( q ):
                raise UserWarning( u"No se pudieron calcular los totales"\
                                   + " de la sesión" )
            while query.next():
                if query.value( 0 ).toInt()[0] == constantes.IDPAGOEFECTIVO and query.value( 2 ).toInt()[0] == constantes.IDDOLARES:
                    self.editmodel.expectedCashD = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGOEFECTIVO and query.value( 2 ).toInt()[0] == constantes.IDCORDOBAS:
                    self.editmodel.expectedCashC = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGOCHEQUE and query.value( 2 ).toInt()[0] == constantes.IDDOLARES:
                    self.editmodel.expectedCkD = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGOCHEQUE and query.value( 2 ).toInt()[0] == constantes.IDCORDOBAS:
                    self.editmodel.expectedCkC = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGODEPOSITO and query.value( 2 ).toInt()[0] == constantes.IDDOLARES:
                    self.editmodel.expectedDepositD = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGODEPOSITO  and query.value( 2 ).toInt()[0] == constantes.IDCORDOBAS:
                    self.editmodel.expectedDepositC = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGOTRANSFERENCIA  and query.value( 2 ).toInt()[0] == constantes.IDDOLARES:
                    self.editmodel.expectedTransferD = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGOTRANSFERENCIA  and query.value( 2 ).toInt()[0] == constantes.IDCORDOBAS:
                    self.editmodel.expectedTransferC = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGOTARJETA  and query.value( 2 ).toInt()[0] == constantes.IDDOLARES:
                    self.editmodel.expectedCardD = Decimal( query.value( 5 ).toString() )
                elif query.value( 0 ).toInt()[0] == constantes.IDPAGOTARJETA  and query.value( 2 ).toInt()[0] == constantes.IDCORDOBAS:
                    self.editmodel.expectedCardC = Decimal( query.value( 5 ).toString() )

            q = """
            SELECT
                d.iddenominacion,
                CONCAT_WS( ' ',d.valor, m.moneda),
                d.valor,
                d.idtipomoneda,
                m.simbolo
            FROM denominaciones d
            JOIN tiposmoneda m ON d.idtipomoneda = m.idtipomoneda
            WHERE d.activo = 1
            ORDER BY d.idtipomoneda, d.valor
            """
            if not query.exec_( q ):
                raise UserWarning( "No se pudo recuperar la lista de "
                                   + "denominaciones" )
            denominationsmodelC = SingleSelectionModel()
            denominationsmodelC.headers = ["Id",
                                            u"Denominación",
                                            "Valor",
                                            "Id Moneda",
                                            "Simbolo"]
            denominationsmodelD = SingleSelectionModel()
            denominationsmodelD.headers = denominationsmodelC.headers


            while query.next():
                if query.value( 3 ).toInt()[0] == constantes.IDDOLARES:
                    denominationsmodelD.items.append( [
                                                  query.value( 0 ).toInt()[0], #el id del tipo de denominacion
                                                  query.value( 1 ).toString(), #La descripción de la denominación
                                                  query.value( 2 ).toString(), # el valor de la denominación
                                                  query.value( 3 ).toInt()[0], #El id del tipo de moneda
                                                  query.value( 4 ).toString() #El simbolo de la moneda
                                                  ] )
                else:
                    denominationsmodelC.items.append( [
                                                  query.value( 0 ).toInt()[0], #el id del tipo de denominacion
                                                  query.value( 1 ).toString(), #La descripción de la denominación
                                                  query.value( 2 ).toString() , # el valor de la denominación
                                                  query.value( 3 ).toInt()[0], #El id del tipo de moneda
                                                  query.value( 4 ).toString() #El simbolo de la moneda
                                                  ] )

            delegateC = ArqueoDelegate( denominationsmodelC )
            self.tabledetailsC.setItemDelegate( delegateC )

            delegateD = ArqueoDelegate( denominationsmodelD )
            self.tabledetailsD.setItemDelegate( delegateD )

            self.addLine()
            self.addLine()
            self.editmodel.setData( self.editmodel.index( 0, MONEDA ), constantes.IDDOLARES )
            self.editmodel.setData( self.editmodel.index( 1, MONEDA ), constantes.IDCORDOBAS )

            self.dtPicker.setDateTime( self.editmodel.datetime )

            self.lblUserName.setText( self.user.fullname )
            self.editmodel.dataChanged[QModelIndex, QModelIndex].connect( self.updateLabels )

            self.tabledetailsC.setColumnWidth( DENOMINACION, 200 )
            self.tabledetailsD.setColumnWidth( DENOMINACION, 200 )
            self.updateLabels()
            self.status = False

        except UserWarning as inst:
            logging.error( unicode( inst ) )
            logging.error( query.lastError().text() )
            QMessageBox.critical( self,
                                  qApp.organizationName(),
                                  unicode( inst ) )
            self.status = True
        except Exception  as inst:
            logging.critical( unicode( inst ) )
            logging.critical( query.lastError().text() )
            QMessageBox.critical( self,
                                  qApp.organizationName(),
                               "El sistema no pudo iniciar un nuevo arqueo" )
            self.status = True
        finally:
            if self.database.isOpen():
                self.database.close()
Esempio n. 46
0
    def __init__(self, parent=None):
        '''
        Constructor
        '''
        QWidget.__init__(self, parent)
        self.mainLayout = QVBoxLayout()
        self.setLayout(self.mainLayout)

        self.addTalkGroupBox = QGroupBox("Add Talk")
        self.mainLayout.addWidget(self.addTalkGroupBox)

        self.addTalkLayout = QFormLayout()
        self.addTalkGroupBox.setLayout(self.addTalkLayout)

        # Title
        self.titleLabel = QLabel("Title")
        self.titleLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.titleLineEdit.setPlaceholderText("Title of the presentation")
        self.titleLabel.setBuddy(self.titleLineEdit)
        self.addTalkLayout.addRow(self.titleLabel, self.titleLineEdit)

        # Presenter
        self.presenterLabel = QLabel("Presenter")
        self.presenterLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.presenterLineEdit.setPlaceholderText(
                "Name person or people presenting (comma separated)")
        self.presenterLabel.setBuddy(self.presenterLineEdit)
        self.addTalkLayout.addRow(self.presenterLabel, self.presenterLineEdit)

        # Event
        self.eventLabel = QLabel("Event")
        self.eventLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.eventLineEdit.setPlaceholderText(
                "The name of the Event this talk is being presented at")
        self.eventLabel.setBuddy(self.eventLineEdit)
        self.addTalkLayout.addRow(self.eventLabel, self.eventLineEdit)

        # Room
        self.roomLabel = QLabel("Room")
        self.roomLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.roomLineEdit.setPlaceholderText(
                "The Room in which the presentation is taking place")
        self.roomLabel.setBuddy(self.roomLineEdit)
        self.addTalkLayout.addRow(self.roomLabel, self.roomLineEdit)

        # Date
        current_date = QDate()
        self.dateLabel = QLabel("Date")
        self.dateEdit = QDateEdit()
        self.dateEdit.setDate(current_date.currentDate())
        self.dateLabel.setBuddy(self.dateEdit)
        self.addTalkLayout.addRow(self.dateLabel, self.dateEdit)

        self.dateEdit.setCalendarPopup(True)

        # Time
        current_time = QTime()
        self.timeLabel = QLabel("Time")
        self.timeEdit = QTimeEdit()
        self.timeEdit.setTime(current_time.currentTime())
        self.timeLabel.setBuddy(self.dateEdit)
        self.addTalkLayout.addRow(self.timeLabel, self.timeEdit)

        # Buttons
        addIcon = QIcon.fromTheme("list-add")
        cancelIcon = QIcon.fromTheme("edit-clear")

        self.buttonsWidget = QHBoxLayout()
        self.addButton = QPushButton("Add")
        self.addButton.setIcon(addIcon)
        self.cancelButton = QPushButton("Cancel")
        self.cancelButton.setIcon(cancelIcon)
        self.buttonsWidget.addWidget(self.addButton)
        self.buttonsWidget.addWidget(self.cancelButton)
        self.addTalkLayout.addRow(None, self.buttonsWidget)
Esempio n. 47
0
 def run(self):
     while True:
         time = QTime.currentTime()
         timestring = time.toString('hh:mm:ss')
         self.emit(SIGNAL('show_time(QString)'), timestring)
         self.sleep(1)
 def getTime(self):
     time = QTime.currentTime().toString()
     print(time)
Esempio n. 49
0
 def Time(self):
     time = QTime.currentTime().toString()
     self.CurTime.display(time)
Esempio n. 50
0
 def ownSleep(self,sec):
     dieTime = QTime.currentTime().addMSecs(sec)
     while(QTime.currentTime()<dieTime):
         QCoreApplication.processEvents(QEventLoop.AllEvents,100)
Esempio n. 51
0
File: main.py Progetto: BlueAaron/-
 def on_upload_thread_information(self, info):
     time = QTime(QTime.currentTime())
     self.textBrowser.append(u"[%s] %s" % (time.toString(), info))
Esempio n. 52
0
 def desenhoTela(self, tam):
     return QTime.currentTime().toString('hh:mm:ss')
Esempio n. 53
0
 def __postText(self, text):
     if self.checkBoxTimestamp.isChecked():
         time = QTime.currentTime().toString()
         self.textEditTraffic.append("%s - %s" % (time, text))
     else:
         self.textEditTraffic.append(text)
Esempio n. 54
0
    def get_time(self):
        from PyQt4.QtCore import QTime, QDate

        self.ui.dateEdit.setDate(QDate.currentDate())
        self.ui.timeEdit.setTime(QTime.currentTime())
Esempio n. 55
0
    def update_widget(self):
        weatherDataUpToDate, changes = self.__update_weatherdata()
        print("Set new name to Hometownlabel of weatherwidget")
        self.lbl_hometown.setText(self.LOCATION_NAME)
        if weatherDataUpToDate:
            if not changes:
                #print("No Changes... do not repopulate the icons...")
                return
            ############################################Current Condition#############################################
            #print("Startpopulating", QTime.currentTime())
            #print("Startpopulating", self.weatherdata["current_conditions"])
            self.lbl_cur_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,
                                                       self.weatherdata['current_conditions']['icon']))
            self.lbl_cur_temp.setText(self.weatherdata['current_conditions']['temperature'])
            self.lbl_cur_temp_feel.setText(self.weatherdata['current_conditions']['feels_like'])

            if QTime.currentTime() < dayend_definition:
                possible_rain=int(self.weatherdata['forecasts'][0]['day']['chance_precip'])
                self.lbl_cur_rain.setText(str(possible_rain) if possible_rain != 100 else "99")
            else:
                possible_rain= int(self.weatherdata['forecasts'][0]['night']['chance_precip'])
                self.lbl_cur_rain.setText(str(possible_rain) if possible_rain != 100 else "99")

            windspeed = self.weatherdata['current_conditions']['wind']['speed']
            if windspeed == "calm" or windspeed == "CALM":
                windspeed = "0"
            self.lbl_cur_wind.setText(windspeed)
            winddirection = self.weatherdata['current_conditions']['wind']['text']
            if winddirection == "calm" or winddirection == "CALM":
                winddirection = "--"
            self.lbl_cur_wind_direction.setText('"{0}"'.format(winddirection))
            self.lbl_cur_sunrise.setText(self.weatherdata['forecasts'][0]['sunrise'])
            self.lbl_cur_sunset.setText(self.weatherdata['forecasts'][0]['sunset'])
            ########################################## Forcast Area ##################################################
            ###############################Day 1 #####################################################################
            self.label_15.setText(self.tr(self.weatherdata['forecasts'][0]['day_of_week']))
            self.lbl_day_0_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,
                                                       self.weatherdata['forecasts'][0]['day']['icon'],"static"))
            self.lbl_night_0_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,
                                                       self.weatherdata['forecasts'][0]['night']['icon'],"static"))
            self.lbl_day_0_temp.setText(self.weatherdata['forecasts'][0]['high'])
            possible_rain0_day = int(self.weatherdata['forecasts'][0]['day']['chance_precip'])
            self.lbl_day_0_rain.setText(str(possible_rain0_day) if possible_rain0_day != 100 else "99")
            self.lbl_night_0_temp.setText(self.weatherdata['forecasts'][0]['low'])
            possible_rain0_night = int(self.weatherdata['forecasts'][0]['night']['chance_precip'])
            self.lbl_night_0_rain.setText(str(possible_rain0_night) if possible_rain0_night != 100 else "99")
            ###############################Day 2 #####################################################################
            self.label_16.setText(self.tr(self.weatherdata['forecasts'][1]['day_of_week']))
            self.lbl_day_1_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,
                                                       self.weatherdata['forecasts'][1]['day']['icon'],"static"))
            self.lbl_night_1_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,
                                                       self.weatherdata['forecasts'][1]['night']['icon'],"static"))
            self.lbl_day_1_temp.setText(self.weatherdata['forecasts'][1]['high'])
            possible_rain1_day = int(self.weatherdata['forecasts'][1]['day']['chance_precip'])
            self.lbl_day_1_rain.setText(str(possible_rain1_day) if possible_rain1_day != 100 else "99")
            self.lbl_night_1_temp.setText(self.weatherdata['forecasts'][1]['low'])
            possible_rain1_night = int(self.weatherdata['forecasts'][1]['night']['chance_precip'])
            self.lbl_night_1_rain.setText(str(possible_rain1_night) if possible_rain1_night != 100 else "99")
            ###############################Day 3 #####################################################################
            self.label_17.setText(self.tr(self.weatherdata['forecasts'][2]['day_of_week']))
            self.lbl_day_2_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,
                                                       self.weatherdata['forecasts'][2]['day']['icon'],"static"))
            self.lbl_night_2_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,
                                                       self.weatherdata['forecasts'][2]['night']['icon'],"static"))
            self.lbl_day_2_temp.setText(self.weatherdata['forecasts'][2]['high'])
            possible_rain2_day = int(self.weatherdata['forecasts'][2]['day']['chance_precip'])
            self.lbl_day_2_rain.setText(str(possible_rain2_day) if possible_rain2_day != 100 else "99")
            self.lbl_night_2_temp.setText(self.weatherdata['forecasts'][2]['low'])
            possible_rain2_night = int(self.weatherdata['forecasts'][2]['night']['chance_precip'])
            self.lbl_night_2_rain.setText(str(possible_rain2_night) if possible_rain2_night != 100 else "99")

            #print("End Polulating", QTime.currentTime())

        else:
            #print("Setting Fallback")
            ############################################Current Condition#############################################
            self.lbl_cur_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,""))
            self.lbl_cur_temp.setText("--")
            self.lbl_cur_temp_feel.setText("--")
            self.lbl_cur_rain.setText("--")
            self.lbl_cur_wind.setText("--")
            self.lbl_cur_wind_direction.setText("--")
            self.lbl_cur_sunrise.setText("--")
            self.lbl_cur_sunset.setText("--")
            ########################################## Forcast Area ##################################################
            ###############################Day 1 #####################################################################
            self.label_15.setText(" No Connection ")
            self.lbl_day_0_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,""))
            self.lbl_night_0_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,""))
            self.lbl_day_0_temp.setText("--")
            self.lbl_day_0_rain.setText("--")
            self.lbl_night_0_temp.setText("--")
            self.lbl_night_0_rain.setText("--")
            ###############################Day 2 #####################################################################
            self.label_16.setText(" No Connection ")
            self.lbl_day_1_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,""))
            self.lbl_night_1_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,""))
            self.lbl_day_1_temp.setText("--")
            self.lbl_day_1_rain.setText("--")
            self.lbl_night_1_temp.setText("--")
            self.lbl_night_1_rain.setText("--")
            ###############################Day 3 #####################################################################
            self.label_17.setText(" No Connection ")
            self.lbl_day_2_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,""))
            self.lbl_night_2_icon.setPicturePath(os.path.join(self.WEATHER_ICONS_FOLDER,""))
            self.lbl_day_2_temp.setText("--")
            self.lbl_day_2_rain.setText("--")
            self.lbl_night_2_temp.setText("--")
            self.lbl_night_2_rain.setText("--")

            print("Failed COnnections: ", self.failedConnections)
            if self.failedConnections < 3:
                QTimer.singleShot(10000, self.update_widget)
            else:
                self.failedConnections = 0
                QTimer.singleShot(100000, self.update_widget)
            #    print("No Connection to weathersurver possible delay ")

        self.update()
Esempio n. 56
0
#this stuff is worth it, you can buy me a beer or coffee in return

from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future_builtins import *

import sys
import time
from PyQt4.QtCore import (QTime, QTimer, Qt, SIGNAL)
from PyQt4.QtGui import (QApplication, QLabel)

app = QApplication(sys.argv)

try:
    due = QTime.currentTime()
    message = "Alert"
    if len(sys.argv) < 2:
        raise ValueError
    hours, mins = sys.argv[1].split(":")
    due = QTime(int(hours), int(mins))
    if not due.isValid():
        raise ValueError
    if len(sys.argv) > 2:
        message = "  ".join(sys.argv[2:])
except ValueError:
    message = "Usage: alert.py HH:MM [optional message]"  # 24hrs clock

while QTime.currentTime() < due:
    time.sleep(20)  # 20 seconds
Esempio n. 57
0
 def show_time(self):
     a = QTime.currentTime()
     a1 = QDate.currentDate()
     a2 = a1.toString('yyyy-MM-dd') + ' ' + a.toString('hh:mm:ss')
     self.Ctime.setText(QString(a2))