Python PyQt5.QtGui 模块,QCursor() 实例源码
我们从Python开源项目中,提取了以下49个代码示例,用于说明如何使用PyQt5.QtGui.QCursor()。
def __init__(self, parent=None):
super(SearchLineEdit, self).__init__()
self.setobjectName("SearchLine")
self.parent = parent
self.setMinimumSize(218, 20)
with open('QSS/searchLine.qss', 'r') as f:
self.setStyleSheet(f.read())
self.button = QPushButton(self)
self.button.setMaximumSize(13, 13)
self.button.setCursor(QCursor(Qt.PointingHandCursor))
self.setTextMargins(3, 0, 19, 0)
self.spaceItem = QSpacerItem(150, 10, QSizePolicy.Expanding)
self.mainLayout = QHBoxLayout()
self.mainLayout.addspacerItem(self.spaceItem)
# self.mainLayout.addStretch(1)
self.mainLayout.addWidget(self.button)
self.mainLayout.addSpacing(10)
self.mainLayout.setContentsMargins(0, 0)
self.setLayout(self.mainLayout)
def remove_templates(self, event):
print_and_log(['Deleting templates: %s' %str(sorted(self.inspect_templates))], 'default', logger)
self.app.setoverrideCursor(QCursor(Qt.WaitCursor))
if len(self.inspect_templates) > 0:
self.to_delete = numpy.concatenate((self.to_delete, self.to_consider[self.inspect_templates]))
self.generate_data()
self.collections = None
self.selected_points = set()
self.selected_templates = set()
self.inspect_points = set()
self.inspect_templates = set()
self.score_ax1.clear()
self.score_ax2.clear()
self.score_ax3.clear()
self.update_lag(self.use_lag)
self.update_data_sort_order()
self.update_detail_plot()
self.update_waveforms()
self.plot_scores()
# do lengthy process
self.app.restoreOverrideCursor()
def pointSpectrum(self):
"""
Get spectrum of selected point.
Note: This function just sets up the signal-slot connection for the \
MPL window. It executes all the way through
Action
------
Left mouse-click : Select vertex point
"""
if self.cid is None:
self.cid = self.img_BW.mpl.mpl_connect('button_press_event',
lambda event: self._pointClick(event, self._pointSpectrumPlot))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
def subtractROIStart(self):
"""
Acquire an average spectrum from a user-selected ROI and subtract.
Note: This function just sets up the signal-slot connection for the \
MPL window. It executes all the way through
"""
if self.cid is None:
# Updated by _roiClick
self.x_loc_list = []
self.y_loc_list = []
self.cid = self.img_BW.mpl.mpl_connect('button_press_event', lambda event: self._roiClick(event, self._roiSubtract))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
def roiSpectrum(self):
"""
Plot spectrum over selected region-of-interest (ROI).
Note: This function just sets up the signal-slot connection for the \
MPL window. It executes all the way through
Action
------
Left mouse-click : Select vertex point
Right mouse-click : Close polygon
"""
if self.cid is None:
# Updated by _roiClick
self.x_loc_list = []
self.y_loc_list = []
self.cid = self.img_BW.mpl.mpl_connect('button_press_event',
lambda event: self._roiClick(event, self._roiSpectrumPlot))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
def modelFromFile(self, fileName):
f = QFile(fileName)
if not f.open(QFile.ReadOnly):
return QStringListModel(self.completer)
QApplication.setoverrideCursor(QCursor(Qt.WaitCursor))
words = []
while not f.atEnd():
line = f.readLine().trimmed()
if line.length() != 0:
try:
line = str(line, encoding='ascii')
except TypeError:
line = str(line)
words.append(line)
QApplication.restoreOverrideCursor()
return QStringListModel(words, self.completer)
def dropEvent(self, event):
"""
Handle 'Drop' event.
"""
if event.mimeData().hasUrls():
B3App.Instance().setoverrideCursor(QCursor(Qt.ArrowCursor))
event.setDropAction(Qt.copyAction)
# multi-drag support
for url in event.mimeData().urls():
path = url.path()
if b3.getPlatform() == 'nt':
# on win32 the absolute path returned for each url has a leading slash: this obvIoUsly
# is not correct on win32 platform when absolute url have the form C:\\Programs\\... (Qt bug?)
path = path.lstrip('/').lstrip('\\')
if os.path.isfile(path):
self.parent().parent().make_new_process(path)
event.accept()
else:
event.ignore()
############################################ TOOLBAR HANDLERS ######################################################
def arrow_hide(self):
self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
def fullscreen(self):
global fullscr
if not MainWindow.isFullScreen():
MainWindow.showFullScreen()
fullscr = 1
self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
self.frame.hide()
self.dockWidget.hide()
else:
MainWindow.showMaximized()
fullscr = 0
self.scrollArea.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.frame.show()
self.dockWidget.show()
def arrow_hide(self):
if ui.player_val == "mplayer" or ui.player_val == "mpv":
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
print("arrow hide")
def show_cursor_Now(self):
MainWindow.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
def mouseMoveEvent(self, event):
self.setFocus()
pos = event.pos()
if self.ui.auto_hide_dock and not self.ui.dockWidget_3.isHidden():
self.ui.dockWidget_3.hide()
if not self.ui.float_window.isHidden() and self.ui.new_tray_widget.remove_toolbar:
if self.ui.float_timer.isActive():
self.ui.float_timer.stop()
if self.ui.new_tray_widget.cover_mode.text() == self.ui.player_buttons['up']:
wid_height = int(self.ui.float_window.height()/3)
else:
wid_height = int(self.ui.float_window.height())
self.ui.new_tray_widget.setMaximumHeight(wid_height)
self.ui.new_tray_widget.show()
self.ui.float_timer.start(1000)
if (self.player_val == "mplayer" or self.player_val == "mpv"):
if self.arrow_timer.isActive():
self.arrow_timer.stop()
self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.arrow_timer.start(2000)
if MainWindow.isFullScreen():
ht = self.height()
if pos.y() <= ht and pos.y() > ht - 5 and self.ui.frame1.isHidden():
self.ui.gridLayout.setSpacing(0)
self.ui.frame1.show()
self.ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
elif pos.y() <= ht-32 and not self.ui.frame1.isHidden():
param_dict = self.ui.get_parameters_value(st='site')
site = param_dict['site']
if site != "Music":
self.ui.frame1.hide()
self.ui.gridLayout.setSpacing(5)
def enterEvent(self, QEvent):
self.setCursor(QCursor(Qt.PointingHandCursor))
def enterEvent(self, QEvent):
self.setCursor(QCursor(Qt.PointingHandCursor))
def nrbFromrOI(self):
"""
Acquire an average spectrum from a user-selected ROI and apply to the \
NRB-- either as the new NRB or averaged with the existing (sender- \
dependent)
Note: This function just sets up the signal-slot connection for the \
MPL window. It executes all the way through
"""
# I found that the objectName is a better way than a reference to the
# actual action (e.g.,self.ui.action_*) as the reference may change
# depending on the call location or how this method is called
sender = self.sender().objectName()
if ((sender == 'actionNRB_from_ROI') or
(sender == 'actionAppend_NRB_from_ROI') or
(sender == 'actionNRB_from_ROI_Left_Side') or
(sender == 'actionNRB_from_ROI_Right_Side')):
# Updated by _roiClick
self.x_loc_list = []
self.y_loc_list = []
# print('Sender: {}'.format(sender))
# print('Sender is actionNRB_from_ROI: {}'.format(sender == self.ui.actionNRB_from_ROI))
# Need to send sender as the text name as the actual object
# will change
if self.cid is None:
self.cid = self.img_BW.mpl.mpl_connect('button_press_event', self._roiNRB, sender))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
else:
print('UnkNown action send to nrbFromrOI')
def _pointClick(self, event, pass_fcn):
"""
Capture single mouse click location in MPL window.
After this function completes,it sends the data (x_pt,y_pt) on to \
the pass_fcn function.
"""
if event.button == 1:
if event.inaxes == self.img_BW.mpl.ax:
#self.tempverts += [[event.xdata,event.ydata]]
x_loc = event.xdata
y_loc = event.ydata
# Send on to a function that will use the collected data
pass_fcn((x_loc, y_loc))
self.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.mpl_disconnect(self.cid)
self.cid = None
else: # Clicked out-of-bounds
pass
# print('Clicked out-of-bounds')
else: # Right-or-middle clicked; thus,cancel
self.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.mpl_disconnect(self.cid)
self.cid = None
def __init__(self, style, str_icon_on, str_icon_off, auto_repeat, size,
receiver, key, str_key):
super(KeyboardKey, self).__init__()
self.__size = size
self.__style = style
self.__icon_on = str_icon_on
self.__icon_off = str_icon_off
self.__auto_repeat = auto_repeat
self.__receiver = receiver
self.__key = key
self.__str_key = str_key
self.set_up_button(style,
receiver, str_key)
self.setCursor(QCursor(Qt.PointingHandCursor))
def contextMenuEvent(self, event):
if self.menu:
del self.menu
self.menu = None
self.menu = self.createStandardContextMenu()
clear_action = QAction("Clear", self.menu)
self.menu.addAction(clear_action) # add clear action
if not self.toPlainText(): # content is None
clear_action.setdisabled(True)
else:
clear_action.setdisabled(False)
clear_action.triggered.connect(self.clear_text) # connect clear event
self.menu.exec(QCursor().pos())
def cursor_timer_timeout(self):
cursor = QtGui.QCursor()
if self.geometry().contains(cursor.pos()):
pass
else:
cursor.setPos(
self.xpos_int + self.width() // 2,
self.ypos_int + self.height() // 2
)
self.setCursor(cursor)
def cursor_timer_timeout(self):
cursor = QtGui.QCursor()
if self.geometry().contains(cursor.pos()):
pass
else:
cursor.setPos(
self.xpos_int + self.width() // 2,
self.ypos_int + self.height() // 2
)
self.setCursor(cursor)
def show_at_cursor(self):
# Get cursor position and move
pos = QtGui.QCursor().pos()
x, y = pos.x() + self.curpos_offset[0], pos.y() + self.curpos_offset[1]
self.move(x, y)
# Show
self.show()
self.raise_()
def dragLeaveEvent(self, event):
"""
Handle 'Drag Leave' event.
"""
B3App.Instance().setoverrideCursor(QCursor(Qt.ArrowCursor))
def enterEvent(self, _):
"""
Executed when the mouse enter the Button.
"""
B3App.Instance().setoverrideCursor(QCursor(Qt.PointingHandCursor))
def leaveEvent(self, _):
"""
Executed when the mouse leave the Button.
"""
B3App.Instance().setoverrideCursor(QCursor(Qt.ArrowCursor))
def leaveEvent(self, _):
"""
Executed when the mouse leave the Button.
"""
B3App.Instance().setoverrideCursor(QCursor(Qt.ArrowCursor))
def mouseMoveEvent(self,event):
global site,MainWindow,ui
pos = event.pos()
px = pos.x()
x = MainWindow.width()
dock_w = ui.dockWidget_3.width()
if ui.orientation_dock == 'right':
if px <= x and px >= x-6:
ui.dockWidget_3.show()
ui.btn1.setFocus()
elif px <= x-dock_w and ui.auto_hide_dock:
ui.dockWidget_3.hide()
if not ui.list1.isHidden():
ui.list1.setFocus()
elif not ui.list2.isHidden():
ui.list2.setFocus()
else:
if px >= 0 and px <= 10:
ui.dockWidget_3.show()
ui.btn1.setFocus()
elif px >= dock_w and ui.auto_hide_dock:
ui.dockWidget_3.hide()
if not ui.list1.isHidden():
ui.list1.setFocus()
elif not ui.list2.isHidden():
ui.list2.setFocus()
if MainWindow.isFullScreen() and not ui.tab_5.isHidden():
ht = self.height()
if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
ui.frame1.show()
ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
elif pos.y() <= ht-32 and not ui.frame1.isHidden():
ui.frame1.hide()
def arrow_hide(self):
global Player
if Player == "mplayer" or Player == "mpv":
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
print("arrow hide")
def mouseMoveEvent(self,event):
global new_tray_widget,ui,idw,mpvplayer
self.setFocus()
pos = event.pos()
if not ui.float_window.isHidden() and new_tray_widget.remove_toolbar:
if ui.float_timer.isActive():
ui.float_timer.stop()
if new_tray_widget.cover_mode.text() == ui.player_buttons['up']:
wid_height = int(ui.float_window.height()/3)
else:
wid_height = int(ui.float_window.height())
new_tray_widget.setMaximumHeight(wid_height)
new_tray_widget.show()
ui.float_timer.start(1000)
if Player == "mplayer" or Player=="mpv":
try:
if str(idw) == str(int(self.winId())):
if self.arrow_timer.isActive():
self.arrow_timer.stop()
self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
if mpvplayer.processId() > 0:
self.arrow_timer.start(2000)
except Exception as e:
print(e)
self.arrow_timer = QtCore.QTimer()
self.arrow_timer.timeout.connect(self.arrow_hide)
self.arrow_timer.setSingleShot(True)
if MainWindow.isFullScreen():
ht = self.height()
#print "height="+str(ht)
#print "y="+str(pos.y())
if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
ui.gridLayout.setSpacing(0)
ui.frame1.show()
#if Player == "mplayer":
ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
elif pos.y() <= ht-32 and not ui.frame1.isHidden() :
ui.frame1.hide()
ui.gridLayout.setSpacing(5)
def arrow_hide(self):
global Player
if Player == "mplayer" or Player == "mpv":
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
print("arrow hide")
def mouseMoveEvent(self,ui
pos = event.pos()
px = pos.x()
x = MainWindow.width()
dock_w = ui.dockWidget_3.width()
if ui.orientation_dock == 'right':
if px <= x and px >= x-6:
ui.dockWidget_3.show()
ui.btn1.setFocus()
elif px <= x-dock_w and ui.auto_hide_dock:
ui.dockWidget_3.hide()
if not ui.list1.isHidden():
ui.list1.setFocus()
elif not ui.list2.isHidden():
ui.list2.setFocus()
else:
if px >= 0 and px <= 10:
ui.dockWidget_3.show()
ui.btn1.setFocus()
elif px >= dock_w and ui.auto_hide_dock:
ui.dockWidget_3.hide()
if not ui.list1.isHidden():
ui.list1.setFocus()
elif not ui.list2.isHidden():
ui.list2.setFocus()
if MainWindow.isFullScreen() and not ui.tab_5.isHidden():
ht = self.height()
if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
ui.frame1.show()
ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
elif pos.y() <= ht-32 and not ui.frame1.isHidden():
ui.frame1.hide()
def arrow_hide(self):
global Player
if Player == "mplayer" or Player == "mpv":
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
print("arrow hide")
def mouseMoveEvent(self,mpvplayer
self.setFocus()
pos = event.pos()
if not ui.float_window.isHidden() and new_tray_widget.remove_toolbar:
if ui.float_timer.isActive():
ui.float_timer.stop()
if new_tray_widget.cover_mode.text() == ui.player_buttons['up']:
wid_height = int(ui.float_window.height()/3)
else:
wid_height = int(ui.float_window.height())
new_tray_widget.setMaximumHeight(wid_height)
new_tray_widget.show()
ui.float_timer.start(1000)
if Player == "mplayer" or Player=="mpv":
try:
if str(idw) == str(int(self.winId())):
if self.arrow_timer.isActive():
self.arrow_timer.stop()
self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
if mpvplayer.processId() > 0:
self.arrow_timer.start(2000)
except Exception as e:
print(e)
self.arrow_timer = QtCore.QTimer()
self.arrow_timer.timeout.connect(self.arrow_hide)
self.arrow_timer.setSingleShot(True)
if MainWindow.isFullScreen():
ht = self.height()
#print "height="+str(ht)
#print "y="+str(pos.y())
if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
ui.gridLayout.setSpacing(0)
ui.frame1.show()
#if Player == "mplayer":
ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
elif pos.y() <= ht-32 and not ui.frame1.isHidden() :
ui.frame1.hide()
ui.gridLayout.setSpacing(5)
def arrow_hide(self):
global Player
if Player == "mplayer" or Player == "mpv":
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
print("arrow hide")
def __init__(self, parent):
super(HomographyResultView, self).__init__(parent)
self.cursor_default = QtGui.QCursor(Qt.CrossCursor)
self.image_loaded = False
new_scene = QtWidgets.QGraphicsScene(self)
new_scene.setBackgroundBrush(QtGui.QBrush(QtGui.QColor(124, 124, 124)))
txt = QtWidgets.QGraphicsSimpleTextItem("Compute homography to see results here.")
new_scene.addItem(txt)
self.setScene(new_scene)
self.show()
def finalize(self, event):
if comm.rank == 0:
self.app.setoverrideCursor(QCursor(Qt.WaitCursor))
self.mpi_wait = comm.bcast(numpy.array([1], dtype=numpy.int32), root=0)
comm.Barrier()
self.all_merges = comm.bcast(self.all_merges, root=0)
self.to_delete = comm.bcast(self.to_delete, root=0)
slice_templates(self.params, to_merge=self.all_merges, to_remove=list(self.to_delete), extension=self.ext_out)
slice_clusters(self.params, self.clusters, extension=self.ext_out, light=True)
if comm.rank == 0:
new_result = {'spiketimes' : {}, 'amplitudes' : {}}
to_keep = set(numpy.unique(self.indices)) - set(self.to_delete)
to_keep = numpy.array(list(to_keep))
for count, temp_id in enumerate(to_keep):
key_before = 'temp_' + str(temp_id)
key_after = 'temp_' + str(count)
new_result['spiketimes'][key_after] = self.result['spiketimes'].pop(key_before)
new_result['amplitudes'][key_after] = self.result['amplitudes'].pop(key_before)
keys = ['spiketimes', 'amplitudes']
if self.params.getboolean('fitting', 'collect_all'):
keys += ['gspikes']
new_result['gspikes'] = io.get_garbage(self.params)['gspikes']
mydata = h5py.File(self.file_out_suff + '.result%s.hdf5' %self.ext_out, 'w', libver='latest')
for key in keys:
mydata.create_group(key)
for temp in new_result[key].keys():
tmp_path = '%s/%s' %(key, temp)
mydata.create_dataset(tmp_path, data=new_result[key][temp])
mydata.close()
mydata = h5py.File(self.file_out_suff + '.templates%s.hdf5' %self.ext_out, 'r+', libver='latest')
version = mydata.create_dataset('version', data=numpy.array([circus.__version__.encode('ascii', 'ignore')]))
maxoverlaps = mydata.create_dataset('maxoverlap', shape=(len(to_keep), len(to_keep)), dtype=numpy.float32)
maxlag = mydata.create_dataset('maxlag', dtype=numpy.int32)
for c, i in enumerate(to_keep):
maxoverlaps[c, :] = self.overlap[i, to_keep]*self.shape[0] * self.shape[1]
maxlag[c, :] = self.lag[i, to_keep]
mydata.close()
self.app.restoreOverrideCursor()
sys.exit(0)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setwindowTitle(_translate("MainWindow", "?????"))
self.groupBox_11.setTitle(_translate("MainWindow", "????"))
self.label_11.setText(_translate("MainWindow", "<html><head/><body><p>1?????????????????DSR?????????</p><p>2????????????????????????ID??????</p><p>3????????????????ID????????????????</p><p>4??????????????????????????????</p></body></html>"))
self.groupBox_12.setTitle(_translate("MainWindow", "????"))
self.label_4.setText(_translate("MainWindow", "?????"))
self.radioButton_1.setText(_translate("MainWindow", "????"))
self.radioButton_1.setChecked(True) #??????
self.radioButton_2.setText(_translate("MainWindow", "????"))
self.pushButton_1.setText(_translate("MainWindow", "??"))
self.label_5.setText(_translate("MainWindow", "?????"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_1), _translate("MainWindow", "??DSR??"))
self.groupBox_21.setTitle(_translate("MainWindow", "????"))
self.label_6.setText(_translate("MainWindow", "?????"))
self.label_7.setText(_translate("MainWindow", "?????"))
self.pushButton_2.setText(_translate("MainWindow", "??"))
self.groupBox_22.setTitle(_translate("MainWindow", "????"))
self.label_2.setText(_translate("MainWindow", "<html><head/><body><p>1????????????????????????&????</p><p>2????????????????????????ID??????</p><p>3????????????????ID????????????????</p><p>4??????????????????????????????</p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), "??????"))
self.groupBox_31.setTitle(_translate("MainWindow", "????"))
self.pushButton_3.setText(_translate("MainWindow", "??"))
self.label_8.setText(_translate("MainWindow", "?????"))
self.label_9.setText(_translate("MainWindow", "?????"))
self.label_10.setText(_translate("MainWindow", "??????"))
self.groupBox_32.setTitle(_translate("MainWindow", "????"))
self.label_3.setText(_translate("MainWindow", "<html><head/><body><p>1????????????????????????????</p><p>2?????????????????????????????????</p><p>3????????1234,https://www.img.jpg??????????????</p><p>4??????????????????????????????????</p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), "??????"))
self.menu_F.setTitle(_translate("MainWindow", "??(F)"))
self.menu_H.setTitle(_translate("MainWindow", "??(H)"))
self.actionopenfile.setText(_translate("MainWindow", "?????"))
self.actionopenfile.setShortcut(_translate("MainWindow", "Ctrl+O"))
self.actionQiut.setText(_translate("MainWindow", "??"))
self.actionQiut.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionAbout.setText(_translate("MainWindow", "??"))
self.actionAuthor.setText(_translate("MainWindow", "??"))
# ?????
self.lineEdit_1.setText("dsr_ids.txt")
self.lineEdit_2.setText("link_ids.txt")
self.lineEdit_31.setText("img_links.txt")
self.lineEdit_32.setText("PICs")
# ?????
for each in [self.lineEdit_1,self.lineEdit_2,self.lineEdit_31]:
each.setToolTip("????????????????")
self.lineEdit_32.setToolTip("??????????????????????")
#??????????
for each in [self.pushButton_1,self.pushButton_2,self.pushButton_3]:
each.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
# ??????
self.mystyle()
def mouseMoveEvent(self, event):
if ui.auto_hide_dock:
ui.dockWidget_3.hide()
self.setFocus()
pos = event.pos()
if not ui.float_window.isHidden() and ui.new_tray_widget.remove_toolbar:
if ui.float_timer.isActive():
ui.float_timer.stop()
if ui.new_tray_widget.cover_mode.text() == ui.player_buttons['up']:
wid_height = int(ui.float_window.height()/3)
else:
wid_height = int(ui.float_window.height())
ui.new_tray_widget.setMaximumHeight(wid_height)
ui.new_tray_widget.show()
ui.float_timer.start(1000)
if ui.player_val == "mplayer" or ui.player_val=="mpv":
try:
idw = ui.get_parameters_value(i='idw')['idw']
if str(idw) == str(int(self.winId())):
if self.arrow_timer.isActive():
self.arrow_timer.stop()
self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
if ui.mpvplayer_val.processId() > 0:
self.arrow_timer.start(2000)
except Exception as e:
print(e)
self.arrow_timer = QtCore.QTimer()
self.arrow_timer.timeout.connect(self.arrow_hide)
self.arrow_timer.setSingleShot(True)
if MainWindow.isFullScreen():
ht = self.height()
if not ui.tab_6.isHidden() or not ui.list2.isHidden() or not ui.list1.isHidden():
if ui.frame1.isHidden():
ui.frame1.show()
else:
if pos.y() <= ht and pos.y()> ht - 5 and ui.frame1.isHidden():
ui.gridLayout.setSpacing(0)
ui.frame1.show()
ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
elif pos.y() <= ht-32 and not ui.frame1.isHidden() :
ui.frame1.hide()
ui.gridLayout.setSpacing(5)
def mouseMoveEvent(self, event):
global site, ui
pos = event.pos()
px = pos.x()
x = self.width()
dock_w = ui.dockWidget_3.width()
if ui.orientation_dock == 'right':
if px <= x and px >= x-6:
ui.dockWidget_3.show()
ui.btn1.setFocus()
logger.info('show options sidebar')
elif px <= x-dock_w and ui.auto_hide_dock:
ui.dockWidget_3.hide()
if not ui.list1.isHidden():
ui.list1.setFocus()
elif not ui.list2.isHidden():
ui.list2.setFocus()
else:
if px >= 0 and px <= 10:
ui.dockWidget_3.show()
ui.btn1.setFocus()
logger.info('show options sidebar')
elif px >= dock_w and ui.auto_hide_dock:
ui.dockWidget_3.hide()
if not ui.list1.isHidden():
ui.list1.setFocus()
elif not ui.list2.isHidden():
ui.list2.setFocus()
if self.isFullScreen() and ui.mpvplayer_val.processId() > 0:
logger.info('FullScreen Window but not video')
if not ui.tab_6.isHidden() or not ui.list2.isHidden() or not ui.list1.isHidden():
if ui.frame1.isHidden():
ui.frame1.show()
else:
ht = self.height()
if pos.y() <= ht and pos.y() > ht - 5 and ui.frame1.isHidden():
ui.frame1.show()
ui.frame1.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
elif pos.y() <= ht-32 and not ui.frame1.isHidden():
if site != 'Music':
ui.frame1.hide()
def setupUi(self, Dialog):
Dialog.setobjectName("Dialog")
Dialog.setwindowModality(QtCore.Qt.ApplicationModal)
Dialog.resize(362, 151)
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
Dialog.setFocusPolicy(QtCore.Qt.NoFocus)
icon = QtGui.QIcon()
icon.addpixmap(QtGui.Qpixmap("../resource/logo.png"), QtGui.QIcon.normal, QtGui.QIcon.Off)
Dialog.setwindowIcon(icon)
Dialog.setLayoutDirection(QtCore.Qt.LeftToRight)
Dialog.setAutoFillBackground(False)
Dialog.setSizegripEnabled(False)
Dialog.setModal(False)
self.docButton = QtWidgets.QPushButton(Dialog)
self.docButton.setGeometry(QtCore.QRect(200, 100, 111, 41))
icon1 = QtGui.QIcon()
icon1.addpixmap(QtGui.Qpixmap("../../../Personal/3641.png"), QtGui.QIcon.Off)
self.docButton.setIcon(icon1)
self.docButton.setobjectName("docButton")
self.tubeButton = QtWidgets.QPushButton(Dialog)
self.tubeButton.setGeometry(QtCore.QRect(50, 41))
icon2 = QtGui.QIcon()
icon2.addpixmap(QtGui.Qpixmap("../../../Personal/YouTube-icon-dark.png"), QtGui.QIcon.Off)
self.tubeButton.setIcon(icon2)
self.tubeButton.setobjectName("tubeButton")
self.label = QtWidgets.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(20, 331, 21))
font = QtGui.QFont()
font.setPointSize(12)
self.label.setFont(font)
self.label.setobjectName("label")
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setGeometry(QtCore.QRect(20, 30, 321, 21))
font = QtGui.QFont()
font.setPointSize(12)
self.label_2.setFont(font)
self.label_2.setobjectName("label_2")
self.label_3 = QtWidgets.QLabel(Dialog)
self.label_3.setGeometry(QtCore.QRect(20, 50, 221, 20))
font = QtGui.QFont()
font.setPointSize(12)
self.label_3.setFont(font)
self.label_3.setobjectName("label_3")
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setGeometry(QtCore.QRect(30, 80, 211, 17))
font = QtGui.QFont()
font.setPointSize(8)
font.setItalic(True)
self.label_4.setFont(font)
self.label_4.setobjectName("label_4")
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)