1
1
# v4 UI STATUS - BRAND NEW
2
2
# ************************
3
3
4
- import os
5
-
6
- from PyQt6 .QtGui import QAction , QIcon
4
+ from PyQt6 .QtGui import QAction
7
5
from PyQt6 .QtWidgets import QStyle
8
6
9
-
10
- ICON_DIRECTORY = os .path .join ("../icons" )
11
- ICON_FILE_EXTENSION = ".png"
7
+ from ui .icons import get_custom_icon
12
8
13
9
14
10
class Actions :
15
11
def __init__ (self , style : QStyle ):
16
12
self ._style = style
17
- assert os .path .isdir (ICON_DIRECTORY )
18
13
19
14
# REAL
20
15
self .open_file = QAction ("Open" )
21
16
self .open_file .setShortcut ("Ctrl+O" )
22
17
self .open_file .setStatusTip ("Open log file(s)" )
23
- self .open_file .setIcon (self . get_custom_icon ("open_file" ))
18
+ self .open_file .setIcon (get_custom_icon ("open_file" ))
24
19
25
20
self .file_info = QAction ("Info" )
26
21
self .file_info .setShortcut ("Ctrl+I" )
27
22
self .file_info .setStatusTip ("Get information about the currently open log file(s)" )
28
- self .file_info .setIcon (self . get_custom_icon ("file_info" ))
23
+ self .file_info .setIcon (get_custom_icon ("file_info" ))
29
24
30
25
self .change_log_directory = QAction ("Directory" )
31
26
self .change_log_directory .setShortcut ("Ctrl+D" )
32
27
self .change_log_directory .setStatusTip ("Change log file source directory" )
33
- self .change_log_directory .setIcon (self . get_custom_icon ("change_log_directory" ))
28
+ self .change_log_directory .setIcon (get_custom_icon ("change_log_directory" ))
34
29
35
30
self .set_file_options = QAction ("Options" )
36
31
self .set_file_options .setStatusTip ("Set special options for opening log file(s)" )
@@ -39,11 +34,4 @@ def __init__(self, style: QStyle):
39
34
self .exit .setStatusTip ("Exit application" )
40
35
41
36
# Example of how to set a standard icon when I need to ....
42
-
43
37
# self.change_log_directory.setIcon(style.standardIcon(QStyle.StandardPixmap.SP_DirIcon))
44
-
45
- @staticmethod
46
- def get_custom_icon (icon_name : str ):
47
- file_path = os .path .join (ICON_DIRECTORY , icon_name + ".png" )
48
- assert os .path .isfile (file_path )
49
- return QIcon (file_path )
0 commit comments