示例#1
0
    def loadSaveGoal(self):
        '''
        @param: None

        @return: None

        @purpose: saves the goal state information
        '''
        goalName = self.lineEdit_goal_name.text()  #gets the name
        date = self.dateTimeEdit_due_date.date()  #gets the date
        time = self.dateTimeEdit_due_date.time()  #gets the time
        dueDate = None if not self.hasDueDate else datetime(
            date.year(), date.month(), date.day(), time.hour(), time.minute(),
            time.second())  #creates a datetime object
        category = self.lineEdit_category.text()  #gets the category
        if self.radio_priority_low.isChecked():  #if low priority is checked
            priority = 3  #set priority to 3
        elif self.radio_priority_medium.isChecked(
        ):  #if medium priority is checked
            priority = 2  #set priority to 2
        else:
            priority = 1  #else, set priority to 1
        memo = self.textEdit.toPlainText()  #get the memo

        overDue = False  #sets overdue to false
        if dueDate != None:  #if duedate doesn't equal none
            if dueDate <= datetime.now(
            ):  #if duedate is less than or equal to now
                overDue = True  #overdue is true

        if goalName.strip() != "" and category.strip(
        ) != "" and not overDue:  #if valid
            self.model.editGoal(
                self.goalid, {
                    "name": goalName,
                    "category": category,
                    "priority": priority,
                    "memo": memo,
                    "dueDate": dueDate
                })  #save goal information
            self.accept()  #exit dialog
        else:
            if goalName.strip() == "":  #if goal is empty
                self.lineEdit_goal_name.setStyleSheet(
                    "border: 1px solid red;")  #highlight in red
            else:
                self.lineEdit_goal_name.setStyleSheet(
                    "border: none;")  #else reset
            if category.strip() == "":  #if category is empty
                self.lineEdit_category.setStyleSheet(
                    "border: 1px solid red;")  #highlight in red
            else:
                self.lineEdit_category.setStyleSheet(
                    "border: none")  #else, reset
            if overDue:  #if it is overdue
                self.dateTimeEdit_due_date.setStyleSheet(
                    "border: 1px solid red;")  #highlight in red
            else:
                self.dateTimeEdit_due_date.setStyleSheet(
                    "border: none")  #else, reset
示例#2
0
    def setDueDateText(self):
        '''
        @param: None

        @return: None

        @purpose: sets the status of the goal as a notification depending on status
        '''
        date = self.dateTimeEdit_due_date.date()  #gets the date
        time = self.dateTimeEdit_due_date.time()  #gets the time
        dueDate = datetime(date.year(), date.month(), date.day(), time.hour(),
                           time.minute(),
                           time.second())  #creates datetime object
        if not self.hasDueDate:  #if doesn't have due date
            self.label_goal_name_4.setText(
                "No Due Date")  #set status as no due date
            self.dateTimeEdit_due_date.setDisabled(True)  #disable date editor
        elif dueDate > datetime.now():  #if not overdue
            self.label_goal_name_4.setText(
                str((dueDate - datetime.now()).days) +
                " Days Until Due")  #tell how many days till due
            self.dateTimeEdit_due_date.setDisabled(False)  #enable date editor
        else:
            self.label_goal_name_4.setText(
                "Overdue")  #else, set status as ovedue
            self.dateTimeEdit_due_date.setDisabled(False)  #enable date editor
示例#3
0
 def add_clicked(self):
     temp = self.r_temp_spinbox.value()
     time = self.r_period_time.time()
     minute = time.minute()
     hour = time.hour()
     
     self.add_routine(temp, minute, hour)
    def label(self, v):
        msecs = int(v/1000)
        dt = QDateTime().fromTime_t(msecs);
        time = dt.time()

        res = QwtText("%02i:%02i"%(time.minute(), time.second()))
        res.setFont(self.font)

        return res
示例#5
0
    def _insert_point(self):
        """ Asks the user to insert a new point """
        dialog = PointDialog(self)
        if dialog.exec_():
            time, val = dialog.get_value()
            minutes = (time.hour() * 60 + time.minute()) / (24 * 60)

            if val < self._selected_setting_handle.minvalue or val > self._selected_setting_handle.maxvalue:
                QtGui.QMessageBox.information(self, "Invalid Value", "Value is out of setting range!", QtGui.QMessageBox.Ok)
                return

            val_linear = self._selected_setting_handle.get_linear_value(val)
            self._selected_setting_handle.curves[0].append_cv(minutes, val_linear)
            self._cmd_queue.add("write_settings")
示例#6
0
    def _insert_point(self):
        """ Asks the user to insert a new point """
        dialog = PointDialog(self)
        if dialog.exec_():
            time, val = dialog.get_value()
            minutes = (time.hour() * 60 + time.minute()) / (24 * 60)

            if val < self._selected_setting_handle.minvalue or val > self._selected_setting_handle.maxvalue:
                QtGui.QMessageBox.information(self, "Invalid Value", "Value is out of setting range!", QtGui.QMessageBox.Ok)
                return

            val_linear = self._selected_setting_handle.get_linear_value(val)
            self._selected_setting_handle.curves[0].append_cv(minutes, val_linear)
            self._cmd_queue.add("write_settings")
示例#7
0
    def setTime(self, rootWidget):
        self.info.updateAndShow(_("Adjusting time settings"))
        date = rootWidget.calendarWidget.date()
        time = rootWidget.timeEdit.time()
        args = "%02d%02d%02d%02d%04d.%02d" % (date.month(), date.day(),
                                              time.hour(), time.minute(),
                                              date.year(), time.second())

        # Set current date and time
        ctx.logger.debug("Date/Time setting to %s" % args)
        yali.util.run_batch("date", args)

        # Sync date time with hardware
        ctx.logger.debug("YALI's time is syncing with the system.")
        yali.util.run_batch("hwclock", ["--systohc"])
        self.info.hide()
示例#8
0
 def faire_entretien(self):
     date = self.calendar_entretien.selectedDate()
     time = self.time_entretien.time()
     temp = datetime.datetime(date.year(), date.month(), date.day(), time.hour(), time.minute(), 0, 0).timestamp()
     num = self.numeroticket_entretien.text()
     try:
         entr = self.parking_controller.creer_entretien(temp, int(num)) 
         if entr:
             QtGui.QMessageBox.question(self, "Creation d'entretien",
             "L'entretien a bien ete cree", QtGui.QMessageBox.Ok)
         else :
             if entr is None : 
                 QtGui.QMessageBox.question(self, "Création d'une livraison",
                 "Vous ne pouvez bénéficier de ce service car vous n'etes pas dans le parking", QtGui.QMessageBox.Ok)
             else :
                 QtGui.QMessageBox.question(self, "Création d'une livraison",
                 "Vous ne pouvez bénéficier de ce service car vous n'etes pas abonne", QtGui.QMessageBox.Ok)
     except ValueError: reply = QtGui.QMessageBox.question(self, 'Message',"Numero de ticket invalide", QtGui.QMessageBox.Ok)
示例#9
0
    def day_night(self):

        time = QTime.currentTime()
        self.last_day = self.day
        if time.hour() > 20 or time.hour() < 6:
            if time.minute() > 30:
                self.day = False

        else:
            self.day = True

        if self.day != self.last_day:
            self.changed_b = False
            # print("self.changed_b " + self.changed_b)
        if not dev:
            if not self.changed_b and not self.day:  #night
                shell("gpio -g pwm 18 " + str(45))
                self.changed_b = True
                self.timer_dates.stop()
                self.timer_weather.stop()

            if self.day and not self.changed_b:  #day
                shell("gpio -g pwm 18 " + str(500))
                self.timer_odw = QTimer()
                self.timer_odw.setSingleShot(True)
                self.timer_odw.timeout.connect(self.show_curent_weather)
                self.timer_odw.start(1000 * self.settings["clock_timer"])
                self.changed_b = True

                self.timer_weather = QTimer()
                self.timer_weather.timeout.connect(self.weather.run)
                self.timer_weather.start(1000 * 60 * 15)

                self.timer_dates = QTimer()
                self.timer_dates.timeout.connect(self.chenge_dates)
                self.timer_dates.start(1000 * 5)
示例#10
0
 def find(self):
     data = self.dateTimeEdit.date()
     d = QDate(2019, 3, 4)
     day = d.daysTo(data)
     time = self.dateTimeEdit.time()
     hour = time.hour()
     minute = time.minute()
     row = self.listWidget.currentRow()
     fname = '..\ReadingRoom/' + self.listWidget.item(row).text().strip(
         '\n') + '.txt'
     fobj = open(fname, 'r')
     name = fobj.readline()
     while name != "":
         line = name.strip('\n')
         line = line.split(" ")
         num = 0
         for i in line[0]:
             num = num * 10 + int(i)
         zhuanye = line[2]
         if zhuanye != "空":
             scope = model[zhuanye]
             if day / 7 >= 18:
                 newItem = QTableWidgetItem("放假")
                 newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
                 self.tableWidget.setItem(num / 10, num % 10, newItem)
             else:
                 if day % 7 > 4:  #周六日
                     newItem = QTableWidgetItem("占用")  # 查询的时间
                     newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                     self.tableWidget.setItem(num / 10, num % 10, newItem)
                 else:
                     if time < t1:
                         newItem = QTableWidgetItem("占用")  # 查询的时间
                         newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                         self.tableWidget.setItem(num / 10, num % 10,
                                                  newItem)
                     elif time > t1 and time < t2:
                         col = day % 7 * 5 + 0
                         if scope[int(day / 7)][col] == 1:
                             t = 100 - (hour - 8) * 60 - minute
                             newItem = QTableWidgetItem(
                                 '空闲' + str(t) + '分钟')  # 查询的时间
                             newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                         else:
                             newItem = QTableWidgetItem("占用")  # 查询的时间
                             newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                     elif time > t3 and time < t4:
                         col = day % 7 * 5 + 1
                         if scope[int(day / 7)][col] == 1:
                             t = 100 - (hour - 10) * 60 - minute
                             newItem = QTableWidgetItem(
                                 '空闲' + str(t) + '分钟')  # 查询的时间
                             newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                         else:
                             newItem = QTableWidgetItem("占用")  # 查询的时间
                             newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                     elif time > t5 and time < t6:
                         col = day % 7 * 5 + 2
                         if scope[int(day / 7)][col] == 1:
                             t = 130 - (hour - 13) * 60 - minute
                             newItem = QTableWidgetItem(
                                 '空闲' + str(t) + '分钟')  # 查询的时间
                             newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                         else:
                             newItem = QTableWidgetItem("占用")  # 查询的时间
                             newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                     elif time > t7 and time < t8:
                         col = day % 7 * 5 + 3
                         if scope[int(day / 7)][col] == 1:
                             t = 130 - (hour - 15) * 60 - minute
                             newItem = QTableWidgetItem(
                                 '空闲' + str(t) + '分钟')  # 查询的时间
                             newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                         else:
                             newItem = QTableWidgetItem("占用")  # 查询的时间
                             newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                     elif time > t9 and time < t10:
                         col = day % 7 * 5 + 4
                         if scope[int(day / 7)][col] == 1:
                             t = 180 - (hour - 18) * 60 - minute
                             newItem = QTableWidgetItem(
                                 '空闲' + str(t) + '分钟')  # 查询的时间
                             newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                         else:
                             newItem = QTableWidgetItem("占用")  # 查询的时间
                             newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                             self.tableWidget.setItem(
                                 num / 10, num % 10, newItem)
                     else:
                         newItem = QTableWidgetItem("占用")  # 查询的时间
                         # newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
                         newItem.setBackground(QtCore.Qt.red)  # 非空闲显示红色
                         self.tableWidget.setItem(num / 10, num % 10,
                                                  newItem)
         else:
             newItem = QTableWidgetItem("未分配")
             newItem.setBackground(QtCore.Qt.gray)  # 空闲灰色
             self.tableWidget.setItem(num / 10, num % 10, newItem)
         name = fobj.readline()
    def load_knmi(self):
        # KNMI
        # http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?SERVICE=WMS&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=RADNL_OPER_R___25PCPRR_L3_COLOR&WIDTH=886&HEIGHT=603&CRS=EPSG%3A3857&BBOX=-725.7203842048766,6434348.070664023,1220725.7203842048,7265651.929335977&STYLES=default&FORMAT=image/png&TRANSPARENT=TRUE&time=2016-06-15T08%3A30%3A00Z
        # http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?TIME=2016-06-14T09:25:02Z/2016-06-14T10:25:02Z&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=41607.58263816371618,373175.3892402839847,308340.3808564461069,650052.614857714274&CRS=EPSG:28992&WIDTH=1451&HEIGHT=1507&LAYERS=RADNL_OPER_R___25PCPRR_L3_COLOR&STYLES=&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE

        # http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?SERVICE=WMS&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=RADNL_OPER_R___25PCPRR_L3_COLOR&WIDTH=886&HEIGHT=603&CRS=EPSG%3A3857&BBOX=-725.7203842048766,6434348.070664023,1220725.7203842048,7265651.929335977&STYLES=default&FORMAT=image/png&TRANSPARENT=TRUE
        # Timestart en end
        # 2016-06-13T18:00:00Z
        # 2016-06-15T18:00:00Z

        if not 'timemanager' in plugins:
            self.iface.messageBar().pushWarning ("Warning!!", "No TimeManger plugin, we REALLY need that. Please install via Plugin Manager first...")
            return

        # development: remove the knmi layer from mapcanvas
        for l in QgsMapLayerRegistry.instance().mapLayersByName("knmi"):
            QgsMapLayerRegistry.instance().removeMapLayer(l)

        tm = plugins['timemanager']

        # TODO try catch this
        from timemanager.layer_settings import LayerSettings
        from timemanager.raster.wmstlayer import WMSTRasterLayer
        #from timemanager.tmlogging import info

        #TODO click on button if not enabled
        if not tm.getController().getTimeLayerManager().isEnabled():
            tm.getController().getGui().dock.pushButtonToggleTime.click()

        # for testing: just remove all timelayers
        tm.getController().timeLayerManager.clearTimeLayerList()

        # DEZE WERKT NIET !!!!  (?? zelfde probleem als eerder??)
        url = "http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?SERVICE=WMS"
        # DEZE WERKT WEL !!!!
        url = "http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi"
        layers = "RADNL_OPER_R___25PCPRR_L3_COLOR"
        styles = ""
        imgformat = "image/png"
        crs = "EPSG:28992"

        # IgnoreGetMapUrl=1&contextualWMSLegend=0&crs=EPSG:28992&dpiMode=7&featureCount=10&format=image/png&layers=RADNL_OPER_R___25PCPRR_L3_COLOR&styles=&url=http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?

        uri = "crs=" + crs + "&layers=" + layers + "&styles=" + styles + "&format=" + imgformat + "&url=" + url;
        layer = self.iface.addRasterLayer(uri, "knmi", "wms")

        settings = LayerSettings()

        # endTimeAttribute !!! NOT toTimeAttribute
        #settings.startTimeAttribute = unicode("2016-06-13T18:00:00Z")
        #settings.endTimeAttribute = unicode("2016-06-15T18:00:00Z")
        DEFAULT_DATE_FORMAT = 'yyyy-MM-ddTHH:mm:ssZ'
        end = QDateTime.currentDateTime().toUTC() # now in UTC
        # prefer 05:00
        time = end.time()
        minute = time.minute()
        time.setHMS(time.hour(), minute-minute%5, 0, 0)
        end.setTime(time)
        settings.endTimeAttribute = end.toString(DEFAULT_DATE_FORMAT)
        start = end.addSecs(-2*60*60).toString(DEFAULT_DATE_FORMAT)
        settings.startTimeAttribute = start
        # NOK
        # http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?TIME=2016-07-05T13:45:00Z/2016-07-05T13:50:00Z&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-145108.7003207547241,299063.8299999999581,436757.3003207547008,626788.5699999999488&CRS=EPSG:28992&WIDTH=941&HEIGHT=530&LAYERS=RADNL_OPER_R___25PCPRR_L3_COLOR&STYLES=&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE

        # OK
        # http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?TIME=2016-06-13T18:05:00Z/2016-06-13T18:10:00Z&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-145108.7003207547241,299063.8299999999581,436757.3003207547008,626788.5699999999488&CRS=EPSG:28992&WIDTH=941&HEIGHT=530&LAYERS=RADNL_OPER_R___25PCPRR_L3_COLOR&STYLES=&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE
        #settings.startTimeAttribute = unicode("2016-06-13T18:00:00Z")
        #settings.endTimeAttribute = unicode("2016-06-15T18:00:00Z")

        settings.layer = layer

        timelayer = WMSTRasterLayer(settings, self.iface)

        # ??
        # iface.mapCanvas().mapCanvasRefreshed.disconnect(tm.getController().waitAfterRenderComplete)
        # iface.mapCanvas().mapCanvasRefreshed.connect(tm.getController().waitAfterRenderComplete)

        # print timelayer
        # print timelayer.getTimeExtents()

        # tm.getController().refreshGuiTimeExtents([
        #    QtCore.QDateTime.fromString("2016-06-13T18:00:00Z", 'yyyy-MM-ddTHH:mm:ssZ'),
        #    QtCore.QDateTime.fromString("2016-06-15T18:00:00Z", 'yyyy-MM-ddTHH:mm:ssZ')])

        animationFrameLength = 2000
        frame_type = 'minutes'
        frame_size = 5
        tm.getController().setPropagateGuiChanges(False)
        tm.getController().setAnimationOptions(animationFrameLength, False, False)

        tm.getController().timeLayerManager.registerTimeLayer(timelayer)

        tm.getController().getGui().setTimeFrameType(frame_type)
        tm.getController().getGui().setTimeFrameSize(frame_size)

        # set layer to zero
        tm.getController().getGui().dock.horizontalTimeSlider.setValue(0)

        # tm.getController().timeLayerManager.refreshTimeRestrictions()

        # tm.getController().getGui().dock.pushButtonPlay.click()

        # plugins['timemanager'].getController().getGui().dock.pushButtonPlay.click()

        QTimer.singleShot(5000, tm.getController().getGui().dock.pushButtonPlay.click)
示例#12
0
    def paintEvent(self, event):

        global MSG

        if self._tip:
            QToolTip.showText(self.mapToGlobal(self._tip), self.digitTime(),
                              self)

        if self._tb:
            self._tb.setText(self.digitTime())

        side = min(self.width(), self.height())
        time = QTime.currentTime()

        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.translate(self.width() / 2, self.height() / 2)
        painter.scale(side / 200.0, side / 200.0)

        painter.setPen(Qt.NoPen)
        painter.setBrush(AnalogClock.hourColor)

        painter.save()
        painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)))
        painter.drawConvexPolygon(AnalogClock.hourHand)
        painter.restore()

        painter.setPen(AnalogClock.hourColor)

        for i in range(12):
            painter.drawLine(88, 0, 96, 0)
            painter.rotate(30.0)

        painter.setPen(Qt.NoPen)
        painter.setBrush(AnalogClock.minuteColor)

        painter.save()
        painter.rotate(6.0 * (time.minute() + time.second() / 60.0))
        painter.drawConvexPolygon(AnalogClock.minuteHand)
        painter.restore()

        painter.setPen(AnalogClock.minuteColor)

        for j in range(60):
            if (j % 5) != 0:
                painter.drawLine(92, 0, 96, 0)
            painter.rotate(6.0)

        painter.setPen(Qt.NoPen)
        painter.setBrush(AnalogClock.secondColor)

        painter.save()
        painter.rotate(6.0 * time.second())
        painter.drawConvexPolygon(AnalogClock.secondHand)
        painter.restore()

        painter.setPen(AnalogClock.secondColor)

        for j in range(60):
            if (j % 5) != 0:
                painter.drawLine(92, 0, 96, 0)
            painter.rotate(6.0)
示例#13
0
 def setStartQueryTime(self):
     time = self.startQueryTime.time()
     self.ctr.setStartQueryTime(str(time.hour()) + ':' + str(time.minute()) + ':' + str(time.second()))
示例#14
0
 def setStartQueryTime(self):
     time = self.startQueryTime.time()
     self.ctr.setStartQueryTime(str(time.hour()) + ":" + str(time.minute()) + ":" + str(time.second()))
示例#15
0
    def review_goto(self, time):
        from actionFactor import ActionFactor
        SignalFactor().sign_review_goto_init.emit()

        if self.review_timer is None or self.review_timer.isActive() == False:
            ActionFactor().reveiwrun.trigger()

        is_suspend = False
        if ActionFactor().reveiwsuspend.isChecked() == False:
            ActionFactor().reveiwsuspend.trigger()
            is_suspend = True

        start_time = self.review_tick['Date_Time'][0]
        tick_idx = -1
        tick = None

        check_time = pd.Timestamp(year=start_time.year,
                                  month=start_time.month,
                                  day=start_time.day,
                                  hour=time.hour(),
                                  minute=time.minute(),
                                  second=time.second())
        df = self.review_tick[self.review_tick['Date_Time'] < check_time]

        count = df.shape[0]
        progress = QtWidgets.QProgressDialog("Progress...", "Cancel", 0, count)
        progress.setWindowModality(QtCore.Qt.WindowModal)
        progress.setCancelButton(None)
        progress.setWindowFlags(QtCore.Qt.Dialog
                                | QtCore.Qt.FramelessWindowHint
                                | QtCore.Qt.WindowTitleHint)
        progress.forceShow()

        start_idx = 0
        start_time = self.review_tick.iat[start_idx, 5]
        for i in range(0, count):
            tick_idx = tick_idx + 1
            progress.setValue(tick_idx)
            now_time = self.review_tick.iat[tick_idx, 5]

            if now_time - start_time >= pd.Timedelta(
                    seconds=SettingFactor().KBarInterval):
                open = self.review_tick.iat[start_idx, 2]
                close = self.review_tick.iat[tick_idx, 0]
                ary = [
                    self.review_tick.iat[i, 0]
                    for i in range(start_idx, tick_idx)
                ]
                high = max(ary)
                low = min(ary)
                tick = SimpleNamespace(Date_Time=start_time,
                                       Close=close,
                                       High=high,
                                       Low=low,
                                       Open=open)
                SignalFactor().sign_tick_update.emit(tick)
                start_idx = tick_idx
                start_time = self.review_tick.iat[tick_idx, 5]

        open = self.review_tick.iat[start_idx, 2]
        close = self.review_tick.iat[tick_idx - 1, 0]
        ary = [self.review_tick.iat[i, 0] for i in range(start_idx, tick_idx)]
        high = max(ary)
        low = min(ary)
        tick = SimpleNamespace(Date_Time=start_time,
                               Close=close,
                               High=high,
                               Low=low,
                               Open=open)
        SignalFactor().sign_tick_update.emit(tick)
        self.review_tick_idx = tick_idx
        self.curr_time = self.review_tick.iat[tick_idx, 5]
        delta = datetime.timedelta(seconds=1)
        self.next_time = self.curr_time + delta

        SignalFactor().sign_review_goto_done.emit()

        if is_suspend == True:
            ActionFactor().reveiwsuspend.trigger()
示例#16
0
 def set_timer(self):
     if self.timekeeper_w.timekeeper.connected:
         return
     time = self.ui.timeEdit.time()
     self.scoreboard.time.set(ui_label=self.ui.time_label, minutes=time.minute(), seconds=time.second())