Exemple #1
0
 def _change_path(self, path_key, is_valid):
     new_folder = str(
         QFileDialog.getExistingDirectory(
             parent=self,
             caption="Select new path",
             directory=Settings().get(path_key)))
     if new_folder and exists(new_folder):
         if is_valid(new_folder):
             Settings().set(path_key, new_folder)
         else:
             from d2mp.ui import Message
             Message.critical(
                 "Path is not valid",
                 "Path was not saved in settings.\nPlease select a directory with the right executable in it!"
             )
Exemple #2
0
 def exec_(self):
     self._create_tray_icon()
     self._create_mod_manager()
     self._start_file_watcher()
     self._create_socket()
     Settings()
     
     return super(SingleApplication, self).exec_()
Exemple #3
0
    def __init__(self, *args, **kwargs):
        super(PreferencesWindow, self).__init__(layoutCls=QVBoxLayout,
                                                *args,
                                                **kwargs)
        self.setWindowTitle("Settings")
        self.setWindowIcon(QIcon(SETTINGS['icon']))
        self._add_steam_box()
        self._add_dota_box()
        self._add_additional_prefs()
        self._add_log_box()

        self._add_log_watcher()
        Settings().signals.changed.connect(self.update_path)
Exemple #4
0
    def _add_additional_prefs(self):
        box = QGroupBox("Additional Preferences")
        box.setLayout(QHBoxLayout(box))

        log_btn = QPushButton("View Log", box)
        log_btn.clicked.connect(self.open_log_file)
        reset_btn = QPushButton("Reset Settings", box)
        reset_btn.clicked.connect(Settings().reset)

        box.layout().addWidget(log_btn)
        box.layout().addWidget(reset_btn)

        self.layout().addWidget(box)
Exemple #5
0
    def _add_dota_box(self):
        box = QGroupBox("Dota Location")
        box.setLayout(QHBoxLayout(box))

        self.dota_path = QLineEdit(box)
        self.dota_path.setReadOnly(True)
        self.dota_path.setText(Settings().get("dota_path"))

        change_btn = QPushButton("Change...", box)
        change_btn.clicked.connect(self.change_dota_path)

        box.layout().addWidget(self.dota_path)
        box.layout().addWidget(change_btn)

        self.layout().addWidget(box)
Exemple #6
0
 def _steam_path(self):
     return Settings().get(Settings.STEAM_PATH_KEY)
Exemple #7
0
 def _dota_path(self):
     return Settings().get(Settings.DOTA_PATH_KEY)