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
| #!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# StdDlg Inspect v0.02
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
class Pseudo_gist(object):
prev_class = 'QFileDialog'
oper_class = 'QFileSystemModel'
oper_prev = None
def make_root(x):
if x.metaObject().className() == Pseudo_gist.prev_class:
Pseudo_gist.oper_prev = x
if x.metaObject().className() == Pseudo_gist.oper_class:
z = Pseudo_gist.oper_prev
else:
z = x.parent()
a = '{!s} {!s}({!s})'.format(
'None' if z is None else hex(id(z)),
'*' if z is None else
'*' if len(z.objectName()) < 1 else z.objectName(),
'NoneType' if z is None else z.metaObject().className())
b = '{!s} {!s}({!s})'.format(
hex(id(x)),
'*' if len(x.objectName()) < 1 else x.objectName(),
x.metaObject().className())
c = '{!s} ==> {!s}'.format(a, b)
return(c)
def make_tree(x, c=''):
t = []
t.append(c)
for i in x.findChildren(QtCore.QObject):
x = make_root(i)
t.append(x)
return(t)
def build_tree(wdt):
c = make_root(wdt)
z = list()
z.append(c.split(' ')[0])
z_list = list()
z_list.append(c.split(' ')[1])
max_zli = len(z_list[0])
rc = make_tree(wdt, c)
for i in rc:
z_idx = -1
try:
z_idx = z.index(i.split(' ')[0])
except:
z.append(i.split(' ')[0])
else:
if z_idx > -1:
for z_i in range(len(z) - z_idx - 1):
z_item = z.pop()
z.append(i.split(' ')[3])
zli_new = '{!s}{!s}{!s}'.format(
''.rjust(5 * (len(z) - 2)),
'+==> ',
i.split(' ')[4]
)
max_zli = len(zli_new) if len(
zli_new) > max_zli else max_zli
z_list.append(zli_new)
z_list.reverse()
z_prep = list()
for z_list_i in z_list:
z_prep_i = '{!s}{!s}'.format(
z_list_i, '?' * (max_zli - len(z_list_i)))
z_prep.append(z_prep_i)
z_matr = list()
for z_prep_i in z_prep:
z_matr.append(list())
i = 0
for z_matr_i in z_matr:
j = 0
for j in range(max_zli):
z_matr_i.append([z_prep[i][j]])
j += 1
i += 1
z_tran = [[z_matr[j][i] for j in range(len(z_matr))]
for i in range(len(z_matr[0]))]
for z_tran_i in z_tran:
is_plus = False
for x_tran_i in z_tran_i:
if x_tran_i[0] == '+':
is_plus = True
elif x_tran_i[0] != ' ':
is_plus = False
elif is_plus and x_tran_i[0] == ' ':
x_tran_i[0] = '|'
z_retr = [[z_tran[j][i] for j in range(len(z_tran))]
for i in range(len(z_tran[0]))]
z_itgo = list()
for z_retr_i in z_retr:
s_ix = ''
for z_retr_ix in z_retr_i:
if z_retr_ix[0] != '?':
s_ix += z_retr_ix[0]
z_itgo.append(s_ix)
z_itgo.reverse()
for z_itgo_i in z_itgo:
print(z_itgo_i)
def prepare_tree(wdt):
print('- - - tree is ready - - -')
build_tree(wdt)
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
color_dlg = QtWidgets.QColorDialog(None)
color_dlg.setOption(
QtWidgets.QColorDialog.DontUseNativeDialog, True)
QtCore.QTimer.singleShot(
2000, lambda: prepare_tree(color_dlg))
QtCore.QTimer.singleShot(
2500, lambda: color_dlg.close())
color_dlg.exec()
font_dlg = QtWidgets.QFontDialog(None)
font_dlg.setOption(
QtWidgets.QFontDialog.DontUseNativeDialog, True)
QtCore.QTimer.singleShot(
2000, lambda: prepare_tree(font_dlg))
QtCore.QTimer.singleShot(
2500, lambda: font_dlg.close())
font_dlg.exec()
inpt_dlg = QtWidgets.QInputDialog(None)
inpt_dlg.setTextValue('Here is your text')
QtCore.QTimer.singleShot(
2000, lambda: prepare_tree(inpt_dlg))
QtCore.QTimer.singleShot(
2500, lambda: inpt_dlg.close())
inpt_dlg.exec()
mesg_box = QtWidgets.QMessageBox(None)
mesg_box.setText('Something happened?')
mesg_box.setStandardButtons(
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.YesToAll |
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.NoToAll |
QtWidgets.QMessageBox.Open | QtWidgets.QMessageBox.Close)
QtCore.QTimer.singleShot(
2000, lambda: prepare_tree(mesg_box))
QtCore.QTimer.singleShot(
2500, lambda: mesg_box.close())
mesg_box.exec()
file_dlg = QtWidgets.QFileDialog(None)
file_dlg.setOption(
QtWidgets.QFileDialog.DontUseNativeDialog, True)
QtCore.QTimer.singleShot(
2000, lambda: prepare_tree(file_dlg))
QtCore.QTimer.singleShot(
2500, lambda: file_dlg.close())
file_dlg.exec()
sys.exit() |