def update(self, *args): self.ids["Title"].text = self.title self.ids["Description"].text = self.description self._editorHolder.clear_widgets() if self.type == "numericSlider": if self.sliderMin is None or self.sliderMax is None: raise ValueError("'sliderMin' and / or 'sliderMax' cannot be 'None' if type is numericSlider") self._editorWidget = Slider(min=self.sliderMin, max=self.sliderMax, value=Config.getint(self.section, self.option), step=1) self._editorWidget.bind(value=self.value_changed) self._editorWidget2 = TextInput(multiline=False, font_size=self._editorHolder.height / 2, text=Config.get(self.section, self.option), input_filter="int") self._editorWidget2.bind(on_text_validate=self.text_box_int_validator) self._editorWidget2.bind(focus=self.text_box_int_validator) elif self.type == "bool": self._editorWidget = Switch(active=Config.getboolean(self.section, self.option)) self._editorWidget.bind(active=self.value_changed) elif self.type == "string": self._editorWidget = TextInput(multiline=False, font_size=self._editorHolder.height / 2, text=Config.get(self.section, self.option)) self._editorWidget.bind(on_text_validate=lambda *args: self.value_changed(None, self._editorWidget.text)) self._editorWidget.bind(focus=lambda *args: self.value_changed(None, self._editorWidget.text)) elif self.type == "option": self._editorWidget = Button(text=Config.get(self.section, self.option)) dropDown = DropDown() for option in self.options: text = str(option) try: text = text + " - " + str(self.extra_info[option]) except KeyError: pass btn = Button(text=text, size_hint_y=None, height=self.height) btn.tag = str(option) btn.bind(on_release=lambda _btn: dropDown.select(_btn.tag)) dropDown.add_widget(btn) self._editorWidget.bind(on_release=dropDown.open) self._editorWidget.bind(on_release=lambda *args: emptyFunction(dropDown.children)) dropDown.bind(on_select=lambda instance, x: setattr(self._editorWidget, 'text', x)) dropDown.bind(on_select=self.value_changed) if self._editorWidget2 is not None: self._editorHolder.add_widget(self._editorWidget2) if self.type != "title": self._editorHolder.add_widget(self._editorWidget)
def mabyDoPasswordAndLogins(self, screen): if Config.getboolean("Misc", "saveLogins"): screen.ids["UsrNameInput"].text = Config.get("Misc", "username") screen.ids["PwdInput"].text = decode( str(Config.get("Misc", "password")), "JonIsGreen") Logger.info("Logins: Loaded")
def start_mining(self): home = self.root.get_screen("HomeScreen") if Config.getboolean("Misc", "saveLogins"): Config.set("Misc", "username", home.ids["UsrNameInput"].text) Config.set("Misc", "password", encode(str(home.ids["PwdInput"].text), "JonIsGreen")) Config.write() Logger.info("Logins: Saved") Miner = self.root.get_screen("MiningScreen").Miner Miner.usrName = home.ids["UsrNameInput"].text Miner.pwdInput = home.ids["PwdInput"].text Miner.stopOnlyWhenStopPressed = home.ids["MineUntilOrForSwitch"].active Miner.mineUntilPoints = None if home.ids[ "PointsInput"].text == "" else home.ids["PointsInput"].text Miner.mineForTime = None if home.ids[ "TimeInput"].text == "" else home.ids["TimeInput"].text Miner.requireAll = home.ids["RequirementsAll"].state == "down" self.root.current = "MiningScreen"
def setup(self): try: self.driver.quit() except AttributeError: pass chromedriver_autoinstaller.install() Logger.info("Miner: Chromedriver installed if not already") chrome_options = ChromeOptions() if Config.getboolean("Gui", "headless"): chrome_options.add_argument("--headless") chrome_options.add_argument("--window-size=1920,1080") chrome_options.add_argument( "--log-path=" + str(os.path.join(user_data_dir, "chromedriver.log"))) Logger.info("Miner: Chromedriver setup") url = Config.get("URLs", "sign_in") self.driver = webdriver.Chrome(options=chrome_options) self.driver.get(url) Logger.info("Miner: Loaded " + str(url))