@@ -55,7 +55,8 @@ def log_uncaught_exceptions(ex_cls, ex, tb):
55
55
sys .excepthook = log_uncaught_exceptions
56
56
57
57
58
- WINDOW_TITLE = DIR .name
58
+ WINDOW_TITLE : str = DIR .name
59
+ DATE_FORMAT : str = "%d/%m/%Y"
59
60
60
61
61
62
def get_table_widget (header_labels : list ) -> QTableWidget :
@@ -116,7 +117,7 @@ def refresh(self, items: list[Run]):
116
117
for i , run in enumerate (items ):
117
118
self .table_run .setRowCount (self .table_run .rowCount () + 1 )
118
119
119
- item = QTableWidgetItem (run .date .strftime ("%d/%m/%Y" ))
120
+ item = QTableWidgetItem (run .date .strftime (DATE_FORMAT ))
120
121
item .setData (Qt .UserRole , run .get_project_by_issue_numbers ())
121
122
self .table_run .setItem (i , 0 , item )
122
123
@@ -219,11 +220,11 @@ def refresh(self):
219
220
220
221
221
222
class MyChartViewToolTips (ChartViewToolTips ):
222
- def __init__ (self , timestamp_by_run : dict ):
223
+ def __init__ (self , timestamp_by_run : dict [ int , Run ] ):
223
224
super ().__init__ ()
224
225
225
226
self ._callout_font_family = "Courier"
226
- self .timestamp_by_run = timestamp_by_run
227
+ self .timestamp_by_run : dict [ int , Run ] = timestamp_by_run
227
228
228
229
def show_series_tooltip (self , point , state : bool ):
229
230
# value -> pos
@@ -245,10 +246,16 @@ def show_series_tooltip(self, point, state: bool):
245
246
)
246
247
247
248
if current_distance < distance :
248
- date_value = int (p_value .x ())
249
- run = self .timestamp_by_run [date_value ]
249
+ time_ms = int (p_value .x ())
250
+ run = self .timestamp_by_run [time_ms ]
250
251
table = get_table (run .get_project_by_issue_numbers ())
251
- text = f"Total issues: { run .get_total_issues ()} \n \n { table } "
252
+ text = (
253
+ f"{ date .fromtimestamp (time_ms / 1000 ).strftime (DATE_FORMAT )} "
254
+ "\n \n "
255
+ f"Total issues: { run .get_total_issues ()} "
256
+ "\n "
257
+ f"{ table } "
258
+ )
252
259
253
260
self ._tooltip .setText (text )
254
261
self ._tooltip .setAnchor (p_value )
@@ -269,7 +276,7 @@ def __init__(self):
269
276
icon = QIcon (file_name )
270
277
self .setWindowIcon (icon )
271
278
272
- self .timestamp_by_run = dict ()
279
+ self .timestamp_by_run : dict [ int , Run ] = dict ()
273
280
274
281
menu = QMenu ()
275
282
menu .addAction ("Show / hide" , (lambda : self .setVisible (not self .isVisible ())))
0 commit comments