/
debugInfo.py
88 lines (65 loc) · 2.32 KB
/
debugInfo.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
import FreeCAD
import FreeCADGui as Gui
# ############################################################################
# This part of code has been created by Werner Mayer (wmayer) at forum:
# https://forum.freecadweb.org/viewtopic.php?p=187448#p187448
# ############################################################################
from PySide import QtCore
from PySide import QtGui
class AboutInfo(QtCore.QObject):
def eventFilter(self, obj, ev):
if obj.metaObject().className() == "Gui::Dialog::AboutDialog":
if ev.type() == ev.ChildPolished:
mo = obj.metaObject()
index = mo.indexOfMethod("on_copyButton_clicked()")
if index > 0:
mo.invokeMethod(obj, "on_copyButton_clicked")
QtGui.qApp.postEvent(obj, QtGui.QCloseEvent())
return False
ai=AboutInfo()
QtGui.qApp.installEventFilter(ai)
Gui.runCommand("Std_About")
QtGui.qApp.removeEventFilter(ai)
# ############################################################################
# by dprojects below:
# ############################################################################
def showQtGUI():
class QtMainClass(QtGui.QDialog):
def __init__(self):
super(QtMainClass, self).__init__()
self.initUI()
def initUI(self):
# main window
self.result = userCancelled
self.setGeometry(450, 100, 410, 500)
self.setWindowTitle("Platform details for bug report")
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
# output
Info = ""
Info += "Has been copied to clipboard: \n"
self.oInfo1 = QtGui.QLabel(Info, self)
self.oInfo1.move(5, 10)
self.o = QtGui.QTextEdit(self)
self.o.setMinimumSize(400, 350)
self.o.setMaximumSize(400, 350)
self.o.move(5, 40)
self.o.setPlainText("")
self.o.paste()
Info = ""
Info += "Note: \n\n"
Info += "CTRL-V - to paste it at your forum topic \n\n"
Info += "CTRL-A, CTRL-C - to copy again"
self.oInfo2 = QtGui.QLabel(Info, self)
self.oInfo2.move(5, 400)
# show
self.show()
userCancelled = "Cancelled"
userOK = "OK"
form = QtMainClass()
form.exec_()
if form.result == userCancelled:
pass
# ###################################################################################################################
# MAIN
# ###################################################################################################################
showQtGUI()