Esempio n. 1
0
    def __init__(self, curse: CurseAPI, instance: MultiMCInstance):
        super().__init__()

        self.curse = curse
        self.instance = instance

        self.setWindowTitle(
            translate("title.editing").format(self.instance.name))

        self.layout = QVBoxLayout(self)

        self.instanceMetaBox = QGroupBox(translate("label.installed"))
        self.layout.addWidget(self.instanceMetaBox)

        self.buttonGroup = QGroupBox()
        self.layoutButtons = QHBoxLayout()
        self.buttonGroup.setLayout(self.layoutButtons)
        self.buttonGroup.setStyleSheet("QGroupBox { border:0; } ")

        self.brButton = makeIconButton(self, "search",
                                       translate("tooltip.browse.mods"))
        self.brButton.clicked.connect(self.browse_clicked)
        self.layoutButtons.addWidget(self.brButton)

        self.ucButton = makeIconButton(self, "view-refresh",
                                       translate("tooltip.update.check"))
        self.ucButton.clicked.connect(self.update_check_clicked)
        self.layoutButtons.addWidget(self.ucButton)

        self.layout.addWidget(self.buttonGroup)

        self.instanceTable = QGridLayout()

        self.init_mods()

        self.instanceMetaBox.setLayout(self.instanceTable)

        scroll = QScrollArea()
        scroll.setWidget(self.instanceMetaBox)
        scroll.setWidgetResizable(True)
        self.layout.addWidget(scroll)

        self.show()
Esempio n. 2
0
    def init_mods(self):
        clearLayout(self.instanceTable)

        for x, mod in enumerate(self.instance.mods):
            rmButton = makeIconButton(self, "edit-delete",
                                      translate("tooltip.delete.mod"))
            rmButton.clicked.connect(
                partial(self.delete_clicked, mod=mod.file.filename))

            self.instanceTable.addWidget(QLabel(mod.file.name), x, 0)
            self.instanceTable.addWidget(rmButton, x, 1)
Esempio n. 3
0
        def create_mod_item(mod):
            group = QGroupBox(self)
            hbox = QHBoxLayout()
            group.setLayout(hbox)
            group.setStyleSheet("QGroupBox { border:0; } ")

            addButton = makeIconButton(self, "download",
                                       translate("tooltip.install"))
            addButton.clicked.connect(partial(self.add_clicked, mod=mod))

            hbox.addStretch(1)
            hbox.addWidget(QLabel(mod.title))
            hbox.addWidget(addButton)
            return group
Esempio n. 4
0
        def create_instance_item(instance):
            group = QGroupBox(self)
            hbox = QHBoxLayout()
            group.setLayout(hbox)
            group.setStyleSheet("QGroupBox { border:0; } ")

            editButton = makeIconButton(self, "edit",
                                        translate("tooltip.edit.instance"))
            editButton.clicked.connect(
                partial(self.edit_clicked, instance=instance))

            deleteButton = makeIconButton(self, "edit-delete",
                                          translate("tooltip.delete.instance"))
            deleteButton.clicked.connect(
                partial(self.delete_clicked, instance=instance))

            hbox.addStretch(1)
            hbox.addWidget(
                QLabel("{} (Minecraft {})".format(instance.name,
                                                  instance.version)))
            hbox.addWidget(editButton)
            hbox.addWidget(deleteButton)

            return group
Esempio n. 5
0
    def __init__(self, curse: CurseAPI, instance: MultiMCInstance,
                 parent: QWidget):
        super().__init__()

        self.curse = curse
        self.instance = instance
        self.parent = parent
        self.dl_win = list()

        self.page = 0

        self.setWindowTitle(
            translate("title.browsing.mod").format(instance.name))

        self.layout = QVBoxLayout(self)

        self.searchBox = QGroupBox(translate("label.search.mods"))
        self.layout.addWidget(self.searchBox)

        self.searchGrid = QGridLayout()

        searchBut = makeIconButton(self, "search", translate("tooltip.search"))
        searchBut.clicked.connect(self.init_mods)
        self.searchGrid.addWidget(searchBut, 0, 1)

        self.searchInp = QLineEdit(self)
        self.searchInp.returnPressed.connect(searchBut.click)
        self.searchGrid.addWidget(self.searchInp, 0, 0)

        self.searchBox.setLayout(self.searchGrid)

        self.modBox = QGroupBox(translate("label.available.mods"))
        self.layout.addWidget(self.modBox)

        self.modTable = QVBoxLayout()

        self.init_mods()

        self.modBox.setLayout(self.modTable)

        scroll = QScrollArea()
        scroll.setWidget(self.modBox)
        scroll.setWidgetResizable(True)
        scroll.setFixedHeight(400)
        self.layout.addWidget(scroll)

        self.show()
Esempio n. 6
0
    def __init__(self, curse: CurseAPI, mmc: MultiMC):
        super().__init__()

        self.curse = curse
        self.mmc = mmc
        self.dlwin = list()

        self.page = 0

        self.setWindowTitle(translate("title.browsing.packs"))

        self.layout = QVBoxLayout(self)

        self.searchBox = QGroupBox(translate("label.search.packs"))
        self.layout.addWidget(self.searchBox)

        self.searchGrid = QGridLayout()

        searchBut = makeIconButton(self, "search", translate("tooltip.search"))
        searchBut.clicked.connect(self.init_packs)
        self.searchGrid.addWidget(searchBut, 0, 1)

        self.searchInp = QLineEdit(self)
        self.searchInp.returnPressed.connect(searchBut.click)
        self.searchGrid.addWidget(self.searchInp, 0, 0)

        self.searchBox.setLayout(self.searchGrid)

        self.packBox = QGroupBox(translate("label.available.packs"))
        self.layout.addWidget(self.packBox)

        self.packTable = QVBoxLayout()

        self.init_packs()

        self.packBox.setLayout(self.packTable)

        scroll = QScrollArea()
        scroll.setWidget(self.packBox)
        scroll.setWidgetResizable(True)
        scroll.setFixedHeight(400)
        self.layout.addWidget(scroll)

        self.show()
Esempio n. 7
0
    def __init__(self, curse: CurseAPI):
        super().__init__()

        self.curse = curse

        self.setWindowTitle(translate("title.settings"))

        self.layout = QVBoxLayout(self)

        mmc_box = QGroupBox(translate("label.mmc.location"))
        mmc_layout = QHBoxLayout()

        mmc_box.setLayout(mmc_layout)

        self.mmcDir = QLineEdit(self.curse.baseDir)
        self.mmcDir.setReadOnly(True)
        self.mmcDir.setMinimumWidth(250)
        mmc_layout.addWidget(self.mmcDir, 0, Qt.AlignLeft)

        self.mmcEb = makeIconButton(self, "edit",
                                    translate("tooltip.mmc.change"))
        self.mmcEb.clicked.connect(partial(self.browse_clicked))
        mmc_layout.addWidget(self.mmcEb, 0, Qt.AlignRight)

        self.layout.addWidget(mmc_box)

        analytics_box = QGroupBox(translate("label.analytics"))
        analytics_layout = QHBoxLayout()

        analytics_box.setLayout(analytics_layout)

        self.analyticsToggle = QCheckBox()
        self.analyticsToggle.setChecked(self.curse.db["analytics"])
        self.analyticsToggle.setToolTip(translate("tooltip.toggle.analytics"))
        self.analyticsToggle.stateChanged.connect(self.analytics_toggle)
        analytics_layout.addWidget(self.analyticsToggle, 1, Qt.AlignCenter)

        self.layout.addWidget(analytics_box)

        self.show()
Esempio n. 8
0
    def __init__(self):
        super().__init__()

        self.curse = CurseAPI()
        self.updatet = None
        self.child_wins = list()

        data_sent = False

        if not self.curse.baseDir:
            self.curse.baseDir = directoryBox(self, translate("prompt.mmc"))
            if not self.curse.baseDir:
                exit(1)
            self.curse.db["baseDir"] = self.curse.baseDir

        Logger.info("MultiMC folder is {}".format(self.curse.baseDir))

        if "analytics" not in self.curse.db:
            self.curse.db["analytics"] = confirmBox(
                self, QMessageBox.Question, translate("prompt.analytics"),
                QMessageBox.Yes)
            if self.curse.db["analytics"]:
                send_data(self.curse)
                data_sent = True

        if "ver" not in self.curse.db:
            if self.curse.db["analytics"] and not data_sent:
                send_data(self.curse)
            self.curse.db["ver"] = self.curse.version

        self.analytics = self.curse.db["analytics"]

        Logger.info("Analytics are {}".format(["Disabled",
                                               "Enabled"][self.analytics]))

        self.mmc = MultiMC(self.curse.baseDir)

        self.setWindowTitle("OpenMineMods v{}".format(CurseAPI.version))

        self.layout = QVBoxLayout(self)
        # Start Buttons
        self.buttonGroup = QGroupBox()
        self.layoutButtons = QHBoxLayout()
        self.buttonGroup.setLayout(self.layoutButtons)
        self.buttonGroup.setStyleSheet("QGroupBox { border:0; } ")

        refreshInstances = makeIconButton(
            self, "view-refresh", translate("tooltip.refresh.instances"))
        refreshInstances.clicked.connect(self.refresh_instances)

        brButton = makeIconButton(self, "search", "Browse Modpacks")
        brButton.clicked.connect(self.browse_clicked)

        settingsButton = makeIconButton(self, "configure",
                                        translate("tooltip.configure.omm"))
        settingsButton.clicked.connect(self.settings_clicked)

        self.layoutButtons.setAlignment(Qt.AlignTop)
        self.layoutButtons.addWidget(refreshInstances)
        self.layoutButtons.addWidget(brButton)
        self.layoutButtons.addWidget(settingsButton)
        self.layoutButtons.addStretch(1)
        self.layoutButtons.setContentsMargins(0, 0, 0, 0)
        self.layout.addWidget(self.buttonGroup)
        # End Buttons
        self.hGroupBox = QGroupBox(translate("label.instances"))
        self.layout.addWidget(self.hGroupBox)

        self.instanceTable = QVBoxLayout()

        self.init_instances()

        self.hGroupBox.setLayout(self.instanceTable)

        scroll = QScrollArea()
        scroll.setWidget(self.hGroupBox)
        scroll.setWidgetResizable(True)
        self.layout.addWidget(scroll)

        self.show()

        self.updatecheck = UpdateCheckThread(self.curse)
        self.updatecheck.done.connect(self.update_checked)

        self.update_thread = QThread()

        self.updatecheck.moveToThread(self.update_thread)

        self.update_thread.started.connect(self.updatecheck.check_updates)
        if isfile(join(getInstallDir(), 'AutoUpdate')):
            self.update_thread.start()