def initMe(self):
        mod = self.mod
        Layout = QVBoxLayout()

        # Name
        Layout.addWidget(QLabel(str(mod.name)))

        # Image
        Image = QLabel()

        if mod.image:
            pixmap = QPixmap(mod.image)
        else:
            pixmap = QPixmap(f("images/no_image.png"))

        pixmap = pixmap.scaledToWidth(Width, mode=Qt.SmoothTransformation)
        Image.setPixmap(pixmap)
        Layout.addWidget(Image)

        # Authors
        separator = ', '
        if mod.authors:
            Layout.addWidget(QLabel(f"Authors: {separator.join(mod.authors)}"))
        else:
            Layout.addWidget(QLabel("Authors: not detected"))

        # source
        Layout.addWidget(QLabel(f"source: {str(mod.source)}"))

        # minorVersion
        Layout.addWidget(QLabel(f"minorVersion: {str(mod.minorVersion)}"))

        # hasSettings
        Layout.addWidget(QLabel(f"hasOptions: {str(mod.options)}"))

        # Category Image
        if mod.category_image is not None:
            try:
                images.invert_image(mod.category_image)
                success = True
            except:
                success = False
            if success:
                Image = QLabel()
                pixmap = QPixmap(f("Image_negative.jpg"))
                Image.setPixmap(pixmap)
                Image.setToolTip("Category")
                Layout.addWidget(Image)

        # Open in Explorer Button
        Open = QPushButton("Open in Explorer")
        Open.clicked.connect(self.open)
        Layout.addWidget(Open)

        # Uninstall
        Uninstall = QPushButton("Uninstall Mod")
        Uninstall.clicked.connect(self.uninstall)
        Layout.addWidget(Uninstall)

        self.setLayout(Layout)
Example #2
0
    def submit(self):
        config.add_section('DIRECTORY')
        config.set('DIRECTORY', 'externalmods', self.common.text.text())
        config.set('DIRECTORY', 'steammods', self.steam.text.text())
        config.set('DIRECTORY', 'userdatamods', self.userdata.text.text())
        config.set('DIRECTORY', 'stagingareamods',
                   self.stagingarea.text.text())
        if sys.platform == "win32":
            config.set('DIRECTORY', '7-zipInstallation',
                       self.sevenzip.text.text())
        elif sys.platform == "linux":
            config.set('DIRECTORY', '7-zipInstallation', "/usr")
        elif sys.platform == "darwin":
            config.set('DIRECTORY', '7-zipInstallation', "/usr/local/bin")

        config.add_section("GRAPHICS")
        config.set("GRAPHICS", "modernstyle", "True")
        config.set("GRAPHICS", "imagesize", "384")

        config.add_section("LANGUAGE")
        config.set("LANGUAGE", "language", "en")

        with open(f('settings.ini'), 'w') as configfile:
            config.write(configfile)

        sig.next_page.emit()
def invert_image(path):
    img = Image.open(path)

    img_array = np.array(img)

    I_max = 255

    img_array = I_max - img_array

    inverted_img = Image.fromarray(img_array)

    inverted_img.save(f(r"Image_negative.jpg"))
    def initMe(self):

        self.state = QStatusBar(self)  # Create Statusbar

        self.setStatusBar(self.state)

        ExportModlist = QAction("export modlist", self)
        ExportModlist.setShortcut("Ctrl+E")
        ExportModlist.setStatusTip("export modlist")
        ExportModlist.triggered.connect(self.export_modlist)

        ImportModlist = QAction("Compare modlist", self)
        ImportModlist.setShortcut("Ctrl+O")
        ImportModlist.setStatusTip("Compare modlist")
        ImportModlist.triggered.connect(self.compare_modlist)

        InstallMod = QAction("install mod", self)
        InstallMod.setShortcut("Ctrl+I")
        InstallMod.setStatusTip("install mod")
        InstallMod.triggered.connect(self.install_mod)

        menubar = self.menuBar()
        mod = menubar.addMenu("Mod")
        mod.addAction(ExportModlist)
        mod.addAction(ImportModlist)
        mod.addAction(InstallMod)

        open_settings = QAction("Open Settings", self)
        open_settings.setStatusTip("Open Settings")
        open_settings.triggered.connect(self.open_Settings)

        settings = menubar.addMenu("Settings")
        settings.addAction(open_settings)

        self.setGeometry(50, 50, 500, 500)
        self.setWindowTitle("Tpf2 NeonModManager")

        self.setWindowIcon(QIcon(f("images/icon.png")))

        self.mainwidget = MainWidget()
        self.setCentralWidget(self.mainwidget)

        self.show()
Example #5
0
    def submit(self, *arg):
        config.set('DIRECTORY', 'externalmods', self.common.text.text())
        config.set('DIRECTORY', 'steammods', self.steam.text.text())
        config.set('DIRECTORY', 'userdatamods', self.userdata.text.text())
        config.set('DIRECTORY', 'stagingareamods',
                   self.stagingarea.text.text())

        t = QCheckBox()

        config.set("GRAPHICS", "modernstyle",
                   str(self.modernstyle.data.isChecked()))
        config.set("GRAPHICS", "imagesize", self.imagesize.data.text())

        config.set("LANGUAGE", "language", self.language.data.text())

        with open(f('settings.ini'), 'w') as configfile:
            config.write(configfile)

        # Quit App
        QCoreApplication.quit()
Example #6
0
    def __init__(self) -> None:
        super().__init__()
        self.setWindowTitle("Settings")
        self.continue_btn.setText("Apply and close")
        self.continue_btn.setToolTip("will close the application")

        config.read(f("settings.ini"))

        self.commonmodsdir = os.path.normpath(
            config['DIRECTORY']['externalMods'])
        self.steammodsdir = os.path.normpath(config["DIRECTORY"]["steamMods"])
        self.userdatamodsdir = os.path.normpath(
            config["DIRECTORY"]["userdatamods"])
        self.stagingareadir = os.path.normpath(
            config["DIRECTORY"]["stagingareamods"])

        self.modernstylebf = config["GRAPHICS"]["modernstyle"]
        self.imagesizebf = config["GRAPHICS"]["imagesize"]
        self.languagebf = config["LANGUAGE"]["language"]

        self.continue_btn.setToolTip(
            "will close the app you will need to restart it")
        self.fill_content()
                             QVBoxLayout, QApplication, QMainWindow, QAction,
                             QGridLayout, QScrollArea, QLabel, QFileDialog,
                             QLineEdit, QMessageBox, QListWidget,
                             QListWidgetItem, QAbstractItemView)
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtCore import QObject, Qt, pyqtSignal

app = QApplication(sys.argv)

if False:  # Change this to True if you are building the .deb file.
    os.chdir("/usr/share/Tpf2NeonModManager")

setting_up = False
configfound = False

if not os.path.isfile(f("settings.ini")):
    import setup

    setup = setup.Setup_Window()
    setting_up = True


class ErrorBox(QMessageBox):
    def __init__(self, error: str):
        super().__init__()
        self.setStyleSheet(style)
        self.setIcon(QMessageBox.Critical)
        self.setText(error)
        self.setStandardButtons(QMessageBox.Close)
        self.setWindowTitle("ERROR")
        self.show()
Example #8
0
import os
import configparser
import subprocess
from distutils.dir_util import copy_tree
from sys import platform
from freezeutils import find_data_file as f

config = configparser.ConfigParser()
config.read(f("settings.ini"))

userdataModsDirectory = os.path.normpath(config['DIRECTORY']['userdatamods'])
sevenZipInstallation = os.path.normpath(
    config["DIRECTORY"]["7-zipInstallation"])


def install(link):

    if platform in ("linux", "darwin"):
        if link.lower().endswith('zip') or link.lower().endswith(
                'rar') or link.lower().endswith("7z"):
            subprocess.Popen(
                ["7z", "x", link, f"-o{userdataModsDirectory}", "-y"])
            return True
        if os.path.isdir(link):
            _, b = os.path.split(link)
            copy_tree(link, os.path.join(userdataModsDirectory, b))
            return True

    elif platform == "win32":
        if link.lower().endswith('zip') or link.lower().endswith(
                'rar') or link.lower().endswith("7z"):