def leaveEvent(self, _):
"""
Executed when the mouse leave the Button.
"""
B3App.Instance().setOverrideCursor(QCursor(Qt.ArrowCursor))
python类QCursor()的实例源码
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 __init__(self, parent):
super(MySlider, self).__init__(parent)
self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
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 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 __init__(self, parent):
super(MySlider, self).__init__(parent)
self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
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(HomographyView, self).__init__(parent)
self.cursor_default = QtGui.QCursor(Qt.CrossCursor)
self.cursor_hover = QtGui.QCursor(Qt.OpenHandCursor)
self.cursor_drag = QtGui.QCursor(Qt.ClosedHandCursor)
self.image_loaded = False
self.status_label = None
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, to_merge=self.all_merges, to_remove=list(self.to_delete), 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', shape=(len(to_keep), len(to_keep)), 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), _translate("MainWindow", "??????"))
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), _translate("MainWindow", "??????"))
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.Normal, QtGui.QIcon.Off)
self.docButton.setIcon(icon1)
self.docButton.setObjectName("docButton")
self.tubeButton = QtWidgets.QPushButton(Dialog)
self.tubeButton.setGeometry(QtCore.QRect(50, 100, 111, 41))
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap("../../../Personal/YouTube-icon-dark.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.tubeButton.setIcon(icon2)
self.tubeButton.setObjectName("tubeButton")
self.label = QtWidgets.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(20, 10, 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)