Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gui/engine.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker
6 changes: 3 additions & 3 deletions gui/installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def confirm_abort(self):
# Ask about removing the container
msg_box = QMessageBox()
msg_box.setWindowTitle("Remove Container?")
msg_box.setText("Do you want to remove the 'LinOffice' podman container and all its data? This action cannot be undone.\n\nIf you are running this installer for the first time, you can select 'Yes'. If you have previously set up LinOffice and are running this installer again, you should select 'No' unless you explicitly want your Windows container including all its data to be deleted.")
msg_box.setText("Do you want to remove the 'LinOffice' container and all its data? This action cannot be undone.\n\nIf you are running this installer for the first time, you can select 'Yes'. If you have previously set up LinOffice and are running this installer again, you should select 'No' unless you explicitly want your Windows container including all its data to be deleted.")
msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
msg_box.setDefaultButton(QMessageBox.No)
msg_box.setIcon(QMessageBox.Warning)
Expand All @@ -400,7 +400,7 @@ def confirm_abort(self):
if not os.path.isfile(script_path):
QMessageBox.critical(
self, "Error",
f"Error. Podman container and volume have not been removed. Script not found: {script_path}",
f"Error. Container and volume have not been removed. Script not found: {script_path}",
QMessageBox.Ok
)
return
Expand Down Expand Up @@ -428,7 +428,7 @@ def confirm_abort(self):
if not success:
QMessageBox.critical(
self, "Error",
"Error. Podman container and volume have not been removed. Could not load terminal.",
"Error. Container and volume have not been removed. Could not load terminal.",
QMessageBox.Ok
)

Expand Down
9 changes: 5 additions & 4 deletions gui/linoffice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from PySide6.QtCore import QFileInfo
from pathlib import Path

def container_exists(container_name="LinOffice"):
def container_exists(container_name="LinOffice", engine="podman"):
try:
result = subprocess.run(
["podman", "ps", "-a", "--format", "{{.Names}}"],
[engine, "ps", "-a", "--format", "{{.Names}}"],
capture_output=True,
text=True
)
Expand Down Expand Up @@ -44,8 +44,9 @@ def main():
mainwindow_path = os.path.join(base_dir, "mainwindow.py")
installer_path = os.path.join(base_dir, "installer", "installer.py")
log_path = "~/.local/share/linoffice/setup_progress.log"

container_found = container_exists("LinOffice")
engine = open(os.path.join(os.path.dirname(__file__), "engine.txt")).read().strip()

container_found = container_exists("LinOffice", engine)
success = setup_successful(log_path)

if container_found:
Expand Down
7 changes: 4 additions & 3 deletions gui/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def __init__(self, parent=None):
super().__init__(parent)
# Ensure registry config exists before loading UI
ensure_registry_config_exists()
self.engine = open(os.path.join(os.path.dirname(__file__), "engine.txt")).read().strip()
self.load_ui('main.ui')
self.setWindowTitle(self.ui.windowTitle())
self.connect_buttons()
Expand Down Expand Up @@ -141,7 +142,7 @@ def launch_linoffice_app(self, *args):

def update_container_status(self):
try:
result = subprocess.run(['podman', 'ps', '--filter', 'name=LinOffice', '--format', '{{.Status}}'], capture_output=True, text=True, check=True)
result = subprocess.run([self.engine, 'ps', '--filter', 'name=LinOffice', '--format', '{{.Status}}'], capture_output=True, text=True, check=True)
status = result.stdout.strip()
if status:
status_text = f"Container: running ({status})"
Expand All @@ -153,7 +154,7 @@ def update_container_status(self):

def check_and_prompt_container(self):
try:
result = subprocess.run(['podman', 'ps', '--filter', 'name=LinOffice', '--format', '{{.Status}}'], capture_output=True, text=True, check=True)
result = subprocess.run([self.engine, 'ps', '--filter', 'name=LinOffice', '--format', '{{.Status}}'], capture_output=True, text=True, check=True)
if not result.stdout.strip():
# Container is not running, show dialog
dialog = QMessageBox(self)
Expand All @@ -166,7 +167,7 @@ def check_and_prompt_container(self):
# Run linoffice.sh --startcontainer in the background
threading.Thread(target=lambda: subprocess.Popen([LINOFFICE_SCRIPT, '--startcontainer'])).start()
except subprocess.CalledProcessError as e:
print(f"DEBUG: podman ps error: {e.stderr}")
print(f"DEBUG: {self.engine} ps error: {e.stderr}")
QMessageBox.critical(self, "Error", "Could not check container status.")

# Defining secondary windows
Expand Down
Loading