示例#1
0
文件: dev.py 项目: Dr-Chaos/Dindo-Bot
 def on_select_pixel_button_clicked(self, button):
     button.set_sensitive(False)
     self.parent.set_cursor(Gdk.Cursor(Gdk.CursorType.CROSSHAIR))
     # wait for click
     game_location = tools.get_widget_location(self.parent.game_area)
     Thread(target=self.parent.wait_for_click,
            args=(self.add_pixel, game_location)).start()
示例#2
0
	def on_start_button_clicked(self, button):
		if self.game_window is None:
			AlertDialog(self, 'Please select a game window')
		elif not self.bot_path:
			AlertDialog(self, 'Please select a bot path')
		else:
			# get game location
			game_location = tools.get_widget_location(self.game_area)
			# start bot thread
			if self.bot_thread is None or not self.bot_thread.isAlive():
				# get thread parameters
				start_from_step = self.step_spin_button.get_value_as_int()
				repeat_path = self.repeat_spin_button.get_value_as_int() if self.repeat_switch.get_active() else 1
				if self.connect_to_account_switch.get_active():
					account_id = self.accounts_combo.get_active_value()
					disconnect_after = self.disconnect_after_switch.get_active()
				else:
					account_id = None
					disconnect_after = False
				# run thread
				self.bot_thread = BotThread(self, game_location, start_from_step, repeat_path, account_id, disconnect_after)
				self.bot_thread.start()
				self.settings_button.set_sensitive(False)
				self.bot_widgets.set_sensitive(False)
			# resume bot thread if paused
			else:
				self.bot_thread.resume(game_location)
			# enable/disable buttons
			self.start_button.set_image(Gtk.Image(file=tools.get_full_path('icons/loader.gif')))
			self.start_button.set_sensitive(False)
			self.pause_button.set_sensitive(True)
			self.stop_button.set_sensitive(True)
示例#3
0
文件: dev.py 项目: Dr-Chaos/Dindo-Bot
 def on_simulate_scroll_button_clicked(self, button):
     # get scroll value
     direction = self.scroll_direction_combo.get_active_text()
     value = self.scroll_spin_button.get_value_as_int()
     clicks = value if direction == 'up' else -value
     if self.parent.game_area:
         # get game area location
         game_location = tools.get_widget_location(self.parent.game_area)
         # get the center of the game location
         x, y = tools.coordinates_center(game_location)
     else:
         x, y = (None, None)
     # scroll
     self.parent.debug('Scroll: %d' % clicks)
     tools.scroll_to(clicks, x, y)
示例#4
0
文件: dev.py 项目: Dr-Chaos/Dindo-Bot
 def on_simulate_click_button_clicked(self, button):
     # get click coordinates
     selected_row = self.tree_view.get_selected_row()
     x, y, width, height = (selected_row[1], selected_row[2],
                            selected_row[3], selected_row[4])
     #print('x: %d, y: %d, width: %d, height: %d' % (x, y, width, height))
     # adjust for game area
     if self.parent.game_area:
         game_x, game_y, game_width, game_height = tools.get_widget_location(
             self.parent.game_area)
         #print('game_x: %d, game_y: %d, game_width: %d, game_height: %d' % (game_x, game_y, game_width, game_height))
         click_x, click_y = tools.adjust_click_position(
             x, y, width, height, game_x, game_y, game_width, game_height)
     else:
         click_x = x
         click_y = y
     # perform click
     self.parent.debug('Click on x: %d, y: %d' % (click_x, click_y))
     tools.perform_click(click_x, click_y)
示例#5
0
	def on_select_resource_button_clicked(self, button):
		button.set_sensitive(False)
		self.set_cursor(Gdk.Cursor(Gdk.CursorType.CROSSHAIR))
		game_location = tools.get_widget_location(self.game_area)
		Thread(target=self.wait_for_click, args=(self.add_map_data, game_location)).start()