Kaydet (Commit) 5aec9a42 authored tarafından Hakan Dündar's avatar Hakan Dündar

Several improvements

üst b4bbe6fe
......@@ -21,9 +21,9 @@ def files_in_folder(folder):
file_paths.append(folder + file)
return file_paths
PREFIX="/usr"
PREFIX = "/usr"
if "--flatpak" in sys.argv:
PREFIX="/app"
PREFIX = "/app"
sys.argv.remove("--flatpak")
if PREFIX == "/app":
......@@ -33,16 +33,34 @@ if PREFIX == "/app":
for icon in icon_list:
os.rename("icons/actions/" + icon, "icons/actions/tr.org.pardus.pkexec.system-monitoring-center." + icon.split("system-monitoring-center-")[-1])
data_files = [
(f"{PREFIX}/share/applications/", ["integration/tr.org.pardus.pkexec.system-monitoring-center.desktop"]),
(f"{PREFIX}/share/locale/tr/LC_MESSAGES/", ["translations/tr/system-monitoring-center.mo"]),
(f"{PREFIX}/share/system-monitoring-center/src/", files_in_folder("src/")),
(f"{PREFIX}/share/system-monitoring-center/ui/", files_in_folder("ui/")),
(f"{PREFIX}/share/icons/hicolor/scalable/actions/", files_in_folder("icons/actions/")),
(f"{PREFIX}/share/icons/hicolor/scalable/apps/", ["icons/apps/tr.org.pardus.pkexec.system-monitoring-center.svg"]),
(f"{PREFIX}/share/polkit-1/actions/", ["integration/tr.org.pardus.pkexec.system-monitoring-center.policy"]),
(f"{PREFIX}/bin/", ["integration/system-monitoring-center"])
]
with open("integration/tr.org.pardus.pkexec.system-monitoring-center.desktop") as reader:
desktop_file_content = reader.read()
desktop_file_content = desktop_file_content.replace("Icon=system-monitoring-center", "Icon=tr.org.pardus.pkexec.system-monitoring-center")
with open("integration/tr.org.pardus.pkexec.system-monitoring-center.desktop", "w") as writer:
writer.write(desktop_file_content)
data_files = [
("/app/share/applications/", ["integration/tr.org.pardus.pkexec.system-monitoring-center.desktop"]),
("/app/share/locale/tr/LC_MESSAGES/", ["translations/tr/system-monitoring-center.mo"]),
("/app/share/system-monitoring-center/src/", files_in_folder("src/")),
("/app/share/system-monitoring-center/ui/", files_in_folder("ui/")),
("/app/share/icons/hicolor/scalable/actions/", files_in_folder("icons/actions/")),
("/app/share/icons/hicolor/scalable/apps/", ["icons/apps/tr.org.pardus.pkexec.system-monitoring-center.svg"]),
("/app/share/polkit-1/actions/", ["integration/tr.org.pardus.pkexec.system-monitoring-center.policy"]),
("/app/bin/", ["integration/system-monitoring-center"])
]
if PREFIX != "/app":
data_files = [
("/usr/share/applications/", ["integration/tr.org.pardus.system-monitoring-center.desktop"]),
("/usr/share/locale/tr/LC_MESSAGES/", ["translations/tr/system-monitoring-center.mo"]),
("/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/actions/")),
("/usr/share/icons/hicolor/scalable/apps/", ["icons/apps/system-monitoring-center.svg"]),
("/usr/share/polkit-1/actions/", ["integration/tr.org.pardus.pkexec.system-monitoring-center.policy"]),
("/usr/bin/", ["integration/system-monitoring-center"])
]
setup(
name="System Monitoring Center",
......
......@@ -117,14 +117,22 @@ def storage_menu_right_click_gui_func():
disk_path = "/dev/" + disk_name
if disk_path != "-":
if "loop" in disk_name and os.path.isdir("/sys/class/block/" + disk_name + "/loop/") == True: # "Remove" operation ("delete loop" operation for optical disks) for loop (virtual disk) devices (also if they are not partition).
remove_output = (subprocess.check_output(["udisksctl loop-delete -b", disk_path], stderr=subprocess.STDOUT, shell=True)).decode().strip()
storage_disk_action_warning_dialog(remove_output)
try:
remove_output = (subprocess.check_output(["udisksctl loop-delete -b " + disk_path], stderr=subprocess.STDOUT, shell=True)).decode().strip()
except subprocess.CalledProcessError as e:
storage_disk_action_warning_dialog(e.output.decode("utf-8").strip()) # Convert bytes to string by using ".decode("utf-8")".
return
if "sr" in disk_name: # "Remove" operation ("eject" operation for optical disk disks) for optical disk drives.
remove_output = (subprocess.check_output(["eject", disk_path], stderr=subprocess.STDOUT, shell=True)).decode().strip()
try:
remove_output = (subprocess.check_output(["eject " + disk_path], stderr=subprocess.STDOUT, shell=True)).decode().strip()
except subprocess.CalledProcessError as e:
storage_disk_action_warning_dialog(e.output.decode("utf-8").strip())
return
if "loop" not in disk_name and "sr" not in disk_name: # "Remove" operation ("power off" operation) for non-virtual (loop devices) disks and non-optical disk drives. This operations method is used for USB disks, external HDDs/SSDs, etc.
remove_output = (subprocess.check_output(["udisksctl power-off -b", disk_path], stderr=subprocess.STDOUT, shell=True)).decode().strip()
try:
remove_output = (subprocess.check_output(["udisksctl power-off -b " + disk_path], stderr=subprocess.STDOUT, shell=True)).decode().strip()
except subprocess.CalledProcessError as e:
storage_disk_action_warning_dialog(e.output.decode("utf-8").strip())
return
def on_menuitem4106m_activate(widget): # "Copy Mount Point" item on the right click menu
......@@ -215,7 +223,7 @@ def storage_disk_has_no_mountable_file_system_error_dialog():
def storage_disk_action_warning_dialog(dialog_text):
warning_dialog4101 = Gtk.MessageDialog(transient_for=MainGUI.window1, title=_tr("Warning"), flags=0, message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.YES_NO, text=_tr("Information"), )
buttons=Gtk.ButtonsType.CLOSE, text=_tr("Information"), )
warning_dialog4101.format_secondary_text(dialog_text)
global warning_dialog4101_response
warning_dialog4101_response = warning_dialog4101.run()
......
......@@ -56,6 +56,5 @@ modules:
build-commands:
- python3 setup.py install --flatpak
sources:
- type: git
url: https://kod.pardus.org.tr/Hakan/system-monitoring-center.git
branch: 4bd9fabe533db41f00f4916ce0713ce4985b7d7b
- type: dir
path: /home/asush/Masaüstü/files/python/system-monitoring-center/project/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment