Skip to content

Commit 45d62c4

Browse files
committed
Application now uses boot time as first time.
This is achieved by using the uptime python library. Also removed the cutoff of seconds for the second QTimeEdit initialization value as it is not needed anymore when using rounding. Added some more metadata to setup.py
1 parent d46829d commit 45d62c4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

TardisDiff.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
from PyQt5 import QtWidgets, QtCore, QtGui
33
import ctypes
4+
from uptime import boottime
45

56

67
class TardisDiff(QtWidgets.QMainWindow):
@@ -34,10 +35,8 @@ def initUI(self):
3435
self.label_breakTime.setText("Break Time:")
3536
self.label_timeDiff.setText("Difference")
3637
self.label_timeDiffOut.setText("")
37-
self.timeEdit1.setTime(QtCore.QTime(8, 0))
38-
currentTime = QtCore.QTime.currentTime()
39-
currentTime.setHMS(currentTime.hour(), currentTime.minute(), 0)
40-
self.timeEdit2.setTime(currentTime)
38+
self.timeEdit1.setTime(self.getBootTimeAsQTime())
39+
self.timeEdit2.setTime(QtCore.QTime.currentTime())
4140

4241
#Set relations
4342
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
@@ -67,7 +66,6 @@ def initUI(self):
6766
self.timeEditBreakTime.timeChanged.connect(self.inputChanged)
6867

6968
self.setWindowTitle('TardisDiff')
70-
QtCore.QMetaObject.connectSlotsByName(self)
7169
self.inputChanged()
7270
self.show()
7371

@@ -89,6 +87,9 @@ def setClipboard(self):
8987
self.clipboard.setText(str(self.diff))
9088
self.statusBar().showMessage("Copied to clipboard.")
9189

90+
def getBootTimeAsQTime(self):
91+
return QtCore.QDateTime(boottime()).time()
92+
9293

9394
def main():
9495
app = QtWidgets.QApplication(sys.argv)

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
setup(name='TardisDiff',
3636
version='1.0.0',
3737
description='TardisDiff is a tool to output the time you worked today.',
38+
url='https://github.com/git-commit/TardisDiff',
39+
author='Maximilian Berger',
40+
41+
install_requires=[
42+
'uptime',
43+
],
3844
options=dict(build_exe=buildOptions),
3945
executables=executables
4046
)

0 commit comments

Comments
 (0)