Skip to content
Snippets Groups Projects
Commit d8691b91 authored by inso's avatar inso
Browse files

Show current local time

parent ba41bdf2
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ from ..gen_resources.about_uic import Ui_AboutPopup ...@@ -8,7 +8,7 @@ from ..gen_resources.about_uic import Ui_AboutPopup
from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, \ from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, \
QMessageBox, QLabel, QComboBox, QDialog, QApplication QMessageBox, QLabel, QComboBox, QDialog, QApplication
from PyQt5.QtCore import QSignalMapper, QObject, \ from PyQt5.QtCore import QSignalMapper, QObject, QLocale, \
pyqtSlot, pyqtSignal, QDate, QDateTime, QTimer, QUrl, Qt, QCoreApplication pyqtSlot, pyqtSignal, QDate, QDateTime, QTimer, QUrl, Qt, QCoreApplication
from PyQt5.QtGui import QIcon, QDesktopServices from PyQt5.QtGui import QIcon, QDesktopServices
...@@ -101,14 +101,15 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -101,14 +101,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
@pyqtSlot() @pyqtSlot()
def update_time(self): def update_time(self):
date = QDate.currentDate() dateTime = QDateTime.currentDateTime()
self.label_time.setText("{0}".format(date.toString("dd/MM/yyyy"))) self.label_time.setText("{0}".format(QLocale.toString(
next_day = date.addDays(1) QLocale(),
current_time = QDateTime().currentDateTime().toMSecsSinceEpoch() QDateTime.currentDateTime(),
next_time = QDateTime(next_day).toMSecsSinceEpoch() QLocale.dateTimeFormat(QLocale(), QLocale.NarrowFormat)
)))
timer = QTimer() timer = QTimer()
timer.timeout.connect(self.update_time) timer.timeout.connect(self.update_time)
timer.start(next_time - current_time) timer.start(1000)
@pyqtSlot() @pyqtSlot()
def delete_contact(self): def delete_contact(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment