| 1 |
import os |
| 2 |
import sys |
| 3 |
|
| 4 |
from xml.dom.minidom import parseString |
| 5 |
import PythonQt.QtGui as pqt |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
widgets_text = q.getSelectedWidgetsText() |
| 11 |
|
| 12 |
widgets = [] |
| 13 |
|
| 14 |
widgets = parseString(widgets_text) |
| 15 |
|
| 16 |
|
| 17 |
widgetList = widgets.getElementsByTagName("bsbObject") |
| 18 |
|
| 19 |
if len(widgetList) == 0: |
| 20 |
pqt.QMessageBox.information(0, "Script", "Please select widgets") |
| 21 |
|
| 22 |
|
| 23 |
channel_list = set() |
| 24 |
|
| 25 |
|
| 26 |
for widget in widgetList: |
| 27 |
ch = widget.getElementsByTagName("objectName") |
| 28 |
channel_list.add(" ".join(t.nodeValue for t in ch[0].childNodes if t.nodeType == t.TEXT_NODE)) |
| 29 |
|
| 30 |
|
| 31 |
if "" in channel_list: |
| 32 |
channel_list.remove("") |
| 33 |
out_text = '' |
| 34 |
|
| 35 |
|
| 36 |
for channel in channel_list: |
| 37 |
print(channel) |
| 38 |
out_text += 'k%s invalue "%s"\n'%(channel, channel) |
| 39 |
|
| 40 |
|
| 41 |
q.insertText(out_text) |
| 42 |
|
| 43 |
|