本文整理汇总了Python中Window.activateFakewin方法的典型用法代码示例。如果您正苦于以下问题:Python Window.activateFakewin方法的具体用法?Python Window.activateFakewin怎么用?Python Window.activateFakewin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Window
的用法示例。
在下文中一共展示了Window.activateFakewin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open_it
# 需要导入模块: import Window [as 别名]
# 或者: from Window import activateFakewin [as 别名]
def open_it(self):
Window.activateFakewin(self.fakewin.winId())
self.plugin=False
self.sys_win.close()
self.open_win.close()
self.dock_options_win.close()
while self.pos_x<self.s_width/3-5:
self.current_state='nothing'
if self.pos_x<self.s_width/7:
self.pos_x=self.s_width/7
else:
self.pos_x+=float(self.conf["animation-speed"])
self.setGeometry(0,self.top_pos,self.s_width/3+5,self.s_height)
self.update()
QtGui.QApplication.processEvents()
if self.pos_x!=self.s_width/3-2 :
self.pos_x=self.s_width/3-2
self.current_state="open"
if self.activity=="apps":
self.allApps=Apps.info(self.current_text)
self.setAttribute(QtCore.Qt.WA_X11NetWmWindowTypeDock,False)
self.windowActivationChange(True)
self.resetInputContext()
self.webview.setEnabled(True)
self.webview.setFocus(True)
self.webview.resetInputContext()
self.update()
self.windowActivationChange(True)
QtGui.QApplication.processEvents()
示例2: open_it
# 需要导入模块: import Window [as 别名]
# 或者: from Window import activateFakewin [as 别名]
def open_it(self):
Window.activateFakewin(self.fakewin.winId())
self.sys_win.close()
self.open_win.close()
while self.pos_x<self.s_width/3:
self.current_state='nothing'
if self.pos_x<self.s_width/7:
self.pos_x=self.s_width/7
else:
self.pos_x+=1.5
self.setGeometry(0,self.top_pos,self.s_width/3+5,self.s_height)
self.update()
QtGui.QApplication.processEvents()
self.current_state="open"
if self.activity=="apps":
self.allApps=Apps.info(self.current_text)
self.update()
示例3: wheelEvent
# 需要导入模块: import Window [as 别名]
# 或者: from Window import activateFakewin [as 别名]
def wheelEvent(self,e):
Window.activateFakewin(self.fakewin.winId())
if self.activity == 'apps':
value= int(e.delta()/120)
max_pages=math.trunc((len(self.allApps)-1)/self.apps_per_page)
if value>0 and self.app_page_state>0:
self.app_page_state-=1
if value<0 and self.app_page_state<max_pages:
self.app_page_state+=1
self.update()
QtGui.QApplication.processEvents()
if self.activity == 'files':
value= int(e.delta()/120)
max_pages=math.trunc(len(self.Files.all())/self.apps_per_page)
if value>0 and self.files_page_state>0:
self.files_page_state-=1
if value<0 and self.files_page_state<max_pages:
self.files_page_state+=1
self.update()
QtGui.QApplication.processEvents()
示例4: mouseReleaseEvent
# 需要导入模块: import Window [as 别名]
# 或者: from Window import activateFakewin [as 别名]
def mouseReleaseEvent(self,e):
x_m,y_m = e.x(),e.y()
self.drawAppRect=False
Window.activateFakewin(self.fakewin.winId())
#While moving
if self.current_state=="nothing":
if self.plugin==False:
self.webview.hide()
self.move=False
###sets position to right one
pos_list = [self.HALF_OPEN_POS, self.s_width/3]
closest = min(pos_list, key=lambda x: abs(x-self.pos_x))
if closest<self.pos_x:
while closest<self.pos_x:
self.pos_x-=5
self.setGeometry(0,self.top_pos,self.pos_x+7,self.s_height)
QtGui.QApplication.processEvents()
self.update()
self.pos_x=closest
QtGui.QApplication.processEvents()
self.update()
elif closest>self.pos_x:
while closest>self.pos_x:
self.pos_x+=5
self.setGeometry(0,self.top_pos,self.pos_x+7,self.s_height)
QtGui.QApplication.processEvents()
self.update()
self.pos_x=closest
QtGui.QApplication.processEvents()
self.update()
##set the current state
if self.pos_x==self.HALF_OPEN_POS:
self.pos_x-=3
self.dock_apps = Apps.find_info(self.conf['dock-apps'])
self.current_state="half_open"
elif self.pos_x==self.s_width/3:
self.pos_x-=3
self.current_state="open"
else: self.current_state="nothing"
if self.plugin==True and self.current_state=='open' and self.activity=='apps':
self.webview.show()
if self.plugin==False and self.current_state=='open' and self.activity=='apps':
self.current_text=""
self.initApps()
#Events
#
elif self.current_state=="open":
if self.pos_x-14<x_m<self.pos_x and self.move==False and e.button()==QtCore.Qt.LeftButton:
self.close_it()
if y_m>self.s_height-13:
print("[Duck Launcher] Saving configuration.")
Config.check_dict(self.conf)
QtGui.QApplication.processEvents()
print("[Duck Launcher] Quitting, Good Bye!")
QtGui.qApp.quit()
###app events
elif self.activity==False and self.plugin==True:
self.webview.show()
elif self.activity == "files":
pass
elif self.activity=="star":
blocks=pickle.loads(Config.get()["blocks"])
all_rows=0
apps_per_row = math.trunc(((self.s_width/3)-30)/int(self.conf["icon-size"]))
for i,b in enumerate(blocks):
all_stuff = Config.get_from_block(b)
if len(all_stuff)!=apps_per_row:
row_num = math.trunc(len(all_stuff)/apps_per_row)+1
else:
row_num = math.trunc(len(all_stuff)/apps_per_row)
h=int(self.conf["icon-size"])*all_rows+i*50
all_rows+=row_num
for j, thing in enumerate(all_stuff):
row_pos = math.trunc(j/apps_per_row)
x_pos = int(self.conf["icon-size"])*(j-(row_pos*apps_per_row))+40
y_pos = (row_pos*int(self.conf["icon-size"])+20)+h+30
if x_pos-10<x_m<x_pos-10+int(self.conf["icon-size"]) and y_pos<y_m<y_pos+int(self.conf["icon-size"]) and x_m<self.pos_x-self.SIZE-3:
if e.button()==QtCore.Qt.LeftButton:
if thing['type']=='app':
the_exec=""
for a in Apps.info(''):
if thing['value'] in a['name']:
the_exec=a['exec']
thread = Launch(parent=self)
thread.app=the_exec
thread.start()
print("[Duck Launcher] Launching '{0}' with '{1}'".format(thing["value"], the_exec) )
else:
import webbrowser
webbrowser.open(thing['value'])
elif self.current_state=="half_open":
##buttons
if self.pos_x-self.SIZE<x_m<self.pos_x and self.move==False and self.s_height/2-20<y_m<self.s_height/2+20:
self.activity="apps"
self.current_text=""
self.open_it()
self.initApps()
#.........这里部分代码省略.........
示例5: mouseReleaseEvent
# 需要导入模块: import Window [as 别名]
# 或者: from Window import activateFakewin [as 别名]
def mouseReleaseEvent(self,e):
x_m,y_m = e.x(),e.y()
self.drawAppRect=False
Window.activateFakewin(self.fakewin.winId())
#While moving
if self.current_state=="nothing":
self.move=False
###sets position to right one
pos_list = [self.HALF_OPEN_POS, self.s_width/3]
closest = min(pos_list, key=lambda x: abs(x-self.pos_x))
if closest<self.pos_x:
while closest<self.pos_x:
self.pos_x-=5
self.setGeometry(0,self.top_pos,self.pos_x+self.SIZE/2,self.s_height)
QtGui.QApplication.processEvents()
self.update()
self.pos_x=closest
QtGui.QApplication.processEvents()
self.update()
elif closest>self.pos_x:
while closest>self.pos_x:
self.pos_x+=5
self.setGeometry(0,self.top_pos,self.pos_x+self.SIZE/2,self.s_height)
QtGui.QApplication.processEvents()
self.update()
self.pos_x=closest
QtGui.QApplication.processEvents()
self.update()
##set the current state
if self.pos_x==self.HALF_OPEN_POS:
self.current_state="half_open"
self.update_all()
elif self.pos_x==self.s_width/3:
self.current_state="open"
else: self.current_state="nothing"
#Events
#
elif self.current_state=="open":
if self.pos_x-self.SIZE<x_m<self.pos_x and self.move==False and e.button()==QtCore.Qt.LeftButton:
self.close_it()
if y_m>self.s_height-13:
print("Quiting")
sys.exit()
###app events
if self.activity == "apps":
max_apps= math.trunc((len(self.allApps)-1)/self.apps_per_page)+1
##Change Page
for i in range(0,max_apps):
btn_size = 20
x_pos = self.s_width/6-btn_size+(btn_size*i)
if x_pos<x_m<x_pos+btn_size and 2<y_m<2+btn_size:
self.app_page_state=i
self.update()
QtGui.QApplication.processEvents()
## launch apps
for i, app in enumerate(self.allApps):
app_page = math.trunc(i/self.apps_per_page)
if app_page==self.app_page_state:
row_pos = math.trunc(i/self.apps_per_row)
x_pos = self.ICON_SIZE*(i-(row_pos*self.apps_per_row))+30
y_pos = row_pos*self.ICON_SIZE+30-(app_page*(self.ICON_SIZE*self.apps_per_col))
if x_pos<x_m<(x_pos+self.ICON_SIZE) and y_pos<y_m<(y_pos+self.ICON_SIZE) and x_m<self.pos_x-self.SIZE-3:
if e.button()==QtCore.Qt.LeftButton:
print("Launching '{0}' with '{1}'".format(app["name"],app["exec"]) )
thread = Launch(parent=self)
thread.app=app["exec"]
thread.start()
self.close_it()
if self.activity == "files":
if self.s_width/3-80-self.SIZE<x_m<self.s_width/3-50-self.SIZE and 10<y_m<30:
l= self.Files.directory.split("/")[:-1][1:]
new_dir=''
for a in l:
new_dir+='/'
new_dir+=a
if new_dir=='':new_dir='/'
self.files_page_state=0
self.Files.directory=new_dir
self.update()
if self.s_width/3-40-self.SIZE<x_m<self.s_width/3-self.SIZE and 10<y_m<30:
self.Files.directory = self.Files.default
self.files_page_state=0
self.update()
max_files= math.trunc(len(self.Files.all())/self.apps_per_page)+1
##Change Page
for i in range(0,max_files):
btn_size = 20
x_pos = self.s_width/6-btn_size+(btn_size*i)
if x_pos<x_m<x_pos+btn_size and 2<y_m<2+btn_size:
self.files_page_state=i
self.update()
QtGui.QApplication.processEvents()
## launch apps
for i, f in enumerate(self.Files.all()):
app_page = math.trunc(i/self.apps_per_page)
if app_page==self.files_page_state:
row_pos = math.trunc(i/self.apps_per_row)
x_pos = self.ICON_SIZE*(i-(row_pos*self.apps_per_row))+30
y_pos = row_pos*self.ICON_SIZE+30-(app_page*(self.ICON_SIZE*self.apps_per_col))
if x_pos<x_m<(x_pos+self.ICON_SIZE) and y_pos<y_m<(y_pos+self.ICON_SIZE) and x_m<self.pos_x-self.SIZE-3:
#.........这里部分代码省略.........
示例6: mouseReleaseEvent
# 需要导入模块: import Window [as 别名]
# 或者: from Window import activateFakewin [as 别名]
def mouseReleaseEvent(self,e):
x_m,y_m = e.x(),e.y()
self.drawAppRect=False
Window.activateFakewin(self.fakewin.winId())
#While moving
''''
if self.current_state=="nothing":
if self.plugin==False:
self.webview.hide()
self.move=False
###sets position to right one
pos_list = [self.HALF_OPEN_POS, self.s_width/3]
closest = min(pos_list, key=lambda x: abs(x-self.pos_x))
if closest<self.pos_x:
while closest<self.pos_x:
self.pos_x-=5
self.setGeometry(0,self.top_pos,self.pos_x+9,self.s_height)
QtGui.QApplication.processEvents()
self.update()
self.pos_x=closest
QtGui.QApplication.processEvents()
self.update()
elif closest>self.pos_x:
while closest>self.pos_x:
self.pos_x+=5
self.setGeometry(0,self.top_pos,self.pos_x+9,self.s_height)
QtGui.QApplication.processEvents()
self.update()
self.pos_x=closest
QtGui.QApplication.processEvents()
self.update()
##set the current state
if self.pos_x==self.HALF_OPEN_POS:
self.pos_x-=3
#self.dock_apps = Apps.find_info(self.conf['dock-apps'])
self.current_state="half_open"
elif self.pos_x==self.s_width/3:
self.pos_x-=3
self.current_state="open"
else: self.current_state="nothing"
if self.plugin==True and self.current_state=='open' and self.activity=='apps':
self.webview.show()
if self.plugin==False and self.current_state=='open' and self.activity=='apps':
self.current_text=""
#self.initApps()
'''
#Events
#
if self.current_state=="open":
if self.pos_x-14<x_m<self.pos_x and self.move==False and e.button()==QtCore.Qt.LeftButton:
self.close_it()
if y_m>self.s_height-13:
print("[Duck Launcher] Saving configuration.")
c = Config.check_dict(self.conf)
QtGui.QApplication.processEvents()
print("[Duck Launcher] Quitting, Good Bye!")
QtGui.qApp.quit()
###app events
if self.activity == "apps" and self.plugin==False:
max_apps= math.trunc((len(self.allApps)-1)/self.apps_per_page)+1
minus = math.trunc(len(self.allApps)/self.apps_per_page)*15/2
##Change Page
for i in range(0,max_apps):
btn_size = 15
x_pos = self.s_width/6-btn_size+(btn_size*i)-minus
if x_pos<x_m<x_pos+btn_size and 12<y_m<btn_size+12:
self.app_page_state=i
self.update()
QtGui.QApplication.processEvents()
for i, app in enumerate(self.allApps):
app_page = math.trunc(i/self.apps_per_page)
if app_page==self.app_page_state:
row_pos = math.trunc(i/self.apps_per_row)
page_row_pos=row_pos-(self.apps_per_page/self.apps_per_row*app_page)
col_pos=(i-(row_pos*self.apps_per_row))
x_pos = self.ICON_SIZE*col_pos+30+col_pos*10
y_pos = page_row_pos*self.ICON_SIZE+45+page_row_pos*10
if x_pos<x_m<x_pos+int(self.conf["icon-size"]) and y_pos<y_m<y_pos+int(self.conf["icon-size"]):
if e.button()==QtCore.Qt.LeftButton:
print("[Duck Launcher] Launching '{0}' with '{1}'".format(app["name"],app["exec"]) )
thread = Widgets.Launch(parent=self)
thread.app=app["exec"]
thread.start()
self.close_it()
elif self.activity=="star":
blocks=pickle.loads(Config.get()["blocks"])
all_rows=0
apps_per_row = math.trunc(((self.s_width/3)-30)/int(self.conf["icon-size"]))
for i,b in enumerate(blocks):
all_stuff = Config.get_from_block(b)
if len(all_stuff)!=apps_per_row:
row_num = math.trunc(len(all_stuff)/apps_per_row)+1
else:
row_num = math.trunc(len(all_stuff)/apps_per_row)
h=int(self.conf["icon-size"])*all_rows+i*50
all_rows+=row_num
#.........这里部分代码省略.........