pytodo-qt 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pytodo-qt might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytodo-qt
3
- Version: 0.2.0
4
- Summary: A simple To-Do list app written in PyQt5
3
+ Version: 0.2.1
4
+ Summary: A simple To-Do list app written in PyQt6
5
5
  Author-email: Michael Berry <trismegustis@gmail.com>
6
6
  License: GPLv3
7
7
  Project-URL: Homepage, https://github.com/berrym/todo
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.8
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: COPYING
14
- Requires-Dist: PyQt5
14
+ Requires-Dist: PyQt6
15
15
  Requires-Dist: pycryptodomex
16
16
 
17
17
  # To-Do
@@ -0,0 +1,26 @@
1
+ todo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ todo/__main__.py,sha256=_1MdpWNQh1bLOzmlORBY4A475x2vkoFyOu6IO4W18xg,3189
3
+ todo/core/Logger.py,sha256=duo6tVFN9FV7k8mdAB771b--zsFLxlYdmd14gMnvO7E,1262
4
+ todo/core/TodoDatabase.py,sha256=eD-lieTfbVTeAFQQ-S13hUnT32Xad7TGiVMxNwmfdqY,8314
5
+ todo/core/__init__.py,sha256=p0LmCnw4DGApkS4n-qeAjmXGHiB1h9N1To6h6sD8Lsw,896
6
+ todo/core/json_helpers.py,sha256=DRrFCbrCc0YH9zXl7ATtA3FPxFo6mt4r5e3ImfyvHng,2873
7
+ todo/core/settings.py,sha256=FM_stOD6fDKtPJYYoe_5fisIbqlYI-xUp1-FOygXEsg,627
8
+ todo/crypto/AESCipher.py,sha256=YANP837mK9EIKA-03LLdGTJsjKdR6kAyj1N7FFwRUE4,1765
9
+ todo/crypto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ todo/gui/AddTodoDialog.py,sha256=oaphewhm06g-flhSAryJ8PLZrhy6ZKx9IH3EEVGvknk,2635
11
+ todo/gui/MainWindow.py,sha256=ObO_wB97OQp1WDlsDFzKI7aXlNf-CYoqVqCMs3n5pDo,31236
12
+ todo/gui/SyncDialog.py,sha256=oz_o39kVUSDZsbAw6-KRSywMy1_JcNl9PRTq81cWGMQ,3135
13
+ todo/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ todo/gui/icons/minus.png,sha256=PoaZl2RAW8wrkOBvz7bY03xEAdaBNd6HNKaodHbgdMc,217
15
+ todo/gui/icons/plus.png,sha256=VywdidKhN2IdJLPkBVQB3O2GmFXzfSDMV1rLkpKDoGg,287
16
+ todo/gui/icons/todo.png,sha256=kBRWlulLIqDxB5-XtlCz-OYhzrjyj5eEWN36nXWMYzI,659
17
+ todo/net/__init__.py,sha256=jY3HhV1Lr6AoLpVUgE9_fNeMz5xV7fEliIt4rFqQZ0s,538
18
+ todo/net/sync_operations.py,sha256=TSa7p-tgdd6jiwcQ1Cy3PNJw26eqRlVRrYFqLc9LNz8,279
19
+ todo/net/tcp_client_lib.py,sha256=x4-MDXk1_Bmol8QlEe81MAiw2_iaiPFEHjO_9FkQgak,4469
20
+ todo/net/tcp_server_lib.py,sha256=O4sroLQzzALABe2pfCPFbeMY592E-CM-NERuUglfCzo,4619
21
+ pytodo_qt-0.2.1.dist-info/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
22
+ pytodo_qt-0.2.1.dist-info/METADATA,sha256=YDfSt6N8VwDfR1E3pX6hGr_NHPbwUYrfwBGnWEc1sOw,1528
23
+ pytodo_qt-0.2.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
24
+ pytodo_qt-0.2.1.dist-info/entry_points.txt,sha256=ywI6kRYcR3cVBDg62_kvFicV4FPmk9ItG6jEKndNXqg,44
25
+ pytodo_qt-0.2.1.dist-info/top_level.txt,sha256=c1x0MAVpTPy2QFoNZ9fz48_PoX9pcGKJOwNu8vee_hs,5
26
+ pytodo_qt-0.2.1.dist-info/RECORD,,
todo/__main__.py CHANGED
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env python3
2
-
3
1
  """__main__.py
4
2
 
5
3
  A to-do list program written in Python using Qt5
@@ -23,11 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
23
21
  import argparse
24
22
  import os
25
23
  import sys
26
- from PyQt5 import QtWidgets
27
24
 
28
- from todo.core.Logger import Logger
29
- from todo.core import settings, TodoDataBase
30
- from todo.gui import MainWindow
25
+ from PyQt6.QtWidgets import QApplication
26
+
27
+ from .core.Logger import Logger
28
+ from .core import settings, TodoDatabase
29
+ from .gui import MainWindow
31
30
 
32
31
 
33
32
  logger = Logger(__name__)
@@ -50,8 +49,8 @@ def main():
50
49
  # create a command line arg_parser
51
50
  arg_parser = argparse.ArgumentParser(
52
51
  prog="To-Do",
53
- description="To-Do List Program",
54
- epilog="Copyright Michael Berry 2020",
52
+ description="To-Do List Application written in Python with Qt6",
53
+ epilog="Copyright Michael Berry 2024",
55
54
  )
56
55
 
57
56
  # add network server command group
@@ -107,10 +106,10 @@ def main():
107
106
  settings.options[k] = v
108
107
 
109
108
  # create a to-do database
110
- settings.db = TodoDataBase.CreateTodoDataBase()
109
+ settings.db = TodoDatabase.CreateTodoDatabase()
111
110
 
112
111
  # create a QApplication, the main window, then hand over control to Qt
113
- app = QtWidgets.QApplication(sys.argv)
112
+ app = QApplication(sys.argv)
114
113
  _ = MainWindow.CreateMainWindow()
115
114
  sys.exit(app.exec())
116
115
 
todo/core/Logger.py CHANGED
@@ -7,6 +7,7 @@ import logging
7
7
  import os
8
8
  import sys
9
9
 
10
+
10
11
  home_dir = os.getenv("HOME")
11
12
  if home_dir is not None:
12
13
  todo_dir = os.path.join(home_dir, ".todo")
@@ -1,4 +1,4 @@
1
- """TodoDataBase.py
1
+ """TodoDatabase.py
2
2
 
3
3
  This module implements the to-do database.
4
4
  """
@@ -8,15 +8,15 @@ import os
8
8
  import sys
9
9
  import threading
10
10
 
11
- from todo.core import settings
12
- from todo.core.Logger import Logger
13
- from todo.net import tcp_server_lib, tcp_client_lib
11
+ from ..core import settings
12
+ from ..core.Logger import Logger
13
+ from ..net import tcp_server_lib, tcp_client_lib
14
14
 
15
15
 
16
16
  logger = Logger(__name__)
17
17
 
18
18
 
19
- class CreateTodoDataBase:
19
+ class CreateTodoDatabase:
20
20
  """Maintains a database of to-do lists."""
21
21
 
22
22
  def __init__(self):
todo/core/__init__.py CHANGED
@@ -5,10 +5,10 @@ todo.core: A decorator to make security checks on the to-do database.
5
5
 
6
6
  import sys
7
7
 
8
- from PyQt5 import QtWidgets
8
+ from PyQt6.QtWidgets import QMessageBox
9
9
 
10
- from todo.core import settings
11
- from todo.core.Logger import Logger
10
+ from ..core import settings
11
+ from ..core.Logger import Logger
12
12
 
13
13
 
14
14
  def error_on_none_db(func):
@@ -28,7 +28,7 @@ def error_on_none_db(func):
28
28
  return
29
29
  else:
30
30
  msg = "Database does not exist, exiting"
31
- QtWidgets.QMessageBox.critical(None, "Database Error", msg)
31
+ QMessageBox.critical(None, "Database Error", msg)
32
32
  logger.log.exception(msg)
33
33
  sys.exit(1)
34
34
 
todo/core/json_helpers.py CHANGED
@@ -2,8 +2,8 @@ import json
2
2
  import os
3
3
  import sys
4
4
 
5
- from todo.core import error_on_none_db, settings
6
- from todo.core.Logger import Logger
5
+ from ..core import error_on_none_db, settings
6
+ from ..core.Logger import Logger
7
7
 
8
8
 
9
9
  logger = Logger(__name__)
todo/core/settings.py CHANGED
@@ -6,7 +6,7 @@ This module creates To-Do core global variables and functions.
6
6
  import sys
7
7
  import os
8
8
 
9
- __version__ = "0.2.0"
9
+ __version__ = "0.2.1"
10
10
  options = {}
11
11
  db = None
12
12
 
todo/crypto/AESCipher.py CHANGED
@@ -10,7 +10,7 @@ from Cryptodome.Cipher import AES
10
10
  from Cryptodome.Random import get_random_bytes
11
11
  from Cryptodome.Util.Padding import pad, unpad
12
12
 
13
- from todo.core.Logger import Logger
13
+ from ..core.Logger import Logger
14
14
 
15
15
 
16
16
  logger = Logger(__name__)
todo/gui/AddTodoDialog.py CHANGED
@@ -3,16 +3,24 @@
3
3
  Simple dialog to create a to-do.
4
4
  """
5
5
 
6
- from PyQt5 import QtWidgets
6
+ from PyQt6.QtWidgets import (
7
+ QDialog,
8
+ QLabel,
9
+ QLineEdit,
10
+ QComboBox,
11
+ QPushButton,
12
+ QVBoxLayout,
13
+ QMessageBox,
14
+ )
7
15
 
8
- from todo.core import error_on_none_db, settings
9
- from todo.core.Logger import Logger
16
+ from ..core import error_on_none_db, settings
17
+ from ..core.Logger import Logger
10
18
 
11
19
 
12
20
  logger = Logger(__name__)
13
21
 
14
22
 
15
- class AddTodoDialog(QtWidgets.QDialog):
23
+ class AddTodoDialog(QDialog):
16
24
  """Create a new to-do."""
17
25
 
18
26
  def __init__(self):
@@ -25,20 +33,20 @@ class AddTodoDialog(QtWidgets.QDialog):
25
33
  super().__init__()
26
34
 
27
35
  # reminder
28
- reminder_label = QtWidgets.QLabel("Reminder", self)
29
- self.reminder_field = QtWidgets.QLineEdit(self)
36
+ reminder_label = QLabel("Reminder", self)
37
+ self.reminder_field = QLineEdit(self)
30
38
 
31
39
  # priority
32
- priority_label = QtWidgets.QLabel("Priority", self)
33
- self.priority_field = QtWidgets.QComboBox(self)
40
+ priority_label = QLabel("Priority", self)
41
+ self.priority_field = QComboBox(self)
34
42
  self.priority_field.addItems(["Low", "Normal", "High"])
35
43
 
36
44
  # add button
37
- self.add_button = QtWidgets.QPushButton("Add to-do", self)
45
+ self.add_button = QPushButton("Add to-do", self)
38
46
  self.add_button.clicked.connect(self.get_todo)
39
47
 
40
48
  # create a vertical box layout
41
- v_box = QtWidgets.QVBoxLayout()
49
+ v_box = QVBoxLayout()
42
50
  v_box.addWidget(reminder_label)
43
51
  v_box.addWidget(self.reminder_field)
44
52
  v_box.addWidget(priority_label)
@@ -53,13 +61,11 @@ class AddTodoDialog(QtWidgets.QDialog):
53
61
  logger.log.info("Add to-do dialog created")
54
62
 
55
63
  @error_on_none_db
56
- def get_todo(self):
64
+ def get_todo(self, *args, **kwargs):
57
65
  """Get to-do information and append it to the current list."""
58
66
  reminder = self.reminder_field.text()
59
67
  if reminder == "":
60
- QtWidgets.QMessageBox.information(
61
- self, "Empty reminder", "Reminder cannot be empty"
62
- )
68
+ QMessageBox.information(self, "Empty reminder", "Reminder cannot be empty")
63
69
  return
64
70
 
65
71
  # get to-do information
todo/gui/MainWindow.py CHANGED
@@ -6,134 +6,132 @@ This module implements the GUI for To-Do.
6
6
  import os
7
7
  import sys
8
8
 
9
- from PyQt5 import QtCore, QtGui, QtWidgets, QtPrintSupport
10
-
11
- from todo.core import error_on_none_db, settings, json_helpers
12
- from todo.core.Logger import Logger
13
- from todo.gui.AddTodoDialog import AddTodoDialog
14
- from todo.gui.SyncDialog import SyncDialog
15
- from todo.net.sync_operations import sync_operations
9
+ from PyQt6.QtCore import QPersistentModelIndex
10
+ from PyQt6.QtGui import QAction, QIcon, QFont
11
+ from PyQt6.QtWidgets import (
12
+ QMainWindow,
13
+ QMenu,
14
+ QTableWidget,
15
+ QComboBox,
16
+ QToolTip,
17
+ QMessageBox,
18
+ QProgressBar,
19
+ QLabel,
20
+ QLineEdit,
21
+ QSystemTrayIcon,
22
+ )
23
+ from PyQt6.QtPrintSupport import QPrinter
24
+
25
+ from ..core import error_on_none_db, settings, json_helpers
26
+ from ..core.Logger import Logger
27
+ from ..gui.AddTodoDialog import AddTodoDialog
28
+ from ..gui.SyncDialog import SyncDialog
29
+ from ..net.sync_operations import sync_operations
16
30
 
17
31
 
18
32
  logger = Logger(__name__)
19
33
 
20
34
 
21
- class CreateMainWindow(QtWidgets.QMainWindow):
35
+ class CreateMainWindow(QMainWindow):
22
36
  """This class implements the bulk of the gui functionality in To-Do.
23
37
 
24
38
  It creates the main window, and helps to facilitate management of the
25
39
  list database for the user.
26
40
  """
27
41
 
28
- def __init__(self, *args):
42
+ def __init__(self, *args, **kwargs):
29
43
  """Create the window, make a table, fill table with to-do data."""
30
44
  logger.log.info("Creating the main window")
31
45
 
32
46
  # create the window, set title and tooltip, resize and center window
33
- QtWidgets.QMainWindow.__init__(self)
34
- self.setWindowIcon(QtGui.QIcon("gui/icons/todo.png"))
47
+ # QMainWindow.__init__(self)
48
+ super().__init__()
49
+ self.setWindowIcon(QIcon("gui/icons/todo.png"))
35
50
  self.setWindowTitle("To-Do")
36
51
  self.setToolTip("Python3 + Qt5 = Happy <u>To-Do</u> Programmer!")
37
- QtWidgets.QToolTip.setFont(QtGui.QFont("Helvetica", 10))
52
+ QToolTip.setFont(QFont("Helvetica", 10))
38
53
  self.resize(800, 500)
39
54
  self.center()
40
55
 
41
56
  # create our special font
42
- self.complete_font = QtGui.QFont("Helvetica", 10, QtGui.QFont.Bold)
57
+ self.complete_font = QFont("Helvetica", 10)
58
+ self.complete_font.setBold(True)
43
59
  self.complete_font.setStrikeOut(True)
44
60
 
45
61
  # create our normal font
46
- self.normal_font = QtGui.QFont("Helvetica", 10, QtGui.QFont.Normal)
62
+ self.normal_font = QFont("Helvetica", 10)
47
63
  self.normal_font.setStrikeOut(False)
48
64
 
49
65
  # create some actions
50
- printer = QtWidgets.QAction(QtGui.QIcon(), "Print", self)
66
+ printer = QAction(QIcon(), "Print", self)
51
67
  printer.setShortcut("Ctrl+P")
52
- printer.triggered.connect(self.print_list)
68
+ printer.triggered.connect(self.printlist)
53
69
 
54
- export = QtWidgets.QAction(QtGui.QIcon(), "Export to Text File", self)
70
+ export = QAction(QIcon(), "Export to Text File", self)
55
71
  export.setShortcut("Ctrl+E")
56
72
  export.triggered.connect(self.export_list)
57
73
 
58
- _quit = QtWidgets.QAction(QtGui.QIcon(), "Exit", self)
59
- _quit.setShortcut("Ctrl+Q")
60
- _quit.triggered.connect(self.close)
74
+ quit = QAction(QIcon(), "Exit", self)
75
+ quit.setShortcut("Ctrl+Q")
76
+ quit.triggered.connect(self.close)
61
77
 
62
78
  # to-do actions
63
- add = QtWidgets.QAction(
64
- QtGui.QIcon("gui/icons/plus.png"), "Add new to-do", self
65
- )
79
+ add = QAction(QIcon("gui/icons/plus.png"), "Add new to-do", self)
66
80
  add.setShortcut("+")
67
81
  add.triggered.connect(self.add_todo)
68
82
 
69
- delete = QtWidgets.QAction(
70
- QtGui.QIcon("gui/icons/minus.png"), "Delete to-do", self
71
- )
83
+ delete = QAction(QIcon("gui/icons/minus.png"), "Delete to-do", self)
72
84
  delete.setShortcut("-")
73
85
  delete.triggered.connect(self.delete_todo)
74
86
 
75
- toggle = QtWidgets.QAction(
76
- QtGui.QIcon("gui/icons/todo.png"), "Toggle to-do Status", self
77
- )
87
+ toggle = QAction(QIcon("gui/icons/todo.png"), "Toggle to-do Status", self)
78
88
  toggle.setShortcut("%")
79
89
  toggle.triggered.connect(self.toggle_todo)
80
90
 
81
91
  # list actions
82
- list_add = QtWidgets.QAction(QtGui.QIcon(), "Add new list", self)
92
+ list_add = QAction(QIcon(), "Add new list", self)
83
93
  list_add.setShortcut("Ctrl++")
84
94
  list_add.triggered.connect(self.add_list)
85
95
 
86
- list_delete = QtWidgets.QAction(
87
- QtGui.QIcon("gui/icons/minus.png"), "Delete list", self
88
- )
96
+ list_delete = QAction(QIcon("gui/icons/minus.png"), "Delete list", self)
89
97
 
90
98
  list_delete.setShortcut("Ctrl+-")
91
99
  list_delete.triggered.connect(self.delete_list)
92
100
 
93
- list_rename = QtWidgets.QAction(QtGui.QIcon(), "Rename list", self)
101
+ list_rename = QAction(QIcon(), "Rename list", self)
94
102
  list_rename.setShortcut("Ctrl+R")
95
103
  list_rename.triggered.connect(self.rename_list)
96
104
 
97
- list_switch = QtWidgets.QAction(QtGui.QIcon(), "Switch List", self)
105
+ list_switch = QAction(QIcon(), "Switch List", self)
98
106
  list_switch.setShortcut("Ctrl+L")
99
107
  list_switch.triggered.connect(self.switch_list)
100
108
 
101
- sync_pull = QtWidgets.QAction(
102
- QtGui.QIcon(), "Get lists from another computer", self
103
- )
109
+ sync_pull = QAction(QIcon(), "Get lists from another computer", self)
104
110
  sync_pull.setShortcut("F6")
105
111
  sync_pull.triggered.connect(self.db_sync_pull)
106
112
 
107
- sync_push = QtWidgets.QAction(
108
- QtGui.QIcon(), "Send lists to another computer", self
109
- )
113
+ sync_push = QAction(QIcon(), "Send lists to another computer", self)
110
114
  sync_push.setShortcut("F7")
111
115
  sync_push.triggered.connect(self.db_sync_push)
112
116
 
113
117
  # network server actions
114
- start_server = QtWidgets.QAction(
115
- QtGui.QIcon(), "Start the network server", self
116
- )
118
+ start_server = QAction(QIcon(), "Start the network server", self)
117
119
  start_server.triggered.connect(self.db_start_server)
118
120
 
119
- stop_server = QtWidgets.QAction(QtGui.QIcon(), "Stop the network server", self)
121
+ stop_server = QAction(QIcon(), "Stop the network server", self)
120
122
  stop_server.triggered.connect(self.db_stop_server)
121
123
 
122
- change_port = QtWidgets.QAction(
123
- QtGui.QIcon(), "Change network server port", self
124
- )
124
+ change_port = QAction(QIcon(), "Change network server port", self)
125
125
  change_port.triggered.connect(self.db_server_port)
126
126
 
127
- change_bind_address = QtWidgets.QAction(
128
- QtGui.QIcon(), "Change network server address", self
129
- )
127
+ change_bind_address = QAction(QIcon(), "Change network server address", self)
130
128
  change_bind_address.triggered.connect(self.db_server_bind_address)
131
129
 
132
130
  # fanfare
133
- about = QtWidgets.QAction(QtGui.QIcon(), "About To-Do", self)
131
+ about = QAction(QIcon(), "About To-Do", self)
134
132
  about.triggered.connect(self.about_todo)
135
133
 
136
- about_qt = QtWidgets.QAction(QtGui.QIcon(), "About Qt", self)
134
+ about_qt = QAction(QIcon(), "About Qt", self)
137
135
  about_qt.triggered.connect(self.about_qt)
138
136
 
139
137
  # create a menu bar
@@ -143,18 +141,12 @@ class CreateMainWindow(QtWidgets.QMainWindow):
143
141
  if main_menu is not None:
144
142
  main_menu.addAction(printer)
145
143
  main_menu.addAction(export)
146
- main_menu.addAction(_quit)
144
+ main_menu.addAction(quit)
147
145
  else:
148
146
  msg = "Could not populate main menu, exiting"
149
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
147
+ QMessageBox.warning(self, "Creation Error", msg)
150
148
  logger.log.exception(msg)
151
- else:
152
- msg = "Could not create menu bar, exiting"
153
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
154
- logger.log.exception(msg)
155
- sys.exit(1)
156
149
 
157
- if menu_bar is not None:
158
150
  todo_menu = menu_bar.addMenu("&To-Do")
159
151
  if todo_menu is not None:
160
152
  todo_menu.addAction(add)
@@ -162,16 +154,10 @@ class CreateMainWindow(QtWidgets.QMainWindow):
162
154
  todo_menu.addAction(toggle)
163
155
  else:
164
156
  msg = "Could not populate to-do menu, exiting"
165
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
157
+ QMessageBox.warning(self, "Creation Error", msg)
166
158
  logger.log.exception(msg)
167
159
  sys.exit(1)
168
- else:
169
- msg = "Menu bar error, exiting"
170
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
171
- logger.log.exception(msg)
172
- sys.exit(1)
173
160
 
174
- if menu_bar is not None:
175
161
  list_menu = menu_bar.addMenu("&List")
176
162
  if list_menu is not None:
177
163
  list_menu.addAction(list_add)
@@ -180,80 +166,50 @@ class CreateMainWindow(QtWidgets.QMainWindow):
180
166
  list_menu.addAction(list_switch)
181
167
  else:
182
168
  msg = "Could not populate list menu, exiting"
183
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
169
+ QMessageBox.warning(self, "Creation Error", msg)
184
170
  logger.log.exception(msg)
185
171
  sys.exit(1)
186
- else:
187
- msg = "Menu bar error, exiting"
188
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
189
- logger.log.exception(msg)
190
- sys.exit(1)
191
172
 
192
- if menu_bar is not None:
193
173
  sync_menu = menu_bar.addMenu("&Sync")
194
174
  if sync_menu is not None:
195
175
  sync_menu.addAction(sync_pull)
196
176
  sync_menu.addAction(sync_push)
197
177
  else:
198
178
  msg = "Could not populate sync menu, exiting"
199
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
200
- logger.log.exception(msg)
201
- sys.exit(1)
202
- else:
203
- msg = "Menu bar error, exiting"
204
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
205
- logger.log.exception(msg)
206
- sys.exit(1)
207
-
208
- if menu_bar is not None:
209
- server_menu = menu_bar.addMenu("&Server")
210
- if server_menu is not None:
211
- server_menu.addAction(start_server)
212
- server_menu.addAction(stop_server)
213
- server_menu.addAction(change_port)
214
- server_menu.addAction(change_bind_address)
215
- else:
216
- msg = "Could not populate server menu, exiting"
217
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
179
+ QMessageBox.warning(self, "Creation Error", msg)
218
180
  logger.log.exception(msg)
219
181
  sys.exit(1)
220
- else:
221
- msg = "Menu bar error, exiting"
222
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
223
- logger.log.exception(msg)
224
- sys.exit(1)
225
182
 
226
- if menu_bar is not None:
227
183
  help_menu = menu_bar.addMenu("&Help")
228
184
  if help_menu is not None:
229
185
  help_menu.addAction(about)
230
186
  help_menu.addAction(about_qt)
231
187
  else:
232
188
  msg = "Could not populate help menu, exiting"
233
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
189
+ QMessageBox.warning(self, "Creation Error", msg)
234
190
  logger.log.exception(msg)
235
191
  sys.exit(1)
236
- else:
237
- msg = "Menu bar error, exiting"
238
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
239
- logger.log.exception(msg)
240
- sys.exit(1)
241
192
 
242
- # create action toolbar
243
- toolbar = self.addToolBar("To-Do Actions")
244
- if toolbar is not None:
245
- toolbar.addAction(add)
246
- toolbar.addAction(delete)
247
- toolbar.addAction(toggle)
248
- toolbar.addAction(_quit)
193
+ # create action toolbar
194
+ toolbar = self.addToolBar("To-Do Actions")
195
+ if toolbar is not None:
196
+ toolbar.addAction(add)
197
+ toolbar.addAction(delete)
198
+ toolbar.addAction(toggle)
199
+ toolbar.addAction(quit)
200
+ else:
201
+ msg = "Could not create toolbar, exiting"
202
+ QMessageBox.warning(self, "Creation Error", msg)
203
+ logger.log.exception(msg)
204
+ sys.exit(1)
249
205
  else:
250
- msg = "Could not create toolbar, exiting"
251
- QtWidgets.QMessageBox.warning(self, "Creation Error", msg)
206
+ msg = "Could not create menu bar, exiting"
207
+ QMessageBox.warning(self, "Creation Error", msg)
252
208
  logger.log.exception(msg)
253
209
  sys.exit(1)
254
210
 
255
211
  # create table, set it as central widget
256
- self.table = QtWidgets.QTableWidget(self)
212
+ self.table = QTableWidget(self)
257
213
  if self.table is not None:
258
214
  self.table.insertColumn(0)
259
215
  self.table.insertColumn(1)
@@ -263,45 +219,50 @@ class CreateMainWindow(QtWidgets.QMainWindow):
263
219
  self.setCentralWidget(self.table)
264
220
  else:
265
221
  msg = "Could not create to-do list table, exiting"
266
- QtWidgets.QMessageBox.critical(self, "Creation Error", msg)
222
+ QMessageBox.critical(self, "Creation Error", msg)
267
223
  logger.log.exception(msg)
268
224
  sys.exit(1)
269
225
 
270
226
  # create a status bar
271
- self.progressBar = QtWidgets.QProgressBar()
272
- self.statusBarLabel = QtWidgets.QLabel()
227
+ self.progressBar = QProgressBar()
228
+ self.statusBarLabel = QLabel()
273
229
  self.statusBar = self.statusBar()
274
230
  if self.statusBar is not None:
275
231
  self.statusBar.addPermanentWidget(self.progressBar)
276
232
  self.statusBar.addPermanentWidget(self.statusBarLabel, 1)
277
233
  else:
278
234
  msg = "Could not create status bar, exiting"
279
- QtWidgets.QMessageBox.critical(self, "Creation Error", msg)
235
+ QMessageBox.critical(self, "Creation Error", msg)
280
236
  logger.log.exception(msg)
281
237
  sys.exit(1)
282
238
 
283
- # create a system tray icon
284
- self.tray_icon = QtWidgets.QSystemTrayIcon(
285
- QtGui.QIcon("gui/icons/todo.png"), self
286
- )
287
- self.tray_icon.activated.connect(self.tray_event)
239
+ # system tray icon
240
+ self.tray_icon = QSystemTrayIcon(self)
241
+ self.tray_icon.setIcon(QIcon("gui/icons/todo.png"))
288
242
 
289
- tray_exit = QtWidgets.QAction(QtGui.QIcon(), "Exit", self.tray_icon)
290
- tray_exit.triggered.connect(self.close)
243
+ # system tray menu actions
244
+ show_action = QAction("Show", self)
245
+ quit_action = QAction("Exit", self)
246
+ hide_action = QAction("Hide", self)
247
+ show_action.triggered.connect(self.show)
248
+ hide_action.triggered.connect(self.hide)
249
+ quit_action.triggered.connect(self.close)
291
250
 
292
- tray_menu = QtWidgets.QMenu("&To-Do", self)
251
+ tray_menu = QMenu("&To-Do", self)
293
252
  if tray_menu is not None:
294
- tray_menu.addAction(tray_exit)
253
+ tray_menu.addAction(show_action)
254
+ tray_menu.addAction(hide_action)
255
+ tray_menu.addAction(quit_action)
295
256
  self.tray_icon.setContextMenu(tray_menu)
296
257
  self.tray_icon.show()
297
258
  else:
298
259
  msg = "Could not create status tray menu, exiting"
299
- QtWidgets.QMessageBox.critical(self, "Creation Error", msg)
260
+ QMessageBox.critical(self, "Creation Error", msg)
300
261
  logger.log.exception(msg)
301
262
  sys.exit(1)
302
263
 
303
- # create a printer if we can
304
- self.printer = QtPrintSupport.QPrinter()
264
+ # create a printer
265
+ self.printer = QPrinter()
305
266
 
306
267
  # show the window
307
268
  self.show()
@@ -321,7 +282,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
321
282
  self.update_status_bar("Reading in JSON data")
322
283
  result, msg = json_helpers.read_json_data()
323
284
  if not result:
324
- QtWidgets.QMessageBox.warning(self, "Read Error", str(msg))
285
+ QMessageBox.warning(self, "Read Error", str(msg))
325
286
  self.update_progress_bar()
326
287
  self.update_status_bar()
327
288
  else:
@@ -334,7 +295,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
334
295
  """Write to-do lists to a JSON file."""
335
296
  if len(settings.db.todo_lists.keys()) == 0:
336
297
  msg = "No to-do information, aborting write"
337
- QtWidgets.QMessageBox.warning(self, "Write Error", msg)
298
+ QMessageBox.warning(self, "Write Error", msg)
338
299
  return
339
300
 
340
301
  self.update_progress_bar(0)
@@ -342,7 +303,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
342
303
 
343
304
  result, msg = json_helpers.write_json_data()
344
305
  if not result:
345
- QtWidgets.QMessageBox.warning(self, "Write Error", msg)
306
+ QMessageBox.warning(self, "Write Error", msg)
346
307
  self.update_progress_bar()
347
308
  self.update_status_bar()
348
309
 
@@ -369,63 +330,55 @@ class CreateMainWindow(QtWidgets.QMainWindow):
369
330
  settings.db.active_list = list_name
370
331
  result, msg = settings.db.write_config()
371
332
  if not result:
372
- QtWidgets.QMessageBox.critical(self, "Write Error", msg)
333
+ QMessageBox.critical(self, "Write Error", msg)
373
334
  sys.exit(1)
374
335
  else:
375
- QtWidgets.QMessageBox.information(self, "Write Success", msg)
336
+ QMessageBox.information(self, "Write Success", msg)
376
337
 
377
338
  @error_on_none_db
378
339
  def db_start_server(self, *args, **kwargs):
379
340
  """Start the database server."""
380
341
  if settings.db.server_running():
381
- QtWidgets.QMessageBox.information(
342
+ QMessageBox.information(
382
343
  self, "Info", "The database server is already running."
383
344
  )
384
345
  else:
385
346
  settings.db.start_server()
386
- QtWidgets.QMessageBox.information(
387
- self, "Info", "The database server was started."
388
- )
347
+ QMessageBox.information(self, "Info", "The database server was started.")
389
348
  self.refresh()
390
349
 
391
350
  @error_on_none_db
392
351
  def db_stop_server(self, *args, **kwargs):
393
352
  """Stop the database server."""
394
353
  if not settings.db.server_running():
395
- QtWidgets.QMessageBox.information(
396
- self, "Info", "The database server is not running."
397
- )
354
+ QMessageBox.information(self, "Info", "The database server is not running.")
398
355
  else:
399
356
  settings.db.stop_server()
400
- QtWidgets.QMessageBox.information(
401
- self, "Info", "The database server was stopped."
402
- )
357
+ QMessageBox.information(self, "Info", "The database server was stopped.")
403
358
  self.refresh()
404
359
 
405
360
  @error_on_none_db
406
361
  def db_server_port(self, *args, **kwargs):
407
362
  """Change the port the database server listens too."""
408
- port, ok = QtWidgets.QInputDialog.getInt(
409
- self, "Change database server port", "Port: "
410
- )
363
+ port, ok = QInputDialog.getInt(self, "Change database server port", "Port: ")
411
364
  if not ok:
412
365
  return
413
366
 
414
367
  if settings.options["port"] == port:
415
- QtWidgets.QMessageBox.information(
368
+ QMessageBox.information(
416
369
  self, "Info", f"Server is already using port {port}"
417
370
  )
418
371
  else:
419
372
  settings.options["port"] = port
420
373
  if settings.db.server_running():
421
- reply = QtWidgets.QMessageBox.question(
374
+ reply = QMessageBox.question(
422
375
  self,
423
376
  "Restart Database Server?",
424
377
  "The server needs to be restarted for changes to take effect, would you like to do that now?",
425
- QtWidgets.QMessageBox.Yes,
426
- QtWidgets.QMessageBox.No,
378
+ QMessageBox.StandardButton.Yes,
379
+ QMessageBox.StandardButton.No,
427
380
  )
428
- if reply == QtWidgets.QMessageBox.Yes:
381
+ if reply == QMessageBox.StandardButton.Yes:
429
382
  settings.db.restart_server()
430
383
  settings.db.write_config()
431
384
  self.refresh()
@@ -433,27 +386,27 @@ class CreateMainWindow(QtWidgets.QMainWindow):
433
386
  @error_on_none_db
434
387
  def db_server_bind_address(self, *args, **kwargs):
435
388
  """Bind database server to an ip address."""
436
- address, ok = QtWidgets.QInputDialog.getText(
389
+ address, ok = QInputDialog.getText(
437
390
  self, "Change server ip address", "IP Address: "
438
391
  )
439
392
  if not ok:
440
393
  return
441
394
 
442
395
  if settings.options["address"] == address:
443
- QtWidgets.QMessageBox.information(
396
+ QMessageBox.information(
444
397
  self, "Info", f"Server is already bound to {address}"
445
398
  )
446
399
  else:
447
400
  settings.options["address"] = address
448
401
  if settings.db.server_running():
449
- reply = QtWidgets.QMessageBox.question(
402
+ reply = QMessageBox.question(
450
403
  self,
451
404
  "Restart Database Server?",
452
405
  "The server needs to be restarted for changes to take effect, would you like to do that now?",
453
- QtWidgets.QMessageBox.Yes,
454
- QtWidgets.QMessageBox.No,
406
+ QMessageBox.StandardButton.Yes,
407
+ QMessageBox.StandardButton.No,
455
408
  )
456
- if reply == QtWidgets.QMessageBox.Yes:
409
+ if reply == QMessageBox.StandardButton.Yes:
457
410
  settings.db.restart_server()
458
411
  settings.db.write_config()
459
412
  self.refresh()
@@ -464,7 +417,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
464
417
  self.update_progress_bar(0)
465
418
  self.update_status_bar("Waiting for input")
466
419
 
467
- list_name, ok = QtWidgets.QInputDialog.getText(
420
+ list_name, ok = QInputDialog.getText(
468
421
  self, "Add New List", "Enter a name for the new list: "
469
422
  )
470
423
  if ok:
@@ -480,7 +433,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
480
433
  settings.db.write_config()
481
434
  self.write_todo_data()
482
435
  else:
483
- QtWidgets.QMessageBox.warning(
436
+ QMessageBox.warning(
484
437
  self,
485
438
  "Duplicate List",
486
439
  f'A list named "{list_name}" already exists.',
@@ -495,7 +448,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
495
448
 
496
449
  # if there is more than one list, ask user which one to delete
497
450
  if len(settings.db.todo_lists.keys()) > 1:
498
- list_entry, ok = QtWidgets.QInputDialog.getItem(
451
+ list_entry, ok = QInputDialog.getItem(
499
452
  self,
500
453
  "Select List",
501
454
  "To-Do Lists: ",
@@ -517,14 +470,14 @@ class CreateMainWindow(QtWidgets.QMainWindow):
517
470
  self.write_todo_data()
518
471
  break
519
472
  else:
520
- reply = QtWidgets.QMessageBox.question(
473
+ reply = QMessageBox.question(
521
474
  self,
522
475
  "Confirm deletion",
523
476
  f'Really delete list "{settings.db.active_list}"?',
524
- QtWidgets.QMessageBox.Yes,
525
- QtWidgets.QMessageBox.No,
477
+ QMessageBox.StandardButton.Yes,
478
+ QMessageBox.StandardButton.No,
526
479
  )
527
- if reply == QtWidgets.QMessageBox.No:
480
+ if reply == QMessageBox.StandardButton.No:
528
481
  self.update_progress_bar()
529
482
  return
530
483
 
@@ -547,19 +500,19 @@ class CreateMainWindow(QtWidgets.QMainWindow):
547
500
  """Rename the active list"""
548
501
  self.update_progress_bar(0)
549
502
 
550
- list_name, ok = QtWidgets.QInputDialog.getText(
503
+ list_name, ok = QInputDialog.getText(
551
504
  self, "Rename to-do list", "Enter new name:"
552
505
  )
553
506
  if ok:
554
- reply = QtWidgets.QMessageBox.question(
507
+ reply = QMessageBox.question(
555
508
  self,
556
509
  "Confirm rename",
557
510
  f"Are you sure you want to rename list {settings.db.active_list} to {list_name}",
558
- QtWidgets.QMessageBox.Yes,
559
- QtWidgets.QMessageBox.No,
511
+ QMessageBox.StandardButton.Yes,
512
+ QMessageBox.StandardButton.No,
560
513
  )
561
514
 
562
- if reply == QtWidgets.QMessageBox.No:
515
+ if reply == QMessageBox.StandardButton.No:
563
516
  return
564
517
 
565
518
  settings.db.todo_lists[list_name] = settings.db.todo_lists[
@@ -583,7 +536,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
583
536
  if len(settings.db.todo_lists.keys()) == 0:
584
537
  return
585
538
 
586
- list_entry, ok = QtWidgets.QInputDialog.getItem(
539
+ list_entry, ok = QInputDialog.getItem(
587
540
  self, "Select List", "To-Do Lists: ", list(settings.db.todo_lists.keys())
588
541
  )
589
542
  if ok:
@@ -603,7 +556,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
603
556
  if fn is None:
604
557
  # prompt user for fn
605
558
  self.update_status_bar("Waiting for input")
606
- fn, ok = QtWidgets.QInputDialog.getText(
559
+ fn, ok = QInputDialog.getText(
607
560
  self,
608
561
  "Save list to text file",
609
562
  "Enter name of file to write as text:",
@@ -616,7 +569,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
616
569
  self.update_status_bar(f"finished exporting to {fn}.")
617
570
  self.update_progress_bar()
618
571
 
619
- def print_list(self):
572
+ def printlist(self):
620
573
  """Print the active list."""
621
574
  self.update_progress_bar(0)
622
575
 
@@ -627,7 +580,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
627
580
 
628
581
  tmp_fn = ".todo_printer.tmp"
629
582
 
630
- accept = QtPrintSupport.QPrintDialog(self.printer).exec()
583
+ accept = QPrintDialog(self.printer).exec()
631
584
  if accept:
632
585
  self.update_status_bar("Printing")
633
586
 
@@ -646,8 +599,8 @@ class CreateMainWindow(QtWidgets.QMainWindow):
646
599
  os.remove(tmp_fn)
647
600
 
648
601
  # Open string as a QTextDocument and then print it
649
- doc = QtGui.QTextDocument(string)
650
- doc.print_(self.printer)
602
+ doc = QTextDocument(string)
603
+ doc.print(self.printer)
651
604
 
652
605
  self.update_progress_bar()
653
606
  self.update_status_bar("finished printing")
@@ -659,7 +612,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
659
612
 
660
613
  if not settings.db.active_list:
661
614
  if settings.db.list_count == 0:
662
- QtWidgets.QMessageBox.information(
615
+ QMessageBox.information(
663
616
  self,
664
617
  "No list",
665
618
  "You need to create a list before you add a reminder",
@@ -670,17 +623,17 @@ class CreateMainWindow(QtWidgets.QMainWindow):
670
623
  else:
671
624
  # ask the user if they would like to switch to an existing list
672
625
  self.update_status_bar("Waiting for input")
673
- reply = QtWidgets.QMessageBox.question(
626
+ reply = QMessageBox.question(
674
627
  self,
675
628
  "Set an active list",
676
629
  "There is currently no active list set, but lists do exist,"
677
630
  "would you like to switch to one of them?",
678
- QtWidgets.QMessageBox.Yes,
679
- QtWidgets.QMessageBox.No,
631
+ QMessageBox.StandardButton.Yes,
632
+ QMessageBox.StandardButton.No,
680
633
  )
681
634
 
682
635
  # check the user response
683
- if reply == QtWidgets.QMessageBox.Yes:
636
+ if reply == QMessageBox.StandardButton.Yes:
684
637
  self.switch_list()
685
638
  else:
686
639
  return
@@ -697,13 +650,13 @@ class CreateMainWindow(QtWidgets.QMainWindow):
697
650
 
698
651
  if self.table is None:
699
652
  msg = "To-Do List Table is invalid, exiting"
700
- QtWidgets.QMessageBox.critical(self, "To-Do List Error", msg)
653
+ QMessageBox.critical(self, "To-Do List Error", msg)
701
654
  logger.log.exception(msg)
702
655
  sys.exit(1)
703
656
  else:
704
657
  if self.table.selectionModel().hasSelection():
705
658
  indices = [
706
- QtCore.QPersistentModelIndex(index)
659
+ QPersistentModelIndex(index)
707
660
  for index in self.table.selectionModel().selectedIndexes()
708
661
  ]
709
662
  for index in indices:
@@ -717,9 +670,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
717
670
  self.table.removeRow(index.row())
718
671
  self.refresh()
719
672
  else:
720
- QtWidgets.QMessageBox.warning(
721
- self, "Delete To-Do", "No reminders selected."
722
- )
673
+ QMessageBox.warning(self, "Delete To-Do", "No reminders selected.")
723
674
 
724
675
  @error_on_none_db
725
676
  def toggle_todo(self, *args, **kwargs):
@@ -779,16 +730,16 @@ class CreateMainWindow(QtWidgets.QMainWindow):
779
730
  <br><br>License: <a href="http://www.fsf.org/licenses/gpl.html">GPLv3</a>
780
731
  <br><br><b>Copyright (C) 2024 Michael Berry</b>
781
732
  """
782
- QtWidgets.QMessageBox.about(self, "About To-Do", text)
733
+ QMessageBox.about(self, "About To-Do", text)
783
734
 
784
735
  def about_qt(self):
785
736
  """Display information about Qt."""
786
- QtWidgets.QMessageBox.aboutQt(self, "About Qt")
737
+ QMessageBox.aboutQt(self, "About Qt")
787
738
 
788
739
  def center(self):
789
740
  """Place the main window in the center of the screen."""
790
741
  qt_rectangle = self.frameGeometry()
791
- center_point = QtWidgets.QDesktopWidget().availableGeometry().center()
742
+ center_point = self.screen().availableGeometry().center()
792
743
  qt_rectangle.moveCenter(center_point)
793
744
  self.move(qt_rectangle.topLeft())
794
745
 
@@ -857,7 +808,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
857
808
 
858
809
  for todo in settings.db.todo_lists[settings.db.active_list]:
859
810
  # create priority table item
860
- item_p = QtWidgets.QComboBox(self)
811
+ item_p = QComboBox(self)
861
812
  item_p.addItems(["Low", "Normal", "High"])
862
813
  item_p.currentIndexChanged.connect(self.change_priority)
863
814
  if todo["priority"] == 1:
@@ -868,7 +819,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
868
819
  item_p.setCurrentIndex(0)
869
820
 
870
821
  # create reminder table item
871
- item_r = QtWidgets.QLineEdit(todo["reminder"])
822
+ item_r = QLineEdit(todo["reminder"])
872
823
  item_r.returnPressed.connect(self.edit_reminder)
873
824
 
874
825
  # set the font
@@ -893,9 +844,9 @@ class CreateMainWindow(QtWidgets.QMainWindow):
893
844
  self.update_progress_bar()
894
845
  self.update_status_bar()
895
846
 
896
- def tray_event(self, reason=QtWidgets.QSystemTrayIcon.activated, *args, **kwargs):
847
+ def tray_event(self, reason=QSystemTrayIcon.activated, *args, **kwargs):
897
848
  """Hide the main window when the system tray icon is clicked."""
898
- if reason == QtWidgets.QSystemTrayIcon.activated:
849
+ if reason == QSystemTrayIcon.activated:
899
850
  if self.isVisible():
900
851
  self.hide()
901
852
  else:
@@ -907,7 +858,7 @@ class CreateMainWindow(QtWidgets.QMainWindow):
907
858
  # save configuration
908
859
  result, msg = settings.db.write_config()
909
860
  if not result:
910
- QtWidgets.QMessageBox.warning(self, "Write Error", msg)
861
+ QMessageBox.warning(self, "Write Error", msg)
911
862
 
912
863
  # save todo lists
913
864
  self.write_todo_data()
todo/gui/SyncDialog.py CHANGED
@@ -3,19 +3,25 @@
3
3
  Simple dialog to collect information needed to perform a sync operation.
4
4
  """
5
5
 
6
- import sys
6
+ from PyQt6.QtWidgets import (
7
+ QDialog,
8
+ QLabel,
9
+ QLineEdit,
10
+ QPushButton,
11
+ QVBoxLayout,
12
+ QMessageBox,
13
+ )
14
+ from PyQt6.QtGui import QIntValidator
7
15
 
8
- from PyQt5 import QtGui, QtWidgets
9
-
10
- from todo.core import error_on_none_db, settings
11
- from todo.core.Logger import Logger
12
- from todo.net.sync_operations import sync_operations
16
+ from ..core import error_on_none_db, settings
17
+ from ..core.Logger import Logger
18
+ from ..net.sync_operations import sync_operations
13
19
 
14
20
 
15
21
  logger = Logger(__name__)
16
22
 
17
23
 
18
- class SyncDialog(QtWidgets.QDialog):
24
+ class SyncDialog(QDialog):
19
25
  """Synchronize lists with remotes."""
20
26
 
21
27
  def __init__(self, operation=None):
@@ -30,21 +36,21 @@ class SyncDialog(QtWidgets.QDialog):
30
36
  self.operation = operation
31
37
 
32
38
  # address
33
- address_label = QtWidgets.QLabel("Host Address", self)
34
- self.address_field = QtWidgets.QLineEdit(self)
39
+ address_label = QLabel("Host Address", self)
40
+ self.address_field = QLineEdit(self)
35
41
 
36
42
  # port
37
- port_label = QtWidgets.QLabel("Port", self)
38
- self.port_field = QtWidgets.QLineEdit(self)
43
+ port_label = QLabel("Port", self)
44
+ self.port_field = QLineEdit(self)
39
45
  self.port_field.setText(str(settings.options["port"]))
40
- self.port_field.setValidator(QtGui.QIntValidator())
46
+ self.port_field.setValidator(QIntValidator())
41
47
 
42
48
  # add button
43
- self.get_button = QtWidgets.QPushButton("Synchronize", self)
49
+ self.get_button = QPushButton("Synchronize", self)
44
50
  self.get_button.clicked.connect(self.get_host)
45
51
 
46
52
  # create a vertical box layout
47
- v_box = QtWidgets.QVBoxLayout()
53
+ v_box = QVBoxLayout()
48
54
  v_box.addWidget(address_label)
49
55
  v_box.addWidget(self.address_field)
50
56
  v_box.addWidget(port_label)
@@ -63,17 +69,13 @@ class SyncDialog(QtWidgets.QDialog):
63
69
  """Get host information."""
64
70
  address = self.address_field.text()
65
71
  if address == "":
66
- QtWidgets.QMessageBox.information(
67
- self, "Empty address", "Address cannot be empty"
68
- )
72
+ QMessageBox.information(self, "Empty address", "Address cannot be empty")
69
73
  return
70
74
 
71
75
  # get remote port
72
76
  port = self.port_field.text()
73
77
  if port == "":
74
- QtWidgets.QMessageBox.information(
75
- self, "Empty port", "Port cannot be empty"
76
- )
78
+ QMessageBox.information(self, "Empty port", "Port cannot be empty")
77
79
  return
78
80
 
79
81
  port = int(port)
@@ -82,7 +84,7 @@ class SyncDialog(QtWidgets.QDialog):
82
84
  if self.operation == sync_operations["PULL_REQUEST"].name:
83
85
  # try the pull, inform user of the results
84
86
  result, msg = settings.db.sync_pull((address, port))
85
- QtWidgets.QMessageBox.information(self, "Sync Pull", msg)
87
+ QMessageBox.information(self, "Sync Pull", msg)
86
88
  if not result:
87
89
  return
88
90
  elif self.operation == sync_operations["PUSH_REQUEST"].name:
@@ -93,7 +95,7 @@ class SyncDialog(QtWidgets.QDialog):
93
95
 
94
96
  # try the push, inform user of results
95
97
  result, msg = settings.db.sync_push((address, port))
96
- QtWidgets.QMessageBox.information(self, "Sync Push", msg)
98
+ QMessageBox.information(self, "Sync Push", msg)
97
99
  if not pull_ok:
98
100
  settings.options["pull"] = False
99
101
 
todo/net/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  A small TCP socket reader with a simple progress bar.
4
4
  """
5
5
 
6
- from PyQt5 import QtWidgets, QtCore
6
+ from PyQt6 import QtWidgets, QtCore
7
7
 
8
8
 
9
9
  def recv_all(sock, size):
@@ -8,12 +8,11 @@ import os
8
8
  import socket
9
9
  import time
10
10
 
11
- from todo.core import settings, json_helpers
12
- from todo.core.Logger import Logger
13
- from todo.crypto.AESCipher import AESCipher
14
- from todo.net.sync_operations import sync_operations
15
-
16
- from . import recv_all
11
+ from ..core import settings, json_helpers
12
+ from ..core.Logger import Logger
13
+ from ..crypto.AESCipher import AESCipher
14
+ from ..net import recv_all
15
+ from ..net.sync_operations import sync_operations
17
16
 
18
17
 
19
18
  logger = Logger(__name__)
@@ -9,11 +9,12 @@ import socketserver
9
9
  import sys
10
10
  import time
11
11
 
12
- from PyQt5 import QtWidgets
13
- from todo.core import error_on_none_db, settings
14
- from todo.core.Logger import Logger
15
- from todo.crypto.AESCipher import AESCipher
16
- from todo.net.sync_operations import sync_operations
12
+ from PyQt6.QtWidgets import QMessageBox
13
+
14
+ from ..core import error_on_none_db, settings
15
+ from ..core.Logger import Logger
16
+ from ..crypto.AESCipher import AESCipher
17
+ from ..net.sync_operations import sync_operations
17
18
 
18
19
 
19
20
  logger = Logger(__name__)
@@ -115,7 +116,7 @@ class TCPRequestHandler(socketserver.StreamRequestHandler):
115
116
  sync_operations["REJECT"].name
116
117
  )
117
118
  self.request.send(self.encrypted_reply)
118
- QtWidgets.QMessageBox.warning(None, "Push Sync", msg)
119
+ QMessageBox.warning(None, "Push Sync", msg)
119
120
  logger.log.warning(msg)
120
121
  return
121
122
 
@@ -127,7 +128,7 @@ class TCPRequestHandler(socketserver.StreamRequestHandler):
127
128
  self.host = (self.peer_name[0], settings.options["port"])
128
129
  else:
129
130
  msg = "Not performing push sync, no host peer"
130
- QtWidgets.QMessageBox.warning(None, "Push Sync", msg)
131
+ QMessageBox.warning(None, "Push Sync", msg)
131
132
  logger.log.warning(msg)
132
133
  return
133
134
 
@@ -1,26 +0,0 @@
1
- todo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- todo/__main__.py,sha256=71QnTJRRMg-gx4xjTyhoXkYM5idgnb2WnlsVRLn_fqk,3190
3
- todo/core/Logger.py,sha256=xx9V4Dq54hDg7TmkEY-FvkUl4cTITUn8NHe1wTCX72w,1261
4
- todo/core/TodoDataBase.py,sha256=y1etUExcdHZ85GhYQWQvTWGBRh3b-7oLet6IcRVjDd4,8323
5
- todo/core/__init__.py,sha256=FUqE5ViWxy7Sn_n3pxfJrpKRJY21ry2FuJwD7T16AZY,900
6
- todo/core/json_helpers.py,sha256=h3CXVbbQ4KrMvrpEcsekZxQNqBi7JUSk6IZpbG9C9co,2879
7
- todo/core/settings.py,sha256=c_eiX9bf9tCpZAsz_2mq4JejgcJ_Z71R15_bVLPn-Po,627
8
- todo/crypto/AESCipher.py,sha256=cf7YBbxN-K8czTIrXuLVeEGpo5quVn3TNArol1o9JRU,1768
9
- todo/crypto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- todo/gui/AddTodoDialog.py,sha256=kUYbMOqpkGLVSYcClXfu1HO6E4SuGMtVCjTleNPZQjw,2624
11
- todo/gui/MainWindow.py,sha256=bLyX105tUqOJ9f5Uad0A4JsPUc1Vmkt3jF_CqUhuxIc,33511
12
- todo/gui/SyncDialog.py,sha256=nqW_khAFQ6PcEveHgDDrSVGsjpdCUaI7z4MDagoALv8,3206
13
- todo/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- todo/gui/icons/minus.png,sha256=PoaZl2RAW8wrkOBvz7bY03xEAdaBNd6HNKaodHbgdMc,217
15
- todo/gui/icons/plus.png,sha256=VywdidKhN2IdJLPkBVQB3O2GmFXzfSDMV1rLkpKDoGg,287
16
- todo/gui/icons/todo.png,sha256=kBRWlulLIqDxB5-XtlCz-OYhzrjyj5eEWN36nXWMYzI,659
17
- todo/net/__init__.py,sha256=-PEFQDpZYUD-aHhMYpJE1NMh92J831ifUCfs10rP5gc,538
18
- todo/net/sync_operations.py,sha256=TSa7p-tgdd6jiwcQ1Cy3PNJw26eqRlVRrYFqLc9LNz8,279
19
- todo/net/tcp_client_lib.py,sha256=wcMwfSuZ2EFfF6AaAjYnvOR4xyjheZUqf_hwCALRGiw,4478
20
- todo/net/tcp_server_lib.py,sha256=tEvDlc6eZTfZ-iCQEhzhWhu94Hdaw_snkeUcMKsXcsE,4638
21
- pytodo_qt-0.2.0.dist-info/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
22
- pytodo_qt-0.2.0.dist-info/METADATA,sha256=S_kYzdnr2X8G7iES0e8dZLNA5gDt1-XFUEXEWIkamYc,1528
23
- pytodo_qt-0.2.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
24
- pytodo_qt-0.2.0.dist-info/entry_points.txt,sha256=ywI6kRYcR3cVBDg62_kvFicV4FPmk9ItG6jEKndNXqg,44
25
- pytodo_qt-0.2.0.dist-info/top_level.txt,sha256=c1x0MAVpTPy2QFoNZ9fz48_PoX9pcGKJOwNu8vee_hs,5
26
- pytodo_qt-0.2.0.dist-info/RECORD,,