-
Notifications
You must be signed in to change notification settings - Fork 1
/
transfero.py
54 lines (43 loc) · 1.95 KB
/
transfero.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sys
from PyQt5.QtWidgets import QMessageBox, QTabWidget
from PyQt5.QtGui import QIcon
class Transfero(QTabWidget):
def __init__(self, name='Transfero', ax=300, ay=200, aw=1000, ah=500):
super(Transfero, self).__init__()
self.setWindowTitle(name)
self.setGeometry(ax, ay, aw, ah)
# set icon for window
self.setWindowIcon(QIcon(':window_icon/WindowIcon/transfero.png'))
# this method checks whether we unmounted FUSE system or not before actually leaving the program
def closeEvent(self, e):
# check if go-mtpfs is mounted, prevent closing window until unmounting system
go_mtpfs_mounted = self.widget(0).Unmount.isEnabled()
jmtpfs_mounted = self.widget(1).Unmount.isEnabled()
mtpfs_mounted = self.widget(2).Unmount.isEnabled()
if go_mtpfs_mounted:
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setWindowTitle('Warning')
msg.setText('It seems you haven\'t unmounted one of the systems. Please, unmount system(s) and try again.')
msg.setStandardButtons(QMessageBox.Ok)
msg.exec_()
e.ignore()
elif jmtpfs_mounted:
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setWindowTitle('Warning')
msg.setText('It seems you haven\'t unmounted one of the systems. Please, unmount system(s) and try again.')
msg.setStandardButtons(QMessageBox.Ok)
msg.exec_()
e.ignore()
elif mtpfs_mounted:
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setWindowTitle('Warning')
msg.setText('It seems you haven\'t unmounted one of the systems. Please, unmount system(s) and try again.')
msg.setStandardButtons(QMessageBox.Ok)
msg.exec_()
e.ignore()
else:
# close window
e.accept()