Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
hakandundar34coding committed Apr 9, 2022
1 parent 45dbc75 commit c29ae3a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# System Monitoring Center

### v1.10.1
### v1.10.2
* Improved: Getting ARM CPU model names
* Improved: Device vendor-model detection
* Fix: Detect window manager of GNOME DE
Expand Down
5 changes: 5 additions & 0 deletions integration/system-monitoring-center
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3

import sys
sys.path.insert(0, '/usr/share/system-monitoring-center/src/')
import Main
25 changes: 13 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ def files_in_folder(folder):


data_files = [
("/systemmonitoringcenter/applications/", ["integration/com.github.hakand34.system-monitoring-center.desktop"]),
("/systemmonitoringcenter/locale/cs/LC_MESSAGES/", ["locale/cs/system-monitoring-center.mo"]),
("/systemmonitoringcenter/locale/pl/LC_MESSAGES/", ["locale/pl/system-monitoring-center.mo"]),
("/systemmonitoringcenter/locale/pt_BR/LC_MESSAGES/", ["locale/pt_BR/system-monitoring-center.mo"]),
("/systemmonitoringcenter/locale/tr/LC_MESSAGES/", ["locale/tr/system-monitoring-center.mo"]),
("/systemmonitoringcenter/database/", files_in_folder("database/")),
("/systemmonitoringcenter/src/", files_in_folder("src/")),
("/systemmonitoringcenter/ui/", files_in_folder("ui/")),
("/systemmonitoringcenter/icons/hicolor/scalable/actions/", files_in_folder("icons/hicolor/scalable/actions/")),
("/systemmonitoringcenter/icons/hicolor/scalable/apps/", ["icons/hicolor/scalable/apps/system-monitoring-center.svg"]),
("/usr/share/applications/", ["integration/com.github.hakand34.system-monitoring-center.desktop"]),
("/usr/share/system-monitoring-center/locale/cs/LC_MESSAGES/", ["locale/cs/system-monitoring-center.mo"]),
("/usr/share/system-monitoring-center/locale/pl/LC_MESSAGES/", ["locale/pl/system-monitoring-center.mo"]),
("/usr/share/system-monitoring-center/locale/pt_BR/LC_MESSAGES/", ["locale/pt_BR/system-monitoring-center.mo"]),
("/usr/share/system-monitoring-center/locale/tr/LC_MESSAGES/", ["locale/tr/system-monitoring-center.mo"]),
("/usr/share/system-monitoring-center/database/", files_in_folder("database/")),
("/usr/share/system-monitoring-center/src/", files_in_folder("src/")),
("/usr/share/system-monitoring-center/ui/", files_in_folder("ui/")),
("/usr/share/icons/hicolor/scalable/actions/", files_in_folder("icons/hicolor/scalable/actions/")),
("/usr/share/icons/hicolor/scalable/apps/", ["icons/hicolor/scalable/apps/system-monitoring-center.svg"]),
("/usr/share/man/man1/", ["man/system-monitoring-center.1.gz"]),
("/usr/bin/", ["integration/system-monitoring-center"])
]


Expand All @@ -38,11 +40,10 @@ def files_in_folder(folder):
url="https://github.com/hakandundar34coding/system-monitoring-center",
keywords="system monitor task manager center performance speed frequency usage cpu ram swap memory storage network download fps ratio processes users startup services os",
license="GPLv3",
install_requires=["PyGObject", "pycairo"],
install_requires=["PyGObject"],
python_requires=">=3.6",
packages=find_packages(),
data_files=data_files,
entry_points={"gui_scripts": ["system-monitoring-center = systemmonitoringcenter.start:start_app"]},
classifiers=[
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
Expand Down
24 changes: 16 additions & 8 deletions src/MainGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,15 @@ def main_gui_application_system_integration_func(self):
current_dir = os.path.dirname(os.path.realpath(__file__))
current_user_homedir = os.environ.get('HOME')

# Prevent running this function if the application code is in "/usr/lib/" folder which means the application is a Python application and packaged for a distribution package manager and it has a desktop file after installation.
if current_dir.startswith("/usr/lib/") == True:
return

# This file is used for checking if symlinks are copied before.
file_to_check_if_generated = current_user_homedir + "/.local/share/applications/com.github.hakand34.system-monitoring-center.desktop"

# Get icon list.
try:
icon_list = os.listdir(current_dir + "/../icons/hicolor/scalable/actions")
except FileNotFoundError:
icon_list = os.listdir("/usr/share/icons/hicolor/scalable/actions")

# Called for removing files.
def remove_file(file):
try:
Expand Down Expand Up @@ -521,20 +523,26 @@ def generate_symlink(source, target):
remove_file(current_user_homedir + "/.local/share/applications/com.github.hakand34.system-monitoring-center.desktop")
remove_file(current_user_homedir + "/.local/share/icons/hicolor/scalable/apps/system-monitoring-center.svg")
for file in os.listdir(current_user_homedir + "/.local/share/icons/hicolor/scalable/actions"):
remove_file(file)
if file in icon_list:
remove_file(file)

# Check if symlinks are not copied before.
if os.path.isfile(file_to_check_if_generated) == False:
else:

# Try to remove previous symlinks ("isfile" check gives "False" if there are symlinks and targets are removed. Example cases: If the application is removed from user-specific directory and installed into system-wide directory or vice versa.).
remove_file(current_user_homedir + "/.local/share/applications/com.github.hakand34.system-monitoring-center.desktop")
remove_file(current_user_homedir + "/.local/share/icons/hicolor/scalable/apps/system-monitoring-center.svg")
try:
for file in os.listdir(current_user_homedir + "/.local/share/icons/hicolor/scalable/actions"):
remove_file(current_user_homedir + "/.local/share/icons/hicolor/scalable/actions/" + file)
if file in icon_list:
remove_file(current_user_homedir + "/.local/share/icons/hicolor/scalable/actions/" + file)
except Exception:
pass

# Prevent running rest of this function if the application code is in "/usr/lib/" folder which means the application is a Python application and packaged for a distribution package manager and it has a desktop file after installation.
if current_dir.startswith("/usr/lib/") == True or current_dir.startswith("/usr/share/") == True:
return

# Generate folders.
generate_folder(current_user_homedir + "/.local/share/applications")
generate_folder(current_user_homedir + "/.local/share/icons/hicolor/scalable/apps")
Expand All @@ -544,7 +552,7 @@ def generate_symlink(source, target):
generate_symlink(current_dir + "/../applications/com.github.hakand34.system-monitoring-center.desktop", current_user_homedir + "/.local/share/applications/com.github.hakand34.system-monitoring-center.desktop")
generate_symlink(current_dir + "/../icons/hicolor/scalable/apps/system-monitoring-center.svg", current_user_homedir + "/.local/share/icons/hicolor/scalable/apps/system-monitoring-center.svg")
target_path = current_user_homedir + "/.local/share/icons/hicolor/scalable/actions"
for file in os.listdir(current_dir + "/../icons/hicolor/scalable/actions"):
for file in icon_list:
generate_symlink(current_dir + "/../icons/hicolor/scalable/actions/" + file, target_path + "/" + file)


Expand Down
2 changes: 1 addition & 1 deletion src/__version__
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.1
1.10.2

0 comments on commit c29ae3a

Please sign in to comment.