本文整理汇总了Python中pwt.window.Window类的典型用法代码示例。如果您正苦于以下问题:Python Window类的具体用法?Python Window怎么用?Python Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cmd_print_focused_window_classname
def cmd_print_focused_window_classname(self):
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText(Window.focused_window().classname)
win32clipboard.CloseClipboard()
print(Window.focused_window().classname)
示例2: shift_focused_window_up
def shift_focused_window_up(self):
"""
Switches the window to the previous position
"""
window = Window.focused_window()
#only grab and move the window if it is in the self
if window in self.windows:
i = self.windows.index(window)
#if the foreground window is first, shift everything and place it last
if i == 0:
j = len(self.windows) - 1
self.windows[j], self.windows[:j] = self.windows[0], self.windows[1:]
#else shift it with the trailing window
else:
j = i - 1
self.windows[i], self.windows[j] = self.windows[j], self.windows[i]
self.tile_windows()
if not window.focus():
self.remove_window(window)
示例3: cmd_toggle_tiled_floating
def cmd_toggle_tiled_floating(self):
win = Window.focused_window(self.windows)
if(win != None):
if(win.floating):
win.tile()
else:
win.float()
示例4: shift_focused_window_down
def shift_focused_window_down(self):
"""
Switches the window to the next position
"""
#get focused window
window = Window.focused_window()
#only grab and move the window if it is in the self
if window in self.windows:
i = self.windows.index(window)
#if the foreground window is the last window, shift everything and place it first
if i == len(self.windows) - 1:
self.windows[0], self.windows[1:] = self.windows[i], self.windows[:i]
#else shift it with the following window
else:
self.windows[i], self.windows[i+1] = self.windows[i+1], self.windows[i]
self.tile_windows()
if not window.focus():
self.remove_window(window)
示例5: next_layout
def next_layout(self):
"""
Switch to the next layout
"""
nextLayout = Utility.next_item(self.layouts, self.currentLayout)
if nextLayout:
self.currentLayout = nextLayout
self.masterarea = self.currentLayout.maxSize // 2
self.tile_windows()
if not Window.focused_window().center_cursor():
self.remove_window(Window.focused_window())
示例6: cmd_send_to_group_9
def cmd_send_to_group_9(self):
if self.group != 8:
window = Window.focused_window()
if window:
self.send_window_to_tiler(window, 8)
示例7: switch_group
def switch_group(self, i):
"Switch the current group into group i"
for monitor in self.monitors:
for window in monitor.tilers[self.group].windows:
window.hide()
for window in monitor.tilers[i].windows:
window.show()
monitor.tilers[i].tile_windows()
self.group = i
self.notifyicon.draw_icon(self.icon)
Window.window_under_cursor().focus()
示例8: cmd_move_to_next_monitor
def cmd_move_to_next_monitor(self):
window = Window.focused_window(self.windows)
# if(window.validate()):
monitor = Monitor.monitor_from_window_in_list(self.monitors, window)
nextMonitor = Utility.next_item(self.monitors, monitor)
if(monitor != nextMonitor):
tiler = monitor.tilers[self.group]
nextTiler = nextMonitor.tilers[self.group]
tiler.remove_window(window)
nextTiler.add_window(window)
window.focus()
示例9: cmd_move_to_previous_monitor
def cmd_move_to_previous_monitor(self):
window = Window.focused_window(self.windows)
# if(window.validate()):
monitor = Monitor.monitor_from_window_in_list(self.monitors, window)
previousMonitor = Utility.previous_item(self.monitors, monitor)
if(monitor != previousMonitor):
tiler = monitor.tilers[self.group]
previousTiler = previousMonitor.tilers[self.group]
tiler.remove_window(window)
previousTiler.add_window(window)
window.focus()
示例10: __init__
def __init__(self):
#taskbar
self.taskbar = Window.find_window("Shell_TrayWnd")
self.startbutton = self.get_startbutton()
self.appbarData = APPBARDATA(ctypes.sizeof(APPBARDATA)
,self.taskbar.hWindow
,0
,0
,RECT(0,0,0,0)
,0
)
示例11: focus_next
def focus_next(self):
"""
Sets focus on the next window
"""
window = Utility.next_item(self.windows, Window.focused_window())
if window:
if not window.focus():
self.remove_window(window)
else:
self.focus_primary()
示例12: focus_previous
def focus_previous(self):
"""
Sets focus on the previous window
"""
#get focused window
window = Utility.previous_item(self.windows, Window.focused_window())
if window:
if not window.focus():
self.remove_window(window)
else:
self.focus_primary()
示例13: start
def start(self):
'start the listeners with a safety try/finally to unregister keys and kill the icon'
self.notifyicon.show_balloon('Go!', 'PWT')
# Do an initial lookup of all the windows and tile accordingly
for monitor in self.monitors:
windows = Window.valid_windows_from_monitor(monitor)
for window in windows:
self.add_window(monitor.tilers[self.group], window)
monitor.tilers[self.group].tile_windows()
try:
# message priming read
message = self.notifyicon.windowmessage
while message:
if message[1][1] == WM_HOTKEY:
# if message is WM_HOTKEY
# execute the corresponding hotkeycmd using the id
self.notifyicon.hotkeys[message[1][2]-1].execute()
elif message[1][2] in self.ADD_EVENTS:
# if lparam is an add event
window = Window(message[1][3])
self.add_window(self.current_tiler, window)
elif message[1][2] in self.REMOVE_EVENTS:
#if lparam is a remove event
self.handle_remove_event(message[1][3], Monitor.monitor_from_point_in_list(
self.monitors, message[1][5]))
if self.stop:
self.notifyicon.show_balloon('Stopping!', 'PWT')
break
# Grab the next message from the message queue
message = self.notifyicon.windowmessage
except:
logging.exception('Exception occurred')
self.notifyicon.unregister_shellhook() # Unregister shellhook
self.notifyicon.unregister_hotkeys() # Unregister hotkeys
self.decorate_all_tiled_windows() # Decorate windows
self.taskbar.show() # make sure the taskbar is shown on exit
self.notifyicon.destroy() # Remove icon
示例14: make_focused_primary
def make_focused_primary(self):
"""
Moves the focused window to the first place in the masterarea
"""
window = Window.focused_window()
#only move the focused window if it is in the tiler
if window in self.windows:
i = self.windows.index(window)
windowrest = self.windows[:i]
windowrest.extend(self.windows[i+1:])
#shift window location
self.windows[0], self.windows[1:] = self.windows[i], windowrest
self.tile_windows()
if not window.focus():
self.remove_window(window)
示例15: cmd_shift_to_previous_monitor
def cmd_shift_to_previous_monitor(self):
window = Window.focused_window()
if window.validate():
monitor = Monitor.monitor_from_window_in_list(self.monitors, window)
previousMonitor = Utility.previous_item(self.monitors, monitor)
if previousMonitor:
tiler = monitor.tilers[self.group]
previousTiler = previousMonitor.tilers[self.group]
if window in tiler.windows:
tiler.remove_window(window)
if window not in previousTiler.windows:
previousTiler.add_window(window)
window.focus()