Source Code of IcyPlus App

Download Now

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLineEdit
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QIcon
print("[l/loader.js] Importes initialized")

class IcyPlusApp(QMainWindow):
    def __init__(self):
        super().__init__()

        print("[l/loader.js] IcyPlusApp initialized")

        self.setWindowTitle("IcyPlus Web App")
        print("[l/loader.js] Window title set to 'IcyPlus Web App'")

        self.setGeometry(100, 100, 1024, 768)  # Window size (width, height)
        print("[l/loader.js] Window geometry set to 100, 100, 1024, 768")

        # Set the application icon
        self.setWindowIcon(QIcon("https://icyplus.neocities.org/download/app/v1/logo.png"))  # Replace with the path to your icon file
        print("[l/loader.js] Application icon set")

        # Create a central widget
        central_widget = QWidget(self)
        self.setCentralWidget(central_widget)
        print("[l/loader.js] Central widget created and set")

        # Create a vertical layout
        layout = QVBoxLayout(central_widget)
        print("[l/loader.js] Vertical layout created")

        # Create a QLineEdit widget for the search bar
        self.search_bar = QLineEdit(self)
        print("[l/loader.js] QLineEdit widget (search bar) created")

        self.search_bar.setPlaceholderText("Enter path (e.g., /example/test)")
        print("[l/loader.js] Placeholder text set for search bar")

        self.search_bar.returnPressed.connect(self.load_path)
        print("[l/loader.js] returnPressed signal connected to load_path")

        layout.addWidget(self.search_bar)
        print("[l/loader.js] Search bar added to layout")

        # Create a QWebEngineView widget for displaying the website
        self.browser = QWebEngineView(self)
        print("[l/loader.js] QWebEngineView widget (browser) created")

        layout.addWidget(self.browser)
        print("[l/loader.js] Browser added to layout")

        # Load the initial website
        self.base_url = "https://icyplus.neocities.org"
        self.browser.setUrl(QUrl(self.base_url))
        print(f"[l/loader.js] Initial website loaded: {self.base_url}")

        # Apply dark mode
        self.apply_dark_mode()
        print("[l/loader.js] Dark mode applied")

    def load_path(self):
        """Load the path entered in the search bar."""
        path = self.search_bar.text()
        full_url = QUrl(self.base_url + path)
        self.browser.setUrl(full_url)
        print(f"[l/loader.js] Loaded URL: {full_url.toString()}")

    def apply_dark_mode(self):
        """Apply a dark mode stylesheet to the application."""
        dark_style = """
        QWidget {
            background-color: #2e2e2e;
            color: #f0f0f0;
        }
        QLineEdit {
            background-color: #3c3c3c;
            color: #f0f0f0;
            padding: 5px;
            border-radius: 5px;
            border: 1px solid #555555;
        }
        QLineEdit:focus {
            border: 1px solid #888888;
        }
        """
        self.setStyleSheet(dark_style)
        print("[l/loader.js] Dark mode stylesheet set")

if __name__ == "__main__":
    print("[l/loader.js] Application started")
    app = QApplication(sys.argv)
    window = IcyPlusApp()
    window.show()
    print("[l/loader.js] Main window shown")
    sys.exit(app.exec_())
    print("[l/loader.js] Application exited")