本文整理汇总了Python中gi.repository.Gdk.Cursor方法的典型用法代码示例。如果您正苦于以下问题:Python Gdk.Cursor方法的具体用法?Python Gdk.Cursor怎么用?Python Gdk.Cursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gdk
的用法示例。
在下文中一共展示了Gdk.Cursor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stop_zooming
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def stop_zooming(self, *args):
""" Cancel the zooming, if it was enabled.
Returns:
`bool`: whether the event was consumed
"""
Cursor.set_cursor(self.p_central)
self.zoom_selecting = False
self.zoom_points = None
self.scale = 1.
self.shift = (0, 0)
self.set_scribble_zoomout_sensitive(False)
self.menu_zoom_out.set_sensitive(False)
self.redraw_current_slide()
self.clear_cache()
return True
示例2: nav_zoom
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def nav_zoom(self, name, ctrl_pressed, command = None):
""" Handles an key press event: stop trying to select an area to zoom.
Args:
name (`str`): The name of the key pressed
ctrl_pressed (`bool`): whether the ctrl modifier key was pressed
command (`str`): the name of the command in case this function is called by on_navigation
Returns:
`bool`: whether the event was consumed
"""
if not self.zoom_selecting:
return False
elif command == 'cancel':
Cursor.set_cursor(self.p_central)
self.zoom_selecting = False
self.zoom_points = None
return True
return False
示例3: __on_button_press
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def __on_button_press(self, item, target, event):
if event.button == 1 and not self.__cropping_box:
canvas = item.get_canvas()
self.__dragging = True
self.__start_x = event.x
self.__start_y = event.y
self.__rubberband = GooCanvas.CanvasRect(
x=event.x, y=event.y, width=0, height=0,
stroke_color_rgba=0x66CCFF55,
fill_color_rgba=0xFFEECC66,
line_width=2.0)
canvas.get_root_item().add_child(self.__rubberband, next_index())
fleur = Gdk.Cursor(Gdk.CursorType.FLEUR)
canvas.pointer_grab(
item,
Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK,
fleur,
event.time)
return True
示例4: change_wallpaper_async
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def change_wallpaper_async(self):
def on_change_wallpaper_done(result, error):
self.get_window().set_cursor(None)
@async_function(on_done=on_change_wallpaper_done)
def do_change_wallpaper_in_thread():
self.save_preferences()
change_wallpaper()
return True
self.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
do_change_wallpaper_in_thread()
示例5: _launch_disconnect_thread
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def _launch_disconnect_thread(self, widget=None):
watch_cursor = Gdk.Cursor(Gdk.CursorType.WATCH)
self._win.get_window().set_cursor(watch_cursor)
self._connect_btn.start_spinner()
self._connect_btn.set_sensitive(False)
# Force the spinner to show on the window.
while Gtk.events_pending():
Gtk.main_iteration()
t = threading.Thread(target=self._threaded_disconnect)
t.start()
示例6: _set_cursor_to_hand_cb
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def _set_cursor_to_hand_cb(self, widget, data=None):
widget.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND1))
示例7: toggle_cursor
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def toggle_cursor(widget, hide=False):
window = widget.get_window()
if window:
blank = Gdk.CursorType.BLANK_CURSOR
cursor = Gdk.Cursor(blank) if hide else None
GLib.idle_add(window.set_cursor, cursor)
示例8: bg_button_press_cb
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def bg_button_press_cb(self, widget, event):
"""
Enter in scroll mode when mouse button pressed in background
or call option menu.
"""
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
widget.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.FLEUR))
self._last_x = event.x
self._last_y = event.y
self._in_move = True
return True
elif is_right_click(event):
self.on_show_option_menu_cb(widget, event)
return True
return False
示例9: set_header_cursor
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def set_header_cursor(self, eb, *a):
""" Sets cursor over top part of infobox to hand """
eb.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND1))
示例10: add_map_data
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def add_map_data(self, location):
# append to listbox
text = '{"x": %d, "y": %d, "width": %d, "height": %d, "color": "%s"}' % location
self.map_data_listbox.append_text(text)
# append to view
point = maps.to_array(text)
self.map_view.add_point(point, 'Resource', MiniMap.point_colors['Resource'])
self.select_resource_button.set_sensitive(True)
self.set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
示例11: on_select_resource_button_clicked
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def on_select_resource_button_clicked(self, button):
button.set_sensitive(False)
self.set_cursor(Gdk.Cursor(Gdk.CursorType.CROSSHAIR))
Thread(target=self.wait_for_click, args=(self.add_map_data, self.game_window_location)).start()
示例12: add_click
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def add_click(self, location):
x, y, width, height, color = location
twice = self.click_twice_switch.get_active()
self.path_listbox.append_text('Click(x=%d,y=%d,width=%d,height=%d,twice=%s)' % (x, y, width, height, twice))
self.select_button.set_sensitive(True)
self.set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
示例13: on_select_button_clicked
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def on_select_button_clicked(self, button):
button.set_sensitive(False)
self.set_cursor(Gdk.Cursor(Gdk.CursorType.CROSSHAIR))
Thread(target=self.wait_for_click, args=(self.add_click, self.game_window_location)).start()
示例14: on_enter_notify
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def on_enter_notify(self, widget, event):
window = self.get_window()
window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND1))
示例15: on_select_pixel_button_clicked
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import Cursor [as 别名]
def on_select_pixel_button_clicked(self, button):
button.set_sensitive(False)
self.parent.set_cursor(Gdk.Cursor(Gdk.CursorType.CROSSHAIR))
# wait for click
Thread(target=self.parent.wait_for_click, args=(self.add_pixel, self.parent.game_window_location)).start()