Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 845138f

Browse files
author
Raven
committed
Changes for v1.1.0
1 parent 8896ad2 commit 845138f

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

resmon.png

1.39 KB
Loading

resmon.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import importlib.util
99

1010
from PyQt5.QtCore import Qt, QThread, pyqtSignal
11-
from PyQt5.QtGui import QFont
11+
from PyQt5.QtGui import QIcon, QFont
1212
from PyQt5.QtWidgets import (
1313
QApplication, QMainWindow, QVBoxLayout, QHBoxLayout, QAction, QWidget,
1414
QDialog, QLineEdit, QFormLayout, QDialogButtonBox, QMessageBox, QMenu,
@@ -19,10 +19,30 @@
1919

2020

2121

22-
""" Utility function to load plugins """
22+
""" Utility function to load icons """
23+
def load_icon(icon_name):
24+
icon_path = os.path.join(os.path.dirname(__file__), icon_name)
25+
if getattr(sys, 'frozen', False):
26+
icon_path = os.path.join(sys._MEIPASS, icon_name)
27+
if os.path.exists(icon_path):
28+
return QIcon(icon_path)
29+
return None
30+
31+
32+
33+
""" Utility function to load plugins
34+
35+
This function checks for a "Resmonplugins" directory located in your user folder.
36+
If the folder doesn't exist, it creates it. It then loads every Python file in the
37+
folder (ignoring files starting with an underscore) and, if the module defines a
38+
"register_plugin(app_context)" function, calls it. The app_context is a dictionary
39+
containing a reference to the main window, so plugins can integrate with Construct
40+
(e.g., by adding menu items). Plugins should be written in Python. They do not
41+
require a separate Python installation.
42+
"""
2343
def load_plugins(app_context):
2444
user_home = os.path.expanduser("~")
25-
plugins_dir = os.path.join(user_home, "rmplugins")
45+
plugins_dir = os.path.join(user_home, "resmonplugins")
2646
os.makedirs(plugins_dir, exist_ok=True)
2747
loaded_plugins = []
2848
for filename in os.listdir(plugins_dir):
@@ -162,6 +182,7 @@ class Resmon(QMainWindow):
162182
def __init__(self):
163183
super().__init__()
164184
self.setWindowTitle("Resmon")
185+
self.setWindowIcon(load_icon('resmon.png'))
165186
self.setGeometry(100, 100, 770, 700)
166187
self.always_on_top = False
167188
self.selected_pid = None

0 commit comments

Comments
 (0)