Example #1
0
    def create(self, name_project):
        """
        
        :param name_project: Name of the project
        :return: path of the settings file
        """
        from PySide2.QtCore import QDateTime
        self.name_project = name_project
        #print("from python " + self.name_project)
        self.settings = QSettings("Nebula", self.name_project)
        
        self.settings.beginGroup("Project")
        self.settings.setValue("Path", os.path.join(os.environ['HOME'], '.config/Nebula', self.name_project + '.conf'))
        self.settings.setValue("Name", self.name_project)
        self.settings.setValue("Date", QDateTime.currentDateTime().toString())
        self.settings.setValue("LastEdit", QDateTime.currentDateTime().toString())
        self.settings.endGroup()
        
        self.settings.beginGroup("SignalFiles")
        self.settings.setValue("Path", "None")  # Paths of the signals
        self.settings.setValue("ValuePath", "None")  # Value paths of the signals -numpy file
        self.settings.endGroup()

        self.settings.beginGroup("Info")
        self.settings.endGroup()
        
        print(self.settings.fileName())
        
        return self.settings.fileName()
Example #2
0
    def __init__(self, parent=None):
        super(MyWidget, self).__init__(parent)

        self.view = View()
        self.grid = DateTimeGrid()
        self.model = QStandardItemModel()
        self.slider = QSlider()
        self.view.setGraphicsView(MyGraphicsView())

        ## proxyModel.setSourceModel( &model );
        for h in range(0, 2):
            self.model.appendRow([
                MyStandardItem("Item " + str(h)),
                MyStandardItem(KDGantt.TypeTask),
                MyStandardItem(QDateTime.currentDateTime().addDays(h),
                               KDGantt.StartTimeRole),
                MyStandardItem(QDateTime.currentDateTime().addDays(h + 1),
                               KDGantt.EndTimeRole),
                MyStandardItem(50)
            ])

        self.slider.setOrientation(Qt.Horizontal)
        self.slider.setRange(1, 10000)
        self.slider.setValue(100)
        l = QVBoxLayout(self)
        l.addWidget(self.view)
        l.addWidget(self.slider)
        self.grid.setStartDateTime(QDateTime.currentDateTime().addDays(-3))
        self.grid.setDayWidth(100)
        ## grid.setNoInformationBrush( Qt::NoBrush );
        self.view.setGrid(self.grid)
        self.view.setModel(self.model)

        self.slider.valueChanged.connect(self.slotZoom)
Example #3
0
    def widgets(self):
        self.scroll = QScrollArea()
        self.scroll.setWidgetResizable(True)

        # Top layout widgets
        self.addIssueImg = QLabel()
        self.img = QPixmap('assets/icons/create-issue.png')
        self.addIssueImg.setPixmap(self.img)
        self.addIssueImg.setAlignment(Qt.AlignCenter)
        self.titleText = QLabel("Add issue")
        self.titleText.setAlignment(Qt.AlignCenter)
        # Middle layout widgets
        self.issueInfoTitleText = QLabel("Issue info")
        self.issueInfoTitleText.setAlignment(Qt.AlignCenter)
        self.dateEntry = QDateTimeEdit()
        self.dateEntry.setDateTime(QDateTime.currentDateTime())
        self.priorityEntry = QComboBox()
        self.priorityEntry.setEditable(True)
        self.observerEntry = QComboBox()
        self.observerEntry.setEditable(True)
        self.revisionTeamEntry = QComboBox()
        self.revisionTeamEntry.setEditable(True)
        self.inspectionNameEntry = QComboBox()
        self.inspectionNameEntry.setEditable(True)
        self.observationThemeEntry = QComboBox()
        self.observationThemeEntry.setEditable(True)
        self.facilityEntry = QComboBox()
        self.facilityEntry.setEditable(True)
        self.facilitySupervisorEntry = QComboBox()
        self.facilitySupervisorEntry.setEditable(True)
        self.specificLocationEntry = QTextEdit()
        self.inspectedDepartmentEntry = QComboBox()
        self.inspectedDepartmentEntry.setEditable(True)
        self.inspectedContractorEntry = QComboBox()
        self.inspectedContractorEntry.setEditable(True)
        self.inspectedSubcontractorEntry = QComboBox()
        self.inspectedSubcontractorEntry.setEditable(True)
        self.deadlineEntry = QDateTimeEdit()
        self.deadlineEntry.setDateTime(QDateTime.currentDateTime())

        # Bottom layout widgets
        self.attachFilesBtn = QPushButton("Attach files")
        self.addActionBtn = QPushButton("Add action")

        self.rootCauseEntry = QComboBox()
        self.rootCauseEntry.setEditable(True)
        self.rootCauseDetailsEntry = QTextEdit()
        self.rootCauseActionPartyEntry = QComboBox()
        self.rootCauseActionPartyEntry.setEditable(True)
        self.addRootCauseBtn = QPushButton("Add root cause")

        self.submitObservationBtn = QPushButton("Add issue")
        self.submitObservationBtn.clicked.connect(self.addIssue)
Example #4
0
 def Timeupdate(self):  # 用于实时获取时间
     self.timer.setText(
         QDateTime.currentDateTime().toString('yyyy-MM-dd hh:mm:ss dddd'))
     current_time = QDateTime.currentDateTime().toString(
         'yyyy-MM-dd hh:mm:ss dddd')
     if (int(current_time[11]) >= 2 and int(current_time[12]) >= 3) or (int(
             current_time[11]) == 0 and int(current_time[12]) <= 4):
         if int(current_time[5]) == 0 and int(current_time[6]) == 4 and int(
                 current_time[8]) == 1 and int(
                     current_time[9]) == 7:  # 生日特殊处理
             self.greetings.setText('21岁生日快乐,' + self.username)
         else:
             self.greetings.setText('夜深了,' + self.username)
Example #5
0
    def paintEvent(self, event: QPaintEvent) -> None:
        width: int = self.width()
        height: int = self.height()
        side: int = min(width, height)

        # 绘制准备工作,启用反锯齿,平移坐标轴中心,等比例缩放
        painter: QPainter = QPainter(self)
        painter.setRenderHints(QPainter.Antialiasing
                               | QPainter.TextAntialiasing)
        painter.translate(width / 2.0, height / 2.0)
        painter.scale(side / 200.0, side / 200.0)

        # 绘制时圆弧
        n_now: QDateTime = QDateTime.currentDateTime()
        n_time: QTime = n_now.time()
        n_hour: int = n_time.hour() - 12 if n_time.hour(
        ) >= 12 else n_time.hour()
        n_min: int = n_time.minute()
        n_sec: int = n_time.second()
        n_msec: int = n_time.msec()

        n_dsec: float = n_sec + n_msec / 1000.0
        n_dmin: float = n_min + n_dsec / 60.0
        n_dhour: float = n_hour + n_dmin / 60.0

        # 绘制时圆弧
        self.drawArc(painter, 94, n_dhour * 30, self.__hourColor)
        # 绘制分圆弧
        self.drawArc(painter, 81, n_dmin * 6, self.__minuteColor)
        # 绘制秒圆弧
        self.drawArc(painter, 68, n_dsec * 6, self.__secondColor)
        # 绘制时间文本
        self.drawText(painter)
Example #6
0
    def drawText(self, painter: QPainter) -> None:
        painter.save()
        painter.setPen(Qt.NoPen)

        font: QFont = QFont()
        font.setBold(True)
        font.setPointSize(10)
        painter.setFont(font)

        now: QDateTime = QDateTime.currentDateTime()
        fm: QFontMetricsF = QFontMetricsF(font)
        textList: List[AnyStr] = [
            now.toString("MM月dd日yyyy"),
            now.toString("hh:mm:ss.zzz")
        ]

        # 绘制文本路径
        textPath: QPainterPath = QPainterPath()
        textPath.addText(-fm.width(textList[0]) / 2.0, -fm.lineSpacing() / 2.0,
                         font, textList[0])
        textPath.addText(-fm.width(textList[1]) / 2.0,
                         fm.lineSpacing() / 2.0, font, textList[1])

        strokeColor: QColor = self.__textColor.light(80)
        strokeColor.setAlphaF(0.2)
        painter.strokePath(
            textPath,
            QPen(strokeColor, self.__shadowWidth, Qt.SolidLine, Qt.RoundCap,
                 Qt.RoundJoin))
        painter.setBrush(self.__textColor)
        painter.drawPath(textPath)

        painter.restore()
Example #7
0
 def new_record(self):
     # 此时已经点了确定按钮,可以开始计时
     time = QDateTime.currentDateTime().toTime_t()
     true_paper = Record(is_practice=False, start_datetime=time)
     self.session.add(true_paper)
     self.session.commit()
     # 用真题一一对应再建一套虚拟问题
     # 查询真题对应的所有question,然后放到虚拟问题里
     questions = self.session.query(Question).filter_by(
         paper_id=self.paper_id).all()
     # print(questions)
     # 找到刚才建立的记录id
     record_id = self.session.query(Record).filter_by(finished=False)[0].id
     v_questions = []
     i = 1
     for question in questions:
         v_question = V_Question(record_id=record_id,
                                 v_num=i,
                                 question_id=question.id)
         v_questions.append(v_question)
         i += 1
     self.session.add_all(v_questions)
     self.session.commit()
     v_questions = (self.session.query(V_Question).filter_by(
         record_id=record_id).all())
     q_records = []
     q_properties = []
     for v_question in v_questions:
         q_records.append(Q_Record(v_question_id=v_question.id))
         q_properties.append(Q_Property(v_question_id=v_question.id))
     self.session.add_all(q_records)
     self.session.add_all(q_properties)
     self.session.commit()
     self.session.close()
     return record_id
Example #8
0
 def __init__(self, mainwindow):
     super(self.__class__, self).__init__()
     self.setupUi(self)
     self.setStyleSheet(qss)
     self.mainwindow = mainwindow
     self.k_thread = QThreadPool()
     # calendar
     self.start.setCalendarPopup(True)
     self.end.setCalendarPopup(True)
     self.start.setDisplayFormat('yyyy-MM-dd HH:mm:ss')
     self.end.setDisplayFormat('yyyy-MM-dd HH:mm:ss')
     now = datetime.now() - timedelta(days=30)
     self.start.setDate(QDate(now.year, now.month, now.day))
     self.end.setDateTime(QDateTime.currentDateTime())
     #
     for local_symbol in sorted(G.all_contracts):
         self.symbol_list.addItem(local_symbol + contract_space + G.all_contracts[local_symbol])  # 添加下拉框
     self.symbol_list.currentIndexChanged.connect(self.symbol_change_slot)
     self.frq.addItems(['1min', '3min', '15min', '30min', '60min'])
     # table
     self.tick_table.setRowCount(0)
     self.tick_row = len(G.order_tick_row_map)
     self.tick_table.horizontalHeader().setStretchLastSection(True)  # 最后一列自适应表格宽度
     # self.tick_table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)  # 所有列自适应表格宽度
     self.tick_table.setEditTriggers(QTableWidget.NoEditTriggers)  # 单元格不可编辑
     self.tick_table.horizontalHeader().setVisible(False)  # 水平表头不可见
     self.tick_table.verticalHeader().setVisible(False)  # 垂直表头不可见
     # btn
     self.source_btn.clicked.connect(self.source_btn_slot)
     self.hide_btn.clicked.connect(self.hide_btn_slot)
     self.reload_btn.clicked.connect(self.k_line_reload)
     self.hide_btn_slot()  # 默认隐藏
     self.mainwindow.job.kline_tick_signal.connect(self.set_tick_slot)
     self.ready_action()
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(True)
        self.bottomRightGroupBox.setChecked(True)

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 2)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        self.bottomRightGroupBox.setLayout(layout)
Example #10
0
def bracketDataSlot():
    global frameCount
    global lastFpsKey
    global customPlot
    secs = QCPAxisTickerDateTime.dateTimeToKey(QDateTime.currentDateTime())

    # update data to make phase move:
    n = 500
    phase = secs * 5
    k = 3
    x = [0.0] * n
    y = [0.0] * n
    for i in range(0, n):
        x[i] = i / (n - 1) * 34 - 17
        y[i] = math.exp(-x[i] * x[i] / 20.0) * math.sin(k * x[i] + phase)

    customPlot.graph().setData(x, y)

    itemDemoPhaseTracer.setGraphKey(
        (8 * math.pi + math.fmod(math.pi * 1.5 - phase, 6 * math.pi)) / k)

    customPlot.replot()

    # calculate frames per second:
    key = secs
    frameCount += 1

    if key - lastFpsKey > 2:  # average fps over 2 seconds
        fps = float(frameCount) / (float)(key - lastFpsKey)
        fps_str = '{:3.2f}'.format(fps)
        customPlot.setWindowTitle('Real Time Data Demo FPS: ' + fps_str)
        lastFpsKey = key
        frameCount = 0
Example #11
0
 def add_operation_time(self, operation):
     question_operation = Q_Operation(
         v_question_id=self.current_v_question_id,
         operation=operation,
         datetime=QDateTime.currentDateTime().toTime_t(),
     )
     self.session.add(question_operation)
     self.session.commit()
Example #12
0
class LatestLoadDisplay(QGraphicsItem):
    speak = Signal(list)
    """
    Simulation tab is a graphical rectangular component, that display the name, type and state of a simulation
    """

    def __init__(self, x, y, width, height, text):
        """
        A Rectangle with some text in it
        :param text: str
        :param x: float
        :param y: float
        :param height: float
        :param width: float
        """
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        self.text = text
        super(LatestLoadDisplay, self).__init__()

        # simple state array, represented as a numpy array, 0 = False, 1 = True
        # [0] = ZIPPED, [1] = SENT, [2] = SUBMITTED, [3] = FINISHED, [4] = DELIVERED
        self.state = np.zeros(5)
        print("[0] = ZIPPED, [1] = SENT, [2] = SUBMITTED, [3] = FINISHED, [4] = DELIVERED")
        print("state = ", self.state)

        self.mpen = scene_objects.initialize_qpen(QColor(49, 51, 53))  # pycharm gray
        self.qdate_time = QDateTime()

    def boundingRect(self):
        offset = 10
        return QRectF(self.x - offset, self.y - offset, self.width + 2 * offset, self.height + 2 * offset)

    @Slot(list)
    def on_update(self, data):
        time = self.qdate_time.currentDateTime().toString()
        self.text = f" Folder last time loaded : {time}"
        # print("current dateTime = ", self.qdate_time.currentDateTime().toString())
        self.update()

    def paint(self, qpainter, qstyle_option_graphics_item, widget=None):
        qpainter.setPen(self.mpen)
        qpainter.drawRect(self.x, self.y, self.width, self.height)

        # boundingRect
        # qpainter.setPen(Qt.cyan)
        # qpainter.setBrush(Qt.NoBrush)
        # qpainter.drawRect(self.boundingRect())

        # Print Label
        qrect = QRectF(self.x, self.y, self.width, self.height)
        qpainter.setPen(Qt.white)
        # qpainter.setFont(QFont("Times", 20))
        qpainter.setFont(QFont("Helvetica", 10))
        # qpainter.drawText(qrect, Qt.AlignCenter, self.text)
        qpainter.drawText(qrect, Qt.AlignLeft | Qt.AlignVCenter, self.text)
Example #13
0
    def __init__(self, parent=None):
        super(MyTaskModel, self).__init__(parent)
        self.m_tasks = []

        for i in range(0, 6, 2):
            task = self.Task()
            task.title = "Item " + str(len(self.m_tasks) + 1)
            task.start = QDateTime.currentDateTime().addDays(i)
            task.end = task.start.addDays(1)
            self.m_tasks.append(task)
Example #14
0
    def set_date(self):
        self.datef = 'yyyy/M/d h:mm:ss'
        self.start_dt.setDisplayFormat(self.datef)
        self.end_dt.setDisplayFormat(self.datef)

        # 获取当前的时间,表转换成datetime类型
        self.currentdt = QDateTime.currentDateTime().toPython()
        year = self.currentdt.year
        month = self.currentdt.month
        day = 1
        hour = 0
        minute = 0
        seccond = 0

        self.start_dt.setDateTime(QDateTime(year, month, day, hour, minute, seccond))
        self.end_dt.setDateTime(QDateTime.currentDateTime())
        # 选择日历
        self.start_dt.setCalendarPopup(True)
        self.end_dt.setCalendarPopup(True)
Example #15
0
def getTimestr(format=Qt.ISODateWithMs):
    '''
    Qt.ISODateWithMs
        '2021-02-08T11:56:15.762'
    Qt.ISODate
        '2021-02-08T11:56:15'
    '''

    now = QDateTime.currentDateTime()

    return now.toString(format)
Example #16
0
    def init(self):
        self.ui.type.addItem("Event", KDGantt.TypeEvent)
        self.ui.type.addItem("Task", KDGantt.TypeTask)
        self.ui.type.addItem("Summary", KDGantt.TypeSummary)
        self.ui.type.addItem("Multi", KDGantt.TypeMulti)

        for row in range(0, self.model.rowCount()):
            self.addDependItem(self.model, self.model.index(row, 0))

        self.ui.startDate.dateTimeChanged.connect(self.updateEndDate)
        self.ui.readOnly.toggled.connect(self.disableEditing)
        self.ui.startDate.setDateTime(QDateTime.currentDateTime())
Example #17
0
 def get_clean_group(self):  #获取值日,设置值日人员
     #获取当前星期
     weekday = QDateTime.currentDateTime().toString('dddd')
     #通过数据库查询当前星期的值日学生
     clean_group = Class_info.get_data("select %s from clean" % weekday)
     #设置学生标签
     self.main_ui.label_79.setText(clean_group[0][0])
     self.main_ui.label_80.setText(clean_group[1][0])
     self.main_ui.label_81.setText(clean_group[2][0])
     self.main_ui.label_82.setText(clean_group[3][0])
     self.main_ui.label_83.setText(clean_group[4][0])
     self.main_ui.label_84.setText(clean_group[5][0])
     self.main_ui.label_85.setText(clean_group[6][0])
Example #18
0
    def buildSqlStatement(self, query):
        callsign = self.configuration['trackedcallsign']

        if self.selectionchoices.getDateChoice() == self.RADIOBUTTON_ALL_DATES:
            if self.selectionchoices.getCategoryChoice() == self.RADIOBUTTON_NO_CATEGORY:
                sql = "select reporter as Reporter, reporter_grid as 'Rpt Grid', xmit_callsign as 'Transmitter', xmit_grid as 'Xmit Grid', " + sqlcasephrases.sql_power_case_phrase + " as Power, " + sqlcasephrases.sql_band_case_phrase + " as Band, distance as 'Distance(km)', datetime(timestamp, 'unixepoch') as 'Date/Time', signal_noise_ratio as SNR from wspr_stats where (reporter = :callsign or xmit_callsign = :callsign) order by reporter, xmit_callsign"

            if self.selectionchoices.getCategoryChoice() == self.RADIOBUTTON_BY_REPORTER_TRANSMITTER_BAND:
                sql = "select reporter as Reporter, xmit_callsign as 'Transmitter', " + sqlcasephrases.sql_band_case_phrase + " as Band, count(*) as 'Band Count' from wspr_stats where reporter = :callsign or xmit_callsign = :callsign group by reporter, xmit_callsign, band order by reporter, xmit_callsign, band"

            if self.selectionchoices.getCategoryChoice() == self.RADIOBUTTON_BY_BAND:
                sql = "select  " + sqlcasephrases.sql_band_case_phrase + " as Band, count(*) as 'Band Count' from wspr_stats where reporter = :callsign or xmit_callsign = :callsign group by band order by band"

            query.prepare(sql)
            query.bindValue(':callsign', callsign)

        if self.selectionchoices.getDateChoice() in (self.RADIOBUTTON_PREVIOUS_DAY, self.RADIOBUTTON_LAST_7_DAYS, self.RADIOBUTTON_LAST_30_DAYS, self.RADIOBUTTON_DATERANGE):
            toDateTime = QDateTime.currentDateTime().toSecsSinceEpoch()
            if self.selectionchoices.getDateChoice() == self.RADIOBUTTON_PREVIOUS_DAY:
                fromDateTime = QDateTime.currentDateTime().addDays(-1).toSecsSinceEpoch()
            elif self.selectionchoices.getDateChoice() == self.RADIOBUTTON_LAST_7_DAYS:
                fromDateTime = QDateTime.currentDateTime().addDays(-7).toSecsSinceEpoch()
            elif self.selectionchoices.getDateChoice() == self.RADIOBUTTON_LAST_30_DAYS:
                fromDateTime = QDateTime.currentDateTime().addDays(-30).toSecsSinceEpoch()
            elif self.selectionchoices.getDateChoice() == self.RADIOBUTTON_DATERANGE:
                fromDateTime = self.ui.dteFrom.dateTime().toSecsSinceEpoch()
                toDateTime = self.ui.dteTo.dateTime().toSecsSinceEpoch()

            if self.selectionchoices.getCategoryChoice() == self.RADIOBUTTON_NO_CATEGORY:
                sql = "select reporter as Reporter, reporter_grid as 'Rpt Grid', xmit_callsign as 'Transmitter', xmit_grid as 'Xmit Grid', " + sqlcasephrases.sql_power_case_phrase + " as Power, " + sqlcasephrases.sql_band_case_phrase + " as Band, distance as 'Distance(km)', datetime(timestamp, 'unixepoch') as 'Date/Time', signal_noise_ratio as SNR from wspr_stats where (reporter = :callsign or xmit_callsign = :callsign) and (timestamp between :from and :to) order by reporter, xmit_callsign"
            elif self.selectionchoices.getCategoryChoice() == self.RADIOBUTTON_BY_REPORTER_TRANSMITTER_BAND:
                sql = "select reporter as Reporter, xmit_callsign as 'Transmitter', band as Band, count(*) as 'Band Count' from wspr_stats where (reporter = :callsign or xmit_callsign = :callsign) and (timestamp between :from and :to) group by reporter, xmit_callsign, band order by reporter, xmit_callsign, band"
            elif self.selectionchoices.getCategoryChoice() == self.RADIOBUTTON_BY_BAND:
                sql = "select " + sqlcasephrases.sql_band_case_phrase + " Band, count(*) as 'Band Count' from wspr_stats where (reporter = :callsign or xmit_callsign = :callsign) and (timestamp between :from and :to) group by band order by band"

            query.prepare(sql)
            query.bindValue(':callsign', callsign)
            query.bindValue(':from', int(fromDateTime))
            query.bindValue(':to', int(toDateTime))
Example #19
0
 def start_time(cls):
     """Start or resume the timer."""
     if cls.timer is None:
         cls.timer = QTimer(cls.lcd)
         cls.timer.timeout.connect(cls.update_time)
     if cls.time is None:
         cls.time = QTime()
         cls.time.start()
         cls.timestamp = QDateTime.currentDateTime()
         cls.freeze = 0
     else:
         cls.time.restart()
     cls.timer.start()
Example #20
0
    def addDemoEntry(self):
        softwareRelease = MyStandardItem("Software Release")
        codeFreeze = MyStandardItem("Code Freeze")
        codeFreeze.setData(KDGantt.TextPositionRole,
                           StyleOptionGanttItem.Right)
        packaging = MyStandardItem("Packaging")
        upload = MyStandardItem("Upload")
        testing = MyStandardItem("Testing")
        updateDocumentation = MyStandardItem("Update Documentation")

        now = QDateTime.currentDateTime()
        softwareRelease.appendRow([
            codeFreeze,
            MyStandardItem(KDGantt.TypeEvent),
            MyStandardItem(now, KDGantt.StartTimeRole)
        ])
        softwareRelease.appendRow([
            packaging,
            MyStandardItem(KDGantt.TypeTask),
            MyStandardItem(now.addDays(5), KDGantt.StartTimeRole),
            MyStandardItem(now.addDays(10), KDGantt.EndTimeRole)
        ])
        softwareRelease.appendRow([
            upload,
            MyStandardItem(KDGantt.TypeTask),
            MyStandardItem(
                now.addDays(10).addSecs(2 * 60 * 60), KDGantt.StartTimeRole),
            MyStandardItem(now.addDays(11), KDGantt.EndTimeRole)
        ])
        softwareRelease.appendRow([
            testing,
            MyStandardItem(KDGantt.TypeTask),
            MyStandardItem(now.addSecs(3 * 60 * 60), KDGantt.StartTimeRole),
            MyStandardItem(now.addDays(5), KDGantt.EndTimeRole)
        ])
        softwareRelease.appendRow([
            updateDocumentation,
            MyStandardItem(KDGantt.TypeTask),
            MyStandardItem(now.addSecs(3 * 60 * 60), KDGantt.StartTimeRole),
            MyStandardItem(now.addDays(3), KDGantt.EndTimeRole)
        ])
        self.model.appendRow(
            [softwareRelease,
             MyStandardItem(KDGantt.TypeSummary)])
        self.addConstraintFromItem(codeFreeze, packaging)
        self.addConstraintFromItem(codeFreeze, testing)
        self.addConstraintFromItem(codeFreeze, updateDocumentation)
        self.addConstraintFromItem(packaging, upload)
        self.addConstraintFromItem(testing, packaging)
        self.addConstraintFromItem(updateDocumentation, packaging)
Example #21
0
 def add_player(self, name, killcam_screenshot):
     self.killcam_path = os.getcwd() + "\\" + uuid.uuid4().hex + ".jpg"
     killcam_screenshot.save(self.killcam_path)
     self.killcam_path = os.getcwd() + "\\" + uuid.uuid4().hex + ".png"
     killcam_screenshot.save(self.killcam_path)
     self.dateobj = QDateTime.currentDateTime()
     self.uuid = self.API_obj.get_uuid_from_username(name)
     print("this is the uid being inserted into the databse: ", self.uuid)
     self.cursor.execute(
         "INSERT INTO griefers (username, date,killcam_path, uuid) VALUES (?,?,?,?)",
         (name, self.dateobj.toString("dd.MM.yyyy"), self.killcam_path,
          self.uuid))
     self.db_new_image.emit(self.killcam_path)
     self.connection.commit()
Example #22
0
    def __init__(self, parent=None):
        super(MeterDialog, self).__init__(parent)

        layout = QtWidgets.QVBoxLayout(self)

        # nice widget for editing the date
        # self.datetime = QtWidgets.QDateTimeEdit(self)
        self.datetime = QtWidgets.QDateEdit(self)
        self.datetime.setCalendarPopup(True)
        self.datetime.setDateTime(QDateTime.currentDateTime())
        layout.addWidget(self.datetime)

        # Meter type - selector
        meterTypeLabel = QtWidgets.QLabel("Zähler")
        layout.addWidget(meterTypeLabel)
        self.meterTypeWidget = QtWidgets.QWidget(self)
        self.miniLayout = QtWidgets.QHBoxLayout(self.meterTypeWidget)
        self.meterTypeGrp = QtWidgets.QButtonGroup()
        self.electricity = QtWidgets.QCheckBox('Strom')
        self.electricity.setCheckState(Qt.CheckState.Checked)
        self.meterTypeGrp.addButton(self.electricity, 0)
        self.miniLayout.addWidget(self.electricity)
        self.gas = QtWidgets.QCheckBox('Gas')
        self.meterTypeGrp.addButton(self.gas, 1)
        self.miniLayout.addWidget(self.gas)
        self.water = QtWidgets.QCheckBox('Wasser')
        self.meterTypeGrp.addButton(self.water, 2)
        self.miniLayout.addWidget(self.water)
        layout.addWidget(self.meterTypeWidget)

        # level
        lvlLabel = QtWidgets.QLabel('Zählerstand')
        layout.addWidget(lvlLabel)
        self.lvlSpinBox = QtWidgets.QDoubleSpinBox()
        self.lvlSpinBox.setRange(0, 1000000)
        self.lvlSpinBox.setDecimals(3)
        # self.lvlSpinBox.setSuffix(' m^2')
        self.lvlSpinBox.setValue(0)
        layout.addWidget(self.lvlSpinBox)

        # OK and Cancel buttons
        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        layout.addWidget(self.buttons)

        ## SIGNALS/SLOTS ##
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
Example #23
0
    def addIssue(self):
        date = self.dateEntry.text()
        priority = self.priorityEntry.currentText()
        observer = self.observerEntry.currentText()
        revisionTeam = self.revisionTeamEntry.currentText()
        inspectionName = self.inspectionNameEntry.currentText()
        observationTheme = self.observationThemeEntry.currentText()
        facility = self.facilityEntry.currentText()
        facilitySupervisor = self.facilitySupervisorEntry.currentText()
        specificLocation = self.specificLocationEntry.toPlainText()
        inspectedDept = self.inspectedDepartmentEntry.currentText()
        inspectedContr = self.inspectedContractorEntry.currentText()
        inspectedSubcontr = self.inspectedSubcontractorEntry.currentText()
        deadline = self.deadlineEntry.text()

        if date and priority and observer and revisionTeam and inspectionName and observationTheme and facility\
                and facilitySupervisor and specificLocation and inspectedDept and inspectedContr \
                and inspectedSubcontr and deadline != "":
            try:
                query = "INSERT INTO issues (issue_date, issue_priority, issue_observer, issue_team," \
                        "issue_inspection, issue_theme, issue_facility, issue_fac_supervisor," \
                        "issue_spec_loc, issue_insp_dept, issue_insp_contr, issue_insp_subcontr, issue_deadline, created_on) " \
                        "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"

                # The purpose of this block is to make created_on timestamp the same format as other dates
                currentTime = QDateTimeEdit()
                currentTime.setDateTime(QDateTime.currentDateTime())
                now = currentTime.text()

                db.cur.execute(
                    query,
                    (date, priority, observer, revisionTeam, inspectionName,
                     observationTheme, facility, facilitySupervisor,
                     specificLocation, inspectedDept, inspectedContr,
                     inspectedSubcontr, deadline, now))
                db.conn.commit()

                QMessageBox.information(self, "Info", "Issue has been added")

                self.Parent.displayIssues()
                self.close()
            except:
                QMessageBox.information(self, "Info",
                                        "Issue has not been added")
        else:
            QMessageBox.information(self, "Info", "Fields cannot be empty")
Example #24
0
    def estimateTimeLeft(self) -> QTime():
        if len(self._processed_images) < 3:
            return None

        if self.isFinished():
            return QTime(0, 0)

        seconds_elapsed = self._start_datetime.secsTo(
            QDateTime.currentDateTime())
        nb_of_images = len(self._images_filenames)
        nb_of_processed_images = len(self._processed_images)
        seconds_left = seconds_elapsed * (
            nb_of_images - nb_of_processed_images) // nb_of_processed_images

        time = QTime(0, 0).addSecs(seconds_left)

        return time
Example #25
0
    def start_time(cls):
        """Start or resume the timer."""
        Clock.connect(on_tick=cls.update_time)
        if cls.time is None:
            cls.time = QElapsedTimer()
            cls.time.start()

            # Do not clobber timestamp when restoring from backup
            if not cls.from_backup:
                cls.timestamp = QDateTime.currentDateTime()
            else:
                # After restoring from backup, forget about it.
                # We need to be able to create new timestamps afterward.
                cls.from_backup = False
        else:
            cls.time.restart()

        cls.paused = False
Example #26
0
    def update_value_path(self, value_path):
        settings = QSettings("Nebula", self.project_name)

        settings.beginGroup("Project")
        settings.setValue("LastEdit", QDateTime.currentDateTime().toString())
        settings.endGroup()
        
        settings.beginGroup("SignalFiles")
        before_path = settings.value("ValuePath")
        before_path = before_path.split(',')
        before_path.extend(value_path)
        self.list_value_path = list(dict.fromkeys(before_path))
        if 'None' in self.list_path:
            self.list_value_path.remove('None')
        actual_path = ','.join(self.list_value_path)
        settings.setValue("ValuePath", actual_path)  # Tengo que leer primero qeu hay aqui y luego actualizar
        settings.endGroup()
        del actual_path, before_path
Example #27
0
    def testInsert(self):
        myHash = {}
        qdate = QDate.currentDate()
        qdatetime = QDateTime.currentDateTime()
        qtime = QTime.currentTime()
        qurl = QUrl("http://www.pyside.org")
        qpoint = QPoint(12, 42)

        myHash[qdate] = "QDate"
        myHash[qdatetime] = "QDateTime"
        myHash[qtime] = "QTime"
        myHash[qurl] = "QUrl"
        myHash[qpoint] = "QPoint"

        self.assertEqual(myHash[qdate], "QDate")
        self.assertEqual(myHash[qdatetime], "QDateTime")
        self.assertEqual(myHash[qtime], "QTime")
        self.assertEqual(myHash[qurl], "QUrl")
        self.assertEqual(myHash[qpoint], "QPoint")
Example #28
0
    def create_simple_inputwidgets_groupbox(self):
        result = QGroupBox("Simple Input Widgets")
        init_widget(result, "bottomRightGroupBox")
        result.setCheckable(True)
        result.setChecked(True)

        lineedit = QLineEdit("s3cRe7")
        init_widget(lineedit, "lineEdit")
        lineedit.setClearButtonEnabled(True)
        lineedit.setEchoMode(QLineEdit.Password)

        spin_box = QSpinBox()
        init_widget(spin_box, "spinBox")
        spin_box.setValue(50)

        date_timeedit = QDateTimeEdit()
        init_widget(date_timeedit, "dateTimeEdit")
        date_timeedit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider()
        init_widget(slider, "slider")
        slider.setOrientation(Qt.Horizontal)
        slider.setValue(40)

        scrollbar = QScrollBar()
        init_widget(scrollbar, "scrollBar")
        scrollbar.setOrientation(Qt.Horizontal)
        scrollbar.setValue(60)

        dial = QDial()
        init_widget(dial, "dial")
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout(result)
        layout.addWidget(lineedit, 0, 0, 1, 2)
        layout.addWidget(spin_box, 1, 0, 1, 2)
        layout.addWidget(date_timeedit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollbar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        return result
Example #29
0
    def testInsert(self):
        myHash = {}
        qdate = QDate.currentDate()
        qdatetime = QDateTime.currentDateTime()
        qtime = QTime.currentTime()
        qurl = QUrl("http://www.pyside.org")
        qpoint = QPoint(12, 42)

        myHash[qdate] = "QDate"
        myHash[qdatetime] = "QDateTime"
        myHash[qtime] = "QTime"
        myHash[qurl] = "QUrl"
        myHash[qpoint] = "QPoint"

        self.assertEqual(myHash[qdate], "QDate")
        self.assertEqual(myHash[qdatetime], "QDateTime")
        self.assertEqual(myHash[qtime], "QTime")
        self.assertEqual(myHash[qurl], "QUrl")
        self.assertEqual(myHash[qpoint], "QPoint")
Example #30
0
    def update(self):
        """This is called every second to perform the clock functions."""
        AnalogClock.update(self)

        dtime = QDateTime.currentDateTime()
        text = dtime.toString("ddd MMM dd hh:mm:ss")
        self.Digital.setText(text)

        time = dtime.time()
        if self.bedtime < time < self.bedtime.addSecs(self.bedtime_grace_period * 60):
            self.Digital.setStyleSheet("color: rgba(200,100,0,200)")
            self.Digital.setText(text + " Bedtime")

        if self.bedtime < time < self.bedtime.addSecs(1) and self.LEDBall_state > 0:
            self.set_ledball_ready_for_bed()

        if self.bedtime.addSecs(self.bedtime_grace_period*60) < time < \
                self.bedtime.addSecs(self.bedtime_grace_period*60 + 1):
            self.Digital.setStyleSheet("")
            self.set_ledball_off()
            self.turn_off_lcd()
Example #31
0
    def update_path(self, signal_name):
        settings = QSettings("Nebula", self.project_name)

        settings.beginGroup("Project")
        settings.setValue("LastEdit", QDateTime.currentDateTime().toString())
        settings.endGroup()

        settings.beginGroup("SignalFiles")
        before_list_path = settings.value("Path")
        before_list_path = before_list_path.split(',')
        print(
            f'Before list : {settings.fileName(), self.project_name, signal_name, before_list_path}'
        )
        before_list_path.extend(self.list_path)
        print(f'\033[1;36;40m Before list path: {before_list_path} \033[0m \n')
        self.list_path = list(
            dict.fromkeys(before_list_path))  # Removes the repeated path names
        if 'None' in self.list_path:
            self.list_path.remove('None')
        actual_list_path = ','.join(self.list_path)
        print(f'\033[1;36;40m After list path: {actual_list_path} \033[0m \n')
        settings.setValue("Path", actual_list_path)
        settings.endGroup()

        self.info, self.sfreq = read_info(self.list_path)
        settings.beginGroup("Info")
        settings.beginWriteArray("sfreq")
        for i in range(len(self.sfreq)):
            settings.setArrayIndex(i)
            settings.setValue("sfreq", self.sfreq[i])
        settings.endArray()
        settings.beginWriteArray("SubjectInfo")
        for i in range(len(self.info)):
            settings.setArrayIndex(i)
            for key, value in self.info[i].items():
                settings.setValue(key, str(value))
        settings.endArray()
        settings.endGroup()
        del before_list_path, actual_list_path