diff --git a/assets/CHECK_INTERNET_CONNECTION.png b/assets/CHECK_INTERNET_CONNECTION.png deleted file mode 100644 index 55823d9..0000000 Binary files a/assets/CHECK_INTERNET_CONNECTION.png and /dev/null differ diff --git a/assets/DAY_SEPARATOR.png b/assets/DAY_SEPARATOR.png deleted file mode 100644 index 6cc79b0..0000000 Binary files a/assets/DAY_SEPARATOR.png and /dev/null differ diff --git a/assets/DURING_PHONE_CALL.png b/assets/DURING_PHONE_CALL.png deleted file mode 100644 index ae7afc0..0000000 Binary files a/assets/DURING_PHONE_CALL.png and /dev/null differ diff --git a/assets/DURING_PHONE_CALL_CENTERED.png b/assets/DURING_PHONE_CALL_CENTERED.png deleted file mode 100644 index 826561c..0000000 Binary files a/assets/DURING_PHONE_CALL_CENTERED.png and /dev/null differ diff --git a/assets/GENERIC_SMS.png b/assets/GENERIC_SMS.png deleted file mode 100644 index 6191b9d..0000000 Binary files a/assets/GENERIC_SMS.png and /dev/null differ diff --git a/assets/NO_EVENTS.png b/assets/NO_EVENTS.png deleted file mode 100644 index f189087..0000000 Binary files a/assets/NO_EVENTS.png and /dev/null differ diff --git a/assets/RESULT_DELETED.png b/assets/RESULT_DELETED.png deleted file mode 100644 index 30e98f4..0000000 Binary files a/assets/RESULT_DELETED.png and /dev/null differ diff --git a/assets/RESULT_DISMISSED.png b/assets/RESULT_DISMISSED.png index c853503..35d0977 100644 Binary files a/assets/RESULT_DISMISSED.png and b/assets/RESULT_DISMISSED.png differ diff --git a/assets/RESULT_MUTE.png b/assets/RESULT_MUTE.png deleted file mode 100644 index f6073d3..0000000 Binary files a/assets/RESULT_MUTE.png and /dev/null differ diff --git a/assets/RESULT_SENT.png b/assets/RESULT_SENT.png deleted file mode 100644 index 4266de5..0000000 Binary files a/assets/RESULT_SENT.png and /dev/null differ diff --git a/assets/WATCH_DISCONNECTED.png b/assets/WATCH_DISCONNECTED.png deleted file mode 100644 index 7f25a1a..0000000 Binary files a/assets/WATCH_DISCONNECTED.png and /dev/null differ diff --git a/functions.py b/functions.py index 2bd0fb0..4d7f1bd 100644 --- a/functions.py +++ b/functions.py @@ -20,10 +20,10 @@ def randomString(stringLength=20): # Populate the fields inside the JSON and send it to the server -def sendToTimeline(title, subtitle, body, time, icon): +def sendToTimeline(title, subtitle, body, time, icon, duration=-1): # Uncomment if feature is implemented - Pin editing # if pinID == "": - pinID = randomString() + pinID = "RMPC-" + randomString() # Uncomment if feature is implemented - Pin editing # else : pinID = oldPin @@ -34,18 +34,22 @@ def sendToTimeline(title, subtitle, body, time, icon): 'X-User-Token': token} # This variable will become a JSON string, ready to be sent to the servers # the "time" field is built like this since it gives the local time with timezone 0 (instead of +01:00 or similar - data = { - "id": pinID, - "time": str(time.date().year()) + "-" + leadingZero(time.date().month()) + "-" + leadingZero( - time.date().day()) + "T" + leadingZero(time.time().hour()) + ":" + leadingZero(time.time().minute()) + ":00Z", - "layout": { - "type": "genericPin", - "title": title, - "subtitle": subtitle, - "body": body, - "tinyIcon": "system://images/" + icon - } - } + data = {} + data["id"] = pinID + data["time"] = str(time.date().year()) + "-" + leadingZero(time.date().month()) + "-" + leadingZero( + time.date().day()) + "T" + leadingZero(time.time().hour()) + ":" + leadingZero(time.time().minute()) + ":00Z" + layout = {} + if duration != -1: + data["duration"] = duration + layout["type"] = "calendarPin" + else: + layout["type"] = "genericPin" + layout["title"] = title + layout["subtitle"] = subtitle + layout["body"] = body + layout["tinyIcon"] = "system://images/" + icon + + data["layout"] = layout response = requests.put(url, data=json.dumps(data), headers=header) if response.status_code == 200: alert = QMessageBox() @@ -57,11 +61,23 @@ def sendToTimeline(title, subtitle, body, time, icon): print(response) alert = QMessageBox() alert.setWindowTitle('Rebble Memos') - alert.setText('Something went wrong, Try again. \n Error code:' + str(response.status_code)) + reason = "" + if response.status_code == 400: + reason = "INVALID_JSON" + elif response.status_code == 403: + reason = "INVALID_API_KEY" + elif response.status_code == 410: + reason = "INVALID_USER_TOKEN" + elif response.status_code == 429: + reason = "RATE_LIMIT_EXCEEDED" + elif response.status_code == 500: + reason = "SERVICE_UNAVAILABLE" + alert.setText('Something went wrong, Try again. \n Error: ' + reason) alert.exec_() + # Since I didn't find anything about adding a leading zero via library functions/parameters I've made a quick number -#to String converted where needed (Hours, Minutes, Days, Months) +# to String converted where needed (Hours, Minutes, Days, Months) def leadingZero(number): if 0 <= number <= 9: return "0" + str(number) @@ -72,25 +88,28 @@ def leadingZero(number): # If you need to test your pin data without bothering the servers you can substitute sendToTimeline() inside memos.py with # test(), so whe you click on the "Send to Timeline" button a dialog box will appear with the data submitted # This function will also generate a JSON string in the terminal, so you can test the pin on an emulator -def test(title, subtitle, body, time, icon): - data2 = { - "id": "pinID", - "time": "" + str(time.date().year()) + "-" + leadingZero(time.date().month()) + "-" + leadingZero( - time.date().day()) + "T" + leadingZero(time.time().hour()) + ":" + leadingZero( - time.time().minute()) + ":00Z", - "layout": { - "type": "genericPin", - "title": title, - "subtitle": subtitle, - "body": body, - "tinyIcon": "system://images/" + icon - } - } +def test(title, subtitle, body, time, icon, duration=-1): + data2 = {} + data2["id"] = pinID + data2["time"] = "" + str(time.date().year()) + "-" + leadingZero(time.date().month()) + "-" + leadingZero( + time.date().day()) + "T" + leadingZero(time.time().hour()) + ":" + leadingZero(time.time().minute()) + ":00Z" + layout = {} + if duration != -1: + data2["duration"] = duration + layout["type"] = "calendarPin" + else: + layout["type"] = "genericPin" + layout["title"] = title + layout["subtitle"] = subtitle + layout["body"] = body + layout["tinyIcon"] = "system://images/" + icon + + data2["layout"] = layout print(json.dumps(data2)) alert = QMessageBox() alert.setWindowTitle('Rebble Memos') alert.setText("Title: " + title + "\nSubtitle: " + subtitle + "\nBody: " + body + "\nTime/Date: " + str( time.date().year()) + "-" + leadingZero(time.date().month()) + "-" + leadingZero( time.date().day()) + "T" + leadingZero(time.time().hour()) + ":" + leadingZero( - time.time().minute()) + ":00Z" + "\nIcon: " + icon) + time.time().minute()) + ":00Z" + "\nIcon: " + icon + "\nDuration: " + str(duration)) alert.exec_() diff --git a/interface.ui b/interface.ui index 4d0ee12..4870411 100644 --- a/interface.ui +++ b/interface.ui @@ -1,307 +1,1027 @@ - - - MainWindow - - - - 0 - 0 - 679 - 465 - - - - - 8 - 50 - false - - - - Rebble Memos - - - - memo.icomemo.ico - - - - - - 160 - 380 - 111 - 31 - - - - Send to Timeline! - - - - - - 10 - 30 - 91 - 21 - - - - - 8 - 75 - true - - - - Memo Title - - - Qt::AlignCenter - - - - - - 110 - 30 - 321 - 20 - - - - - - - 440 - 30 - 20 - 381 - - - - Qt::Vertical - - - - - - 10 - 50 - 101 - 41 - - - - - 8 - 75 - true - - - - Memo Subtitle (optional) - - - Qt::AlignCenter - - - true - - - - - - 110 - 60 - 321 - 51 - - - - - - - 10 - 120 - 91 - 31 - - - - - 8 - 75 - true - - - - Memo Body (optional) - - - Qt::AlignCenter - - - true - - - - - - 110 - 120 - 321 - 61 - - - - - - - 20 - 240 - 81 - 20 - - - - - 8 - 75 - true - - - - Memo Time - - - Qt::AlignCenter - - - - - - 110 - 240 - 321 - 22 - - - - true - - - Qt::OffsetFromUTC - - - - - - 450 - 149 - 221 - 101 - - - - - 25 - 50 - false - - - - Pin History -Coming Soon - - - Qt::AlignCenter - - - - - - 20 - 290 - 71 - 20 - - - - - 75 - true - - - - Memo Icon - - - Qt::AlignCenter - - - - - - 110 - 280 - 321 - 51 - - - - - - - true - - - - - - - - 25 - 25 - - - - - - - assets/NOTIFICATION_REMINDER.png - - - - - - - - - 450 - 244 - 221 - 40 - - - - - 10 - - - - You'll be able to modify already sent memos directly from here! - - - Qt::AlignCenter - - - true - - - - - - - + + + MainWindow + + + + 0 + 0 + 679 + 521 + + + + + 8 + 50 + false + + + + Rebble Memos + + + + memo.icomemo.ico + + + + + + 180 + 440 + 111 + 31 + + + + Send to Timeline! + + + + + + 440 + 30 + 20 + 441 + + + + Qt::Vertical + + + + + + 450 + 149 + 221 + 101 + + + + + 25 + 50 + false + + + + Pin History +Coming Soon + + + Qt::AlignCenter + + + + + + 450 + 244 + 221 + 40 + + + + + 10 + + + + You'll be able to modify already sent memos directly from here! + + + Qt::AlignCenter + + + true + + + + + + 20 + 10 + 421 + 421 + + + + + + + + + 0 + 0 + 0 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 120 + 120 + 120 + + + + + + + 160 + 160 + 160 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 247 + 247 + 247 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 120 + 120 + 120 + + + + + + + 160 + 160 + 160 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 247 + 247 + 247 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 120 + 120 + 120 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 120 + 120 + 120 + + + + + + + 160 + 160 + 160 + + + + + + + 120 + 120 + 120 + + + + + + + 255 + 255 + 255 + + + + + + + 120 + 120 + 120 + + + + + + + 240 + 240 + 240 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + true + + + QTabWidget::North + + + QTabWidget::Rounded + + + 0 + + + true + + + true + + + + + assets/NOTIFICATION_REMINDER.pngassets/NOTIFICATION_REMINDER.png + + + Generic Pin + + + + + 20 + 10 + 381 + 381 + + + + + + + + 0 + 0 + + + + + 82 + 0 + + + + + 8 + 75 + true + + + + Memo Title + + + Qt::AlignCenter + + + + + + + + + + + + + + 82 + 0 + + + + + 8 + 75 + true + + + + Memo Body (optional) + + + Qt::AlignCenter + + + true + + + + + + + + + + + 82 + 0 + + + + + 8 + 75 + true + + + + Memo Time + + + Qt::AlignCenter + + + + + + + true + + + Qt::OffsetFromUTC + + + + + + + + 82 + 0 + + + + + 75 + true + + + + Memo Icon + + + Qt::AlignCenter + + + + + + + + + true + + + + + + + + 25 + 25 + + + + + + + assets/NOTIFICATION_REMINDER.png + + + + + + + + + + 82 + 0 + + + + + 8 + 75 + true + + + + Memo Subtitle (optional) + + + Qt::AlignCenter + + + true + + + + + + + Qt::Vertical + + + + 20 + 148 + + + + + + + + + + + assets/TIMELINE_CALENDAR.pngassets/TIMELINE_CALENDAR.png + + + Calendar Pin + + + + + 20 + 10 + 381 + 381 + + + + + + + + 82 + 0 + + + + + 75 + true + + + + Memo Title + + + Qt::AlignCenter + + + + + + + + 82 + 0 + + + + + 75 + true + + + + Memo Subtitle (optional) + + + Qt::AlignCenter + + + true + + + + + + + + + + + 82 + 0 + + + + + 75 + true + + + + Memo Body (optional) + + + Qt::AlignCenter + + + true + + + + + + + + + + + 82 + 0 + + + + + 75 + true + + + + false + + + Event Start Time + + + Qt::AlignCenter + + + true + + + + + + + true + + + + + + + + 82 + 0 + + + + + 75 + true + + + + Event End Time + + + Qt::AlignCenter + + + true + + + + + + + true + + + + + + + + 82 + 0 + + + + + 75 + true + + + + Memo Icon + + + Qt::AlignCenter + + + true + + + + + + + + + true + + + + + + + + 25 + 25 + + + + + 25 + 25 + + + + + + + assets/NOTIFICATION_REMINDER.png + + + + + + + + + + + + Qt::Vertical + + + + 20 + 110 + + + + + + + + + pinSelector + pushButton + line + comingSoon + comingSoonSub + + + + + diff --git a/memos.py b/memos.py index c7bc180..2e3ed86 100644 --- a/memos.py +++ b/memos.py @@ -14,6 +14,8 @@ import functions import os +# Commented entries aren't showing the same icon as displayed in the Wiki so they can't be displayed here +# I'm leaving them here for code completeness but they haven't an icon in the assets anymore iconsList = [ "NOTIFICATION_REMINDER", "ALARM_CLOCK", @@ -22,18 +24,18 @@ "BASKETBALL", "BIRTHDAY_EVENT", "CAR_RENTAL", - "CHECK_INTERNET_CONNECTION", + # "CHECK_INTERNET_CONNECTION", "CLOUDY_DAY", "CRICKET_GAME", - "DAY_SEPARATOR", + # "DAY_SEPARATOR", "DINNER_RESERVATION", "DISMISSED_PHONE_CALL", - "DURING_PHONE_CALL", - "DURING_PHONE_CALL_CENTERED", + # "DURING_PHONE_CALL", + # "DURING_PHONE_CALL_CENTERED", "GENERIC_CONFIRMATION", "GENERIC_EMAIL", "GENERIC_QUESTION", - "GENERIC_SMS", + # "GENERIC_SMS", "GENERIC_WARNING", "GLUCOSE_MONITOR", "HEAVY_RAIN", @@ -50,17 +52,17 @@ "NOTIFICATION_FLAG", "NOTIFICATION_GENERIC", "NOTIFICATION_LIGHTHOUSE", - "NO_EVENTS", + # "NO_EVENTS", "PARTLY_CLOUDY", "PAY_BILL", "RADIO_SHOW", "RAINING_AND_SNOWING", "REACHED_FITNESS_GOAL", - "RESULT_DELETED", + # "RESULT_DELETED", "RESULT_DISMISSED", "RESULT_FAILED", - "RESULT_MUTE", - "RESULT_SENT", + # "RESULT_MUTE", + # "RESULT_SENT", "SCHEDULED_EVENT", "SCHEDULED_FLIGHT", "SETTINGS", @@ -76,7 +78,7 @@ "TIMELINE_SUN", "TIMELINE_WEATHER", "TV_SHOW", - "WATCH_DISCONNECTED" + # "WATCH_DISCONNECTED" ] @@ -92,10 +94,11 @@ def resource_path(relative_path): return os.path.join(base_path, relative_path) +# TODO: Optimise code so it doesn't use multiple input Textbox for the same purpose on ditfferent tabs (Code is still in experimental mode!) class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(679, 465) + MainWindow.resize(679, 521) font = QtGui.QFont() font.setPointSize(8) font.setBold(False) @@ -108,41 +111,216 @@ def setupUi(self, MainWindow): self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.pushButton = QtWidgets.QPushButton(self.centralwidget) - self.pushButton.setGeometry(QtCore.QRect(160, 380, 111, 31)) + self.pushButton.setGeometry(QtCore.QRect(180, 440, 111, 31)) self.pushButton.setObjectName("pushButton") self.pushButton.clicked.connect(self.sendToTest) - self.titleLabel = QtWidgets.QLabel(self.centralwidget) - self.titleLabel.setGeometry(QtCore.QRect(10, 30, 91, 21)) - font = QtGui.QFont() - font.setPointSize(8) - font.setBold(True) - font.setWeight(75) - self.titleLabel.setFont(font) - self.titleLabel.setAlignment(QtCore.Qt.AlignCenter) - self.titleLabel.setObjectName("titleLabel") - self.titleEdit = QtWidgets.QLineEdit(self.centralwidget) - self.titleEdit.setGeometry(QtCore.QRect(110, 30, 321, 20)) - self.titleEdit.setObjectName("titleEdit") self.line = QtWidgets.QFrame(self.centralwidget) - self.line.setGeometry(QtCore.QRect(440, 30, 20, 381)) + self.line.setGeometry(QtCore.QRect(440, 30, 20, 441)) self.line.setFrameShape(QtWidgets.QFrame.VLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") - self.subtitleLabel = QtWidgets.QLabel(self.centralwidget) - self.subtitleLabel.setGeometry(QtCore.QRect(10, 50, 101, 41)) + self.comingSoon = QtWidgets.QLabel(self.centralwidget) + self.comingSoon.setGeometry(QtCore.QRect(450, 149, 221, 101)) + font = QtGui.QFont() + font.setPointSize(25) + font.setBold(False) + font.setWeight(50) + self.comingSoon.setFont(font) + self.comingSoon.setAlignment(QtCore.Qt.AlignCenter) + self.comingSoon.setObjectName("comingSoon") + self.comingSoonSub = QtWidgets.QLabel(self.centralwidget) + self.comingSoonSub.setGeometry(QtCore.QRect(450, 244, 221, 40)) + font = QtGui.QFont() + font.setPointSize(10) + self.comingSoonSub.setFont(font) + self.comingSoonSub.setAlignment(QtCore.Qt.AlignCenter) + self.comingSoonSub.setWordWrap(True) + self.comingSoonSub.setObjectName("comingSoonSub") + self.pinSelector = QtWidgets.QTabWidget(self.centralwidget) + self.pinSelector.setGeometry(QtCore.QRect(20, 10, 421, 421)) + palette = QtGui.QPalette() + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(160, 160, 160)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(160, 160, 160)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush) + brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(247, 247, 247)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(160, 160, 160)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(120, 120, 120)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(240, 240, 240)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush) + self.pinSelector.setPalette(palette) + self.pinSelector.setAutoFillBackground(True) + self.pinSelector.setTabPosition(QtWidgets.QTabWidget.North) + self.pinSelector.setTabShape(QtWidgets.QTabWidget.Rounded) + self.pinSelector.setUsesScrollButtons(True) + self.pinSelector.setDocumentMode(True) + self.pinSelector.setObjectName("pinSelector") + self.genericPin = QtWidgets.QWidget() + self.genericPin.setObjectName("genericPin") + self.formLayoutWidget = QtWidgets.QWidget(self.genericPin) + self.formLayoutWidget.setGeometry(QtCore.QRect(20, 10, 381, 381)) + self.formLayoutWidget.setObjectName("formLayoutWidget") + self.genericPinLayout = QtWidgets.QFormLayout(self.formLayoutWidget) + self.genericPinLayout.setContentsMargins(0, 0, 0, 0) + self.genericPinLayout.setObjectName("genericPinLayout") + self.titleLabel = QtWidgets.QLabel(self.formLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.titleLabel.sizePolicy().hasHeightForWidth()) + self.titleLabel.setSizePolicy(sizePolicy) + self.titleLabel.setMinimumSize(QtCore.QSize(82, 0)) font = QtGui.QFont() font.setPointSize(8) font.setBold(True) font.setWeight(75) - self.subtitleLabel.setFont(font) - self.subtitleLabel.setAlignment(QtCore.Qt.AlignCenter) - self.subtitleLabel.setWordWrap(True) - self.subtitleLabel.setObjectName("subtitleLabel") - self.subtitleEdit = QtWidgets.QPlainTextEdit(self.centralwidget) - self.subtitleEdit.setGeometry(QtCore.QRect(110, 60, 321, 51)) + self.titleLabel.setFont(font) + self.titleLabel.setAlignment(QtCore.Qt.AlignCenter) + self.titleLabel.setObjectName("titleLabel") + self.genericPinLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.titleLabel) + self.titleEdit = QtWidgets.QLineEdit(self.formLayoutWidget) + self.titleEdit.setObjectName("titleEdit") + self.genericPinLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.titleEdit) + self.subtitleEdit = QtWidgets.QPlainTextEdit(self.formLayoutWidget) self.subtitleEdit.setObjectName("subtitleEdit") - self.bodyLabel = QtWidgets.QLabel(self.centralwidget) - self.bodyLabel.setGeometry(QtCore.QRect(10, 120, 91, 31)) + self.genericPinLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.subtitleEdit) + self.bodyLabel = QtWidgets.QLabel(self.formLayoutWidget) + self.bodyLabel.setMinimumSize(QtCore.QSize(82, 0)) font = QtGui.QFont() font.setPointSize(8) font.setBold(True) @@ -151,11 +329,12 @@ def setupUi(self, MainWindow): self.bodyLabel.setAlignment(QtCore.Qt.AlignCenter) self.bodyLabel.setWordWrap(True) self.bodyLabel.setObjectName("bodyLabel") - self.bodyEdit = QtWidgets.QPlainTextEdit(self.centralwidget) - self.bodyEdit.setGeometry(QtCore.QRect(110, 120, 321, 61)) + self.genericPinLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.bodyLabel) + self.bodyEdit = QtWidgets.QPlainTextEdit(self.formLayoutWidget) self.bodyEdit.setObjectName("bodyEdit") - self.timeLabel = QtWidgets.QLabel(self.centralwidget) - self.timeLabel.setGeometry(QtCore.QRect(20, 240, 81, 20)) + self.genericPinLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.bodyEdit) + self.timeLabel = QtWidgets.QLabel(self.formLayoutWidget) + self.timeLabel.setMinimumSize(QtCore.QSize(82, 0)) font = QtGui.QFont() font.setPointSize(8) font.setBold(True) @@ -163,69 +342,206 @@ def setupUi(self, MainWindow): self.timeLabel.setFont(font) self.timeLabel.setAlignment(QtCore.Qt.AlignCenter) self.timeLabel.setObjectName("timeLabel") - self.dateTimeEdit = QtWidgets.QDateTimeEdit(self.centralwidget) - self.dateTimeEdit.setGeometry(QtCore.QRect(110, 240, 321, 22)) + self.genericPinLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.timeLabel) + self.dateTimeEdit = QtWidgets.QDateTimeEdit(self.formLayoutWidget) self.dateTimeEdit.setCalendarPopup(True) self.dateTimeEdit.setTimeSpec(QtCore.Qt.OffsetFromUTC) - self.dateTimeEdit.setObjectName("dateTimeEdit") self.dateTimeEdit.setDateTime(QtCore.QDateTime.currentDateTime()) self.dateTimeEdit.setMinimumDate(QDate.currentDate().addDays(-2)) self.dateTimeEdit.setMaximumDate(QDate.currentDate().addDays(365)) - self.comingSoon = QtWidgets.QLabel(self.centralwidget) - self.comingSoon.setGeometry(QtCore.QRect(450, 149, 221, 101)) - font = QtGui.QFont() - font.setPointSize(25) - font.setBold(False) - font.setWeight(50) - self.comingSoon.setFont(font) - self.comingSoon.setAlignment(QtCore.Qt.AlignCenter) - self.comingSoon.setObjectName("comingSoon") - self.iconLabel = QtWidgets.QLabel(self.centralwidget) - self.iconLabel.setGeometry(QtCore.QRect(20, 290, 81, 20)) + self.dateTimeEdit.setObjectName("dateTimeEdit") + self.genericPinLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.dateTimeEdit) + self.iconLabel = QtWidgets.QLabel(self.formLayoutWidget) + self.iconLabel.setMinimumSize(QtCore.QSize(82, 0)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.iconLabel.setFont(font) self.iconLabel.setAlignment(QtCore.Qt.AlignCenter) self.iconLabel.setObjectName("iconLabel") - self.comingSoonSub = QtWidgets.QLabel(self.centralwidget) - self.comingSoonSub.setGeometry(QtCore.QRect(450, 244, 221, 40)) - font = QtGui.QFont() - font.setPointSize(10) - self.comingSoonSub.setFont(font) - self.comingSoonSub.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop) - self.comingSoonSub.setWordWrap(True) - self.comingSoonSub.setObjectName("comingSoonSub") - self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget) - self.horizontalLayoutWidget.setGeometry(QtCore.QRect(110, 290, 321, 31)) - self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") - self.iconBox = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) - self.iconBox.setContentsMargins(0, 0, 0, 0) + self.genericPinLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.iconLabel) + self.iconBox = QtWidgets.QHBoxLayout() self.iconBox.setObjectName("iconBox") - self.iconSelector = QtWidgets.QComboBox(self.horizontalLayoutWidget) + self.iconSelector = QtWidgets.QComboBox(self.formLayoutWidget) self.iconSelector.setEditable(True) self.iconSelector.setObjectName("iconSelector") self.iconSelector.addItems(iconsList) self.iconSelector.currentIndexChanged.connect(self.changeIconShow) self.iconBox.addWidget(self.iconSelector) - self.iconShow = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.iconShow = QtWidgets.QLabel(self.formLayoutWidget) self.iconShow.setMaximumSize(QtCore.QSize(25, 25)) self.iconShow.setText("") + # NOTE: Manually changed to resource_path() self.iconShow.setPixmap(QtGui.QPixmap(resource_path("NOTIFICATION_REMINDER.png"))) self.iconShow.setObjectName("iconShow") self.iconBox.addWidget(self.iconShow) + self.genericPinLayout.setLayout(5, QtWidgets.QFormLayout.FieldRole, self.iconBox) + self.subtitleLabel = QtWidgets.QLabel(self.formLayoutWidget) + self.subtitleLabel.setMinimumSize(QtCore.QSize(82, 0)) + font = QtGui.QFont() + font.setPointSize(8) + font.setBold(True) + font.setWeight(75) + self.subtitleLabel.setFont(font) + self.subtitleLabel.setAlignment(QtCore.Qt.AlignCenter) + self.subtitleLabel.setWordWrap(True) + self.subtitleLabel.setObjectName("subtitleLabel") + self.genericPinLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.subtitleLabel) + spacerItem = QtWidgets.QSpacerItem(20, 148, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.genericPinLayout.setItem(3, QtWidgets.QFormLayout.LabelRole, spacerItem) + icon1 = QtGui.QIcon() + # NOTE: Manually changed to resource_path() + icon1.addPixmap(QtGui.QPixmap(resource_path("NOTIFICATION_REMINDER.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pinSelector.addTab(self.genericPin, icon1, "") + self.calendarPin = QtWidgets.QWidget() + self.calendarPin.setObjectName("calendarPin") + self.formLayoutWidget_2 = QtWidgets.QWidget(self.calendarPin) + self.formLayoutWidget_2.setGeometry(QtCore.QRect(20, 10, 381, 381)) + self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") + self.calendarPinLayout = QtWidgets.QFormLayout(self.formLayoutWidget_2) + self.calendarPinLayout.setContentsMargins(0, 0, 0, 0) + self.calendarPinLayout.setObjectName("calendarPinLayout") + self.titleCalLabel = QtWidgets.QLabel(self.formLayoutWidget_2) + self.titleCalLabel.setMinimumSize(QtCore.QSize(82, 0)) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.titleCalLabel.setFont(font) + self.titleCalLabel.setAlignment(QtCore.Qt.AlignCenter) + self.titleCalLabel.setObjectName("titleCalLabel") + self.calendarPinLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.titleCalLabel) + self.subtitleCalLabel = QtWidgets.QLabel(self.formLayoutWidget_2) + self.subtitleCalLabel.setMinimumSize(QtCore.QSize(82, 0)) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.subtitleCalLabel.setFont(font) + self.subtitleCalLabel.setAlignment(QtCore.Qt.AlignCenter) + self.subtitleCalLabel.setWordWrap(True) + self.subtitleCalLabel.setObjectName("subtitleCalLabel") + self.calendarPinLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.subtitleCalLabel) + self.subtitleCal = QtWidgets.QPlainTextEdit(self.formLayoutWidget_2) + self.subtitleCal.setObjectName("subtitleCal") + self.calendarPinLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.subtitleCal) + self.bodyCalLabel = QtWidgets.QLabel(self.formLayoutWidget_2) + self.bodyCalLabel.setMinimumSize(QtCore.QSize(82, 0)) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.bodyCalLabel.setFont(font) + self.bodyCalLabel.setAlignment(QtCore.Qt.AlignCenter) + self.bodyCalLabel.setWordWrap(True) + self.bodyCalLabel.setObjectName("bodyCalLabel") + self.calendarPinLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.bodyCalLabel) + self.bodyCal = QtWidgets.QPlainTextEdit(self.formLayoutWidget_2) + self.bodyCal.setObjectName("bodyCal") + self.calendarPinLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.bodyCal) + self.timeStartCalLabel = QtWidgets.QLabel(self.formLayoutWidget_2) + self.timeStartCalLabel.setMinimumSize(QtCore.QSize(82, 0)) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.timeStartCalLabel.setFont(font) + self.timeStartCalLabel.setTabletTracking(False) + self.timeStartCalLabel.setAlignment(QtCore.Qt.AlignCenter) + self.timeStartCalLabel.setWordWrap(True) + self.timeStartCalLabel.setObjectName("timeStartCalLabel") + self.calendarPinLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.timeStartCalLabel) + self.timeStartCal = QtWidgets.QDateTimeEdit(self.formLayoutWidget_2) + self.timeStartCal.setCalendarPopup(True) + self.timeStartCal.setDateTime(QtCore.QDateTime.currentDateTime()) + self.timeStartCal.setMinimumDate(QDate.currentDate().addDays(-2)) + self.timeStartCal.setMaximumDate(QDate.currentDate().addDays(365)) + self.timeStartCal.setObjectName("timeStartCal") + self.calendarPinLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.timeStartCal) + self.timeEndCalLabel = QtWidgets.QLabel(self.formLayoutWidget_2) + self.timeEndCalLabel.setMinimumSize(QtCore.QSize(82, 0)) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.timeEndCalLabel.setFont(font) + self.timeEndCalLabel.setAlignment(QtCore.Qt.AlignCenter) + self.timeEndCalLabel.setWordWrap(True) + self.timeEndCalLabel.setObjectName("timeEndCalLabel") + self.calendarPinLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.timeEndCalLabel) + self.timeEndCal = QtWidgets.QDateTimeEdit(self.formLayoutWidget_2) + self.timeEndCal.setCalendarPopup(True) + self.timeEndCal.setDateTime(QtCore.QDateTime.currentDateTime()) + self.timeEndCal.setMinimumDate(QDate.currentDate().addDays(-2)) + self.timeEndCal.setMaximumDate(QDate.currentDate().addDays(365)) + self.timeEndCal.setObjectName("timeEndCal") + self.calendarPinLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.timeEndCal) + self.memoIconCalLabel = QtWidgets.QLabel(self.formLayoutWidget_2) + self.memoIconCalLabel.setMinimumSize(QtCore.QSize(82, 0)) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.memoIconCalLabel.setFont(font) + self.memoIconCalLabel.setAlignment(QtCore.Qt.AlignCenter) + self.memoIconCalLabel.setWordWrap(True) + self.memoIconCalLabel.setObjectName("memoIconCalLabel") + self.calendarPinLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.memoIconCalLabel) + self.memoIconCalBox = QtWidgets.QHBoxLayout() + self.memoIconCalBox.setObjectName("memoIconCalBox") + self.memoIconCal = QtWidgets.QComboBox(self.formLayoutWidget_2) + self.memoIconCal.setEditable(True) + self.memoIconCal.setObjectName("memoIconCal") + self.memoIconCal.addItems(iconsList) + self.memoIconCal.currentIndexChanged.connect(self.changeIconShow) + self.memoIconCalBox.addWidget(self.memoIconCal) + self.memoIconCalDisplay = QtWidgets.QLabel(self.formLayoutWidget_2) + self.memoIconCalDisplay.setMinimumSize(QtCore.QSize(25, 25)) + self.memoIconCalDisplay.setMaximumSize(QtCore.QSize(25, 25)) + self.memoIconCalDisplay.setText("") + # NOTE: Manually changed to resource_path() + self.memoIconCalDisplay.setPixmap(QtGui.QPixmap(resource_path("NOTIFICATION_REMINDER.png"))) + self.memoIconCalDisplay.setObjectName("memoIconCalDisplay") + self.memoIconCalBox.addWidget(self.memoIconCalDisplay) + self.calendarPinLayout.setLayout(6, QtWidgets.QFormLayout.FieldRole, self.memoIconCalBox) + self.titleCal = QtWidgets.QLineEdit(self.formLayoutWidget_2) + self.titleCal.setObjectName("titleCal") + self.calendarPinLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.titleCal) + spacerItem1 = QtWidgets.QSpacerItem(20, 110, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.calendarPinLayout.setItem(3, QtWidgets.QFormLayout.LabelRole, spacerItem1) + icon2 = QtGui.QIcon() + # NOTE: Manually changed to resource_path() + icon2.addPixmap(QtGui.QPixmap(resource_path("TIMELINE_CALENDAR.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pinSelector.addTab(self.calendarPin, icon2, "") + self.pinSelector.raise_() + self.pushButton.raise_() + self.line.raise_() + self.comingSoon.raise_() + self.comingSoonSub.raise_() MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) + self.pinSelector.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) + # This function changes the icon shown in the selected tab def changeIconShow(self): - self.iconShow.setPixmap(QtGui.QPixmap(resource_path(self.iconSelector.currentText() + ".png"))) + if self.pinSelector.currentIndex() == 0: + self.iconShow.setPixmap(QtGui.QPixmap(resource_path(self.iconSelector.currentText() + ".png"))) + elif self.pinSelector.currentIndex() == 1: + self.memoIconCalDisplay.setPixmap(QtGui.QPixmap(resource_path(self.memoIconCal.currentText() + ".png"))) + + # This functions computes the difference in seconds between two dates, useful for the calendar Pin duration + # since it asks for an event duration in minutes and not for a second date + def dateToMinutes(self, start, end): + startTime = start.toPyDateTime().timestamp() + endTime = end.toPyDateTime().timestamp() + totalDuration = int((endTime - startTime) / 60) + print(totalDuration) + return totalDuration def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "Rebble Memos")) self.pushButton.setText(_translate("MainWindow", "Send to Timeline!")) + self.comingSoon.setText(_translate("MainWindow", "Pin History\n" + "Coming Soon")) + self.comingSoonSub.setText( + _translate("MainWindow", "You\'ll be able to modify already sent memos directly from here!")) self.titleLabel.setText(_translate("MainWindow", "Memo Title")) self.subtitleLabel.setText(_translate("MainWindow", "Memo Subtitle (optional)")) self.bodyLabel.setText(_translate("MainWindow", "Memo Body (optional)")) @@ -234,34 +550,77 @@ def retranslateUi(self, MainWindow): self.iconLabel.setText(_translate("MainWindow", "Memo Icon")) self.comingSoonSub.setText( _translate("MainWindow", "You\'ll be able to modify already sent memos directly from here!")) + self.subtitleLabel.setText(_translate("MainWindow", "Memo Subtitle (optional)")) + self.pinSelector.setTabText(self.pinSelector.indexOf(self.genericPin), _translate("MainWindow", "Generic Pin")) + self.pinSelector.setTabText(self.pinSelector.indexOf(self.calendarPin), + _translate("MainWindow", "Calendar Pin")) + + self.titleCalLabel.setText(_translate("MainWindow", "Memo Title")) + self.subtitleCalLabel.setText(_translate("MainWindow", "Memo Subtitle (optional)")) + self.bodyCalLabel.setText(_translate("MainWindow", "Memo Body (optional)")) + self.timeStartCalLabel.setText(_translate("MainWindow", "Event Start Time")) + self.timeEndCalLabel.setText(_translate("MainWindow", "Event End Time")) + self.memoIconCalLabel.setText(_translate("MainWindow", "Memo Icon")) + self.pinSelector.setTabText(self.pinSelector.indexOf(self.calendarPin), + _translate("MainWindow", "Calendar Pin")) # This function checks if the title is not empty (since it's the only one required that can be empty at runtime - # the other mandatory field, time, is already set to CurrentTime) # if so it invokes functions(sendToTimeline) with data taken from the form + def sendToTest(self): - if self.titleEdit.text() == "": - alert = QMessageBox() - alert.setWindowTitle('Rebble Memos') - icon = QtGui.QIcon() - # NOTE: Manually changed to resource_path() - icon.addPixmap(QtGui.QPixmap(resource_path("memo.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - alert.setWindowIcon(icon) - alert.setText("Title required. \nPlease insert one and try again") - alert.setMinimumWidth(500) - alert.exec_() + if self.pinSelector.currentIndex() == 0: + if self.titleEdit.text() == "": + self.alertMessage(1) + else: + # For some reason the Timeline servers don't accept ISO time with an offset different from "Z", so you need + # to convert it to ISO time at UTC+0 + now = QDateTime.currentDateTime() + offset = now.offsetFromUtc() + expected = self.dateTimeEdit.dateTime() + expected.setOffsetFromUtc(offset) + + functions.sendToTimeline(self.titleEdit.text(), + self.subtitleEdit.toPlainText(), + self.bodyEdit.toPlainText(), + expected.toTimeSpec(Qt.OffsetFromUTC), + self.iconSelector.currentText()) else: - # For some reason the Timeline servers don't accept ISO time with an offset different from "Z", so you need - # to convert it to ISO time at UTC+0 - now = QDateTime.currentDateTime() - offset = now.offsetFromUtc() - expected = self.dateTimeEdit.dateTime() - expected.setOffsetFromUtc(offset) + if self.titleCal.text() == "": + self.alertMessage(1) + else: + # For some reason the Timeline servers don't accept ISO time with an offset different from "Z", so you need + # to convert it to ISO time at UTC+0 + now = QDateTime.currentDateTime() + offset = now.offsetFromUtc() + expected = self.timeStartCal.dateTime() + expected.setOffsetFromUtc(offset) + + eventDuration = self.dateToMinutes(self.timeStartCal.dateTime(), self.timeEndCal.dateTime()) + + if eventDuration < 0: + self.alertMessage(2) + else: + functions.sendToTimeline(self.titleCal.text(), + self.subtitleCal.toPlainText(), + self.bodyCal.toPlainText(), + expected.toTimeSpec(Qt.OffsetFromUTC), + self.memoIconCal.currentText(), + eventDuration) + + def alertMessage(self, reason): + alert = QMessageBox() + alert.setWindowTitle('Rebble Memos') + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(resource_path("memo.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + alert.setWindowIcon(icon) + if reason == 1: + alert.setText("Title required. \nPlease insert one and try again") + elif reason == 2: + alert.setText("End time cannot be before start time!") + alert.setMinimumWidth(500) + alert.exec_() - functions.sendToTimeline(self.titleEdit.text(), - self.subtitleEdit.toPlainText(), - self.bodyEdit.toPlainText(), - expected.toTimeSpec(Qt.OffsetFromUTC), - self.iconSelector.currentText()) if __name__ == "__main__": diff --git a/memos.spec b/memos.spec index a5c8b39..c2254fd 100644 --- a/memos.spec +++ b/memos.spec @@ -22,18 +22,13 @@ a.datas += [('AUDIO_CASSETTE.png','assets\\AUDIO_CASSETTE.png', "DATA")] a.datas += [('BASKETBALL.png','assets\\BASKETBALL.png', "DATA")] a.datas += [('BIRTHDAY_EVENT.png','assets\\BIRTHDAY_EVENT.png', "DATA")] a.datas += [('CAR_RENTAL.png','assets\\CAR_RENTAL.png', "DATA")] -a.datas += [('CHECK_INTERNET_CONNECTION.png','assets\\CHECK_INTERNET_CONNECTION.png', "DATA")] a.datas += [('CLOUDY_DAY.png','assets\\CLOUDY_DAY.png', "DATA")] a.datas += [('CRICKET_GAME.png','assets\\CRICKET_GAME.png', "DATA")] -a.datas += [('DAY_SEPARATOR.png','assets\\DAY_SEPARATOR.png', "DATA")] a.datas += [('DINNER_RESERVATION.png','assets\\DINNER_RESERVATION.png', "DATA")] a.datas += [('DISMISSED_PHONE_CALL.png','assets\\DISMISSED_PHONE_CALL.png', "DATA")] -a.datas += [('DURING_PHONE_CALL.png','assets\\DURING_PHONE_CALL.png', "DATA")] -a.datas += [('DURING_PHONE_CALL_CENTERED.png','assets\\DURING_PHONE_CALL_CENTERED.png', "DATA")] a.datas += [('GENERIC_CONFIRMATION.png','assets\\GENERIC_CONFIRMATION.png', "DATA")] a.datas += [('GENERIC_EMAIL.png','assets\\GENERIC_EMAIL.png', "DATA")] a.datas += [('GENERIC_QUESTION.png','assets\\GENERIC_QUESTION.png', "DATA")] -a.datas += [('GENERIC_SMS.png','assets\\GENERIC_SMS.png', "DATA")] a.datas += [('GENERIC_WARNING.png','assets\\GENERIC_WARNING.png', "DATA")] a.datas += [('GLUCOSE_MONITOR.png','assets\\GLUCOSE_MONITOR.png', "DATA")] a.datas += [('HEAVY_RAIN.png','assets\\HEAVY_RAIN.png', "DATA")] @@ -46,18 +41,14 @@ a.datas += [('LOCATION.png','assets\\LOCATION.png', "DATA")] a.datas += [('MOVIE_EVENT.png','assets\\MOVIE_EVENT.png', "DATA")] a.datas += [('MUSIC_EVENT.png','assets\\MUSIC_EVENT.png', "DATA")] a.datas += [('NEWS_EVENT.png','assets\\NEWS_EVENT.png', "DATA")] -a.datas += [('NO_EVENTS.png','assets\\NO_EVENTS.png', "DATA")] a.datas += [('NOTIFICATION_LIGHTHOUSE.png','assets\\NOTIFICATION_LIGHTHOUSE.png', "DATA")] a.datas += [('PARTLY_CLOUDY.png','assets\\PARTLY_CLOUDY.png', "DATA")] a.datas += [('PAY_BILL.png','assets\\PAY_BILL.png', "DATA")] a.datas += [('RADIO_SHOW.png','assets\\RADIO_SHOW.png', "DATA")] a.datas += [('RAINING_AND_SNOWING.png','assets\\RAINING_AND_SNOWING.png', "DATA")] a.datas += [('REACHED_FITNESS_GOAL.png','assets\\REACHED_FITNESS_GOAL.png', "DATA")] -a.datas += [('RESULT_DELETED.png','assets\\RESULT_DELETED.png', "DATA")] a.datas += [('RESULT_DISMISSED.png','assets\\RESULT_DISMISSED.png', "DATA")] a.datas += [('RESULT_FAILED.png','assets\\RESULT_FAILED.png', "DATA")] -a.datas += [('RESULT_MUTE.png','assets\\RESULT_MUTE.png', "DATA")] -a.datas += [('RESULT_SENT.png','assets\\RESULT_SENT.png', "DATA")] a.datas += [('SCHEDULED_FLIGHT.png','assets\\SCHEDULED_FLIGHT.png', "DATA")] a.datas += [('SETTINGS.png','assets\\SETTINGS.png', "DATA")] a.datas += [('SOCCER_GAME.png','assets\\SOCCER_GAME.png', "DATA")] @@ -72,7 +63,6 @@ a.datas += [('TIMELINE_SPORTS.png','assets\\TIMELINE_SPORTS.png', "DATA")] a.datas += [('TIMELINE_SUN.png','assets\\TIMELINE_SUN.png', "DATA")] a.datas += [('TIMELINE_WEATHER.png','assets\\TIMELINE_WEATHER.png', "DATA")] a.datas += [('TV_SHOW.png','assets\\TV_SHOW.png', "DATA")] -a.datas += [('WATCH_DISCONNECTED.png','assets\\WATCH_DISCONNECTED.png', "DATA")] a.datas += [('HOTEL_RESERVATION.png','assets\\HOTEL_RESERVATION.png', "DATA")] a.datas += [('NOTIFICATION_FLAG.png','assets\\NOTIFICATION_FLAG.png', "DATA")] a.datas += [('NOTIFICATION_GENERIC.png','assets\\NOTIFICATION_GENERIC.png', "DATA")]