An error occurred while loading the file. Please try again.
-
Pierre-Antoine Rouby authored
* src/config.py: Application config class. * src/pamhyr.py: Add app config. * src/view/ASubWindow.py: Add some methods. * src/view/ConfigureWindow.py: New app sub window. * src/view/MainWindow.py: Minor change. * src/view/ui/ConfigureDialog.ui: New ui. * src/view/ui/MainWindow.ui: Start rename some component. * src/view/ui/MainWindow_old.ui: Old version of main UI.
cb5ee1b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# -*- coding: utf-8 -*-
from tools import trace, timer
from Model.DB import SQLSubModel
class Stricklers(SQLSubModel):
def __init__(self, name:str = "",
comment:str = "",
minor:float = 35.0,
medium:float = 15.0,
status = None):
super(Stricklers, self).__init__()
self._status = status
self._name = name
self._comment = comment
self._minor = minor
self._medium = medium
@classmethod
def _sql_create(cls, execute):
execute("""
CREATE TABLE stricklers(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT,
comment TEXT,
minor REAL NOT NULL,
medium REAL NOT NULL
)
""")
return cls._create_submodel(execute)
@classmethod
def _sql_update(cls, execute, version):
return cls._update_submodel(execute, version)
@classmethod
def _sql_load(cls, execute, data = None):
stricklers = []
status = data["status"]
table = execute(
"SELECT name, comment, minor, medium " +
"FROM stricklers"
)
for row in table:
name = row[0]
comment = row[1]
minor = row[2]
medium = row[3]
new = cls(
name = name,
comment = comment,
minor = minor, medium = medium,
status = status
)
stricklers.append(new)
return stricklers
def _sql_save(self, execute, data = None):
sql = (
"INSERT INTO " +
"stricklers(name, comment, minor, medium) "+
"VALUES (" +
f"'{self._sql_format(self.name)}', " +
f"'{self._sql_format(self.comment)}', " +
f"{float(self.minor)}, {float(self.medium)}" +
")"
)
execute(sql)
return True
def __str__(self):
if self._name != "":
return f"{self._name} ({self._minor}, {self._medium})"
return f"({self._minor}, {self._medium})"
@property
def name(self):
return self._name
@name.setter
def name(self, name):
self._name = name
@property
def comment(self):
return self._comment
@comment.setter
def comment(self, comment):
self._comment = comment
@property
def minor(self):
return self._minor
@minor.setter
def minor(self, minor):
self._minor = int(minor)
@property
def medium(self):
return self._medium
@medium.setter
def medium(self, medium):
self._medium = int(medium)