-
Notifications
You must be signed in to change notification settings - Fork 62
/
test-mb.py
167 lines (137 loc) · 6.05 KB
/
test-mb.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
from PySide import QtGui, QtCore
# msg_box = QtGui.QMessageBox()
# msg_box.setWindowTitle("Warning")
# msg_box.setText("This will remove ALL Suffix \'.stp\', \'.step\' from selection objects.\nDo you want to continue?")
# #layout = msg_box.layout()
# txtInp = QtGui.QLineEdit(msg_box)
# #layout.addWidget(msg_box.txtInp)
# gl = QtGui.QVBoxLayout()
# gl.addWidget(msg_box.txtInp)
# msg_box.setLayout(gl)
# msg_box.setInformativeText('Informative text.')
# msg_box.setDetailedText("Detailed text.")
# #msg_box.Text.setTextInteractionFlags (QtCore.Qt.TextEditorInteraction) #(QtCore.Qt.NoTextInteraction) # (QtCore.Qt.TextSelectableByMouse)
# msg_box.setIcon(QtGui.QMessageBox.Critical)
# msg_box.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)
# msg_box.setDefaultButton(QtGui.QMessageBox.Cancel)
#
# ret = msg_box.exec_()
import sys
from PySide.QtCore import SIGNAL
from PySide.QtGui import QDialog, QApplication, QPushButton, QLineEdit, QFormLayout, QLabel, QStyle
if 0:
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
#self.setWindowIcon(self.style().standardIcon(QStyle.SP_DirIcon))
#QtGui.QIcon(QtGui.QMessageBox.Critical))
self.txt = QLabel()
self.txt.setText("This will remove ALL Suffix from selection objects. .\nDo you want to continue?\n\n\'suffix\'")
self.le = QLineEdit()
self.le.setObjectName("suffix_filter")
self.le.setText(".step")
self.pb = QPushButton()
self.pb.setObjectName("OK")
self.pb.setText("OK")
self.pbC = QPushButton()
self.pbC.setObjectName("Cancel")
self.pbC.setText("Cancel")
layout = QFormLayout()
layout.addWidget(self.txt)
layout.addWidget(self.le)
layout.addWidget(self.pb)
layout.addWidget(self.pbC)
self.setLayout(layout)
self.connect(self.pb, SIGNAL("clicked()"),self.OK_click)
self.connect(self.pbC, SIGNAL("clicked()"),self.Cancel_click)
self.setWindowTitle("Warning ...")
def OK_click(self):
# shost is a QString object
filtered = self.le.text()
print (filtered)
self.close()
def Cancel_click(self):
# shost is a QString object
filtered = '.stp'
print (filtered)
self.close()
#app = QApplication(sys.argv)
form = Form()
#form.setIcon(QtGui.QMessageBox.Critical)
form.show()
form.exec_()
#app.exec_()
if 1:
import sys
from PySide.QtCore import *
from PySide.QtGui import *
class Widget(QDialog):
def __init__(self, parent= None):
super(Widget, self).__init__(parent, QtCore.Qt.WindowStaysOnTopHint)
#QtGui.QMainWindow.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)
#icon = style.standardIcon(
# QtGui.QStyle.SP_MessageBoxCritical, None, widget)
#self.setWindowIcon(self.style().standardIcon(QtGui.QStyle.SP_MessageBoxCritical))
#self.setIcon(self.style().standardIcon(QtGui.QStyle.SP_MessageBoxCritical))
#self.setIcon(self.style().standardIcon(QStyle.SP_DirIcon))
#QtGui.QIcon(QtGui.QMessageBox.Critical))
#icon = QtGui.QIcon()
#icon.addPixmap(QtGui.QPixmap("icons/157-stats-bars.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
#Widget.setWindowIcon(icon)
self.txt = QLabel()
self.txt.setText("This will remove ALL Suffix from selection objects. \nDo you want to continue?\n\n\'suffix\'")
self.le = QLineEdit()
self.le.setObjectName("suffix_filter")
self.le.setText(".step")
self.pb = QPushButton()
self.pb.setObjectName("OK")
self.pb.setText("OK")
self.pbC = QPushButton()
self.pbC.setObjectName("Cancel")
self.pbC.setText("Cancel")
layout = QVBoxLayout()
layout.addWidget(self.txt)
layout.addWidget(self.le)
layout.addWidget(self.pb)
layout.addWidget(self.pbC)
self.setWindowTitle("Warning ...")
#self.setWindowIcon(self.style().standardIcon(QtGui.QStyle.SP_MessageBoxCritical))
# btn_folder = QPushButton("Folder")
# btn_folder.setIcon(self.style().standardIcon(QStyle.SP_DirIcon))
#
# btn_one = QPushButton("Play")
# btn_one.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay))
#
# btn_two = QPushButton("Stop")
# btn_two.setIcon(self.style().standardIcon(QStyle.SP_MediaStop))
#
# btn_three = QPushButton("Pause")
# btn_three.setIcon(self.style().standardIcon(QStyle.SP_MediaPause))
#layout = QHBoxLayout()
#layout.addWidget(btn_folder)
#layout.addWidget(btn_one)
#layout.addWidget(btn_two)
#layout.addWidget(btn_three)
self.setLayout(layout)
#self.setLayout(layout)
self.connect(self.pb, SIGNAL("clicked()"),self.OK_click)
self.connect(self.pbC, SIGNAL("clicked()"),self.Cancel_click)
def OK_click(self):
# shost is a QString object
filtered = self.le.text()
print (filtered)
self.close()
def Cancel_click(self):
# shost is a QString object
filtered = '.stp'
print (filtered)
self.close()
#mw = FreeCADGui.getMainWindow()
#dialog = Widget(mw)
dialog = Widget()
#dialog.setWindowIcon(dialog.style().standardIcon(QtGui.QStyle.SP_MessageBoxCritical)) #non py3 ok
#my_dialog = QDialog(self)
#my_dialog.exec_()
dialog.show()
#dialog.setModal(True)
#dialog.exec_()