[Da...] Posted January 24, 2022 Share Posted January 24, 2022 (edited) Guten Morgen, ich möchte einen ausgelesenen Wert in Form eines Strings oder Array im Dialogfenster, z.B. in Form eines Protokolls ausgeben. Der Wert ist dynamisch und in jedem Projekt anders. Wie kann ich das tun? Anbei der Code: log = [] for t in range(0, Co - 2): print(index,":", gom.app.project.measurement_series[t].name) log.append(gom.app.project.measurement_series[t].name) index = index + 1 #Input-Dialog RESULT=gom.script.sys.execute_user_defined_dialog (content='<dialog>' \ ' <title>Umbenennungstool</title>' \ ' <style></style>' \ ' <control id="OkCancel"/>' \ ' <position></position>' \ ' <embedding></embedding>' \ ' <sizemode></sizemode>' \ ' <size width="292" height="399"/>' \ ' <content columns="1" rows="5">' \ ' <widget column="0" rowspan="1" row="0" columnspan="1" type="label">' \ ' <name>label</name>' \ ' <tooltip></tooltip>' \ ' <text>Index des Messaufbau\'s wählen:</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget column="0" rowspan="1" row="1" columnspan="1" type="display::log">' \ ' <name>log</name>' \ ' <tooltip></tooltip>' \ ' <word_wrap>true</word_wrap>' \ ' <show_save>false</show_save>' \ ' <save_dialog_title>Protokolldatei speichern</save_dialog_title>' \ ' <scroll_automatically>true</scroll_automatically>' \ ' <monospace>false</monospace>' \ ' </widget>' \ ' <widget column="0" rowspan="1" row="2" columnspan="1" type="input::list">' \ ' <name>list</name>' \ ' <tooltip></tooltip>' \ ' <items>' \ ' <item>0</item>' \ ' <item>1</item>' \ ' </items>' \ ' <default>0</default>' \ ' </widget>' \ ' <widget column="0" rowspan="1" row="3" columnspan="1" type="label">' \ ' <name>label_1</name>' \ ' <tooltip></tooltip>' \ ' <text>Wunsch-Buchstabe:</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget column="0" rowspan="1" row="4" columnspan="1" type="input::string">' \ ' <name>input</name>' \ ' <tooltip></tooltip>' \ ' <value>123</value>' \ ' <read_only>false</read_only>' \ ' <password>false</password>' \ ' </widget>' \ ' </content>' \ '</dialog>') Edited January 24, 2022 Link to comment Share on other sites More sharing options...
[Na...] Posted January 24, 2022 Share Posted January 24, 2022 Hallo Daniel, hier ist eine Seite zu Dialogen allgemein: https://connect.gom.com/display/GKB/Scripting+-+User-Defined+Dialogs Im Forum wurde hier schon etwas dazu beschrieben: Gruß, Nanno Link to comment Share on other sites More sharing options...
[Da...] Posted February 2, 2022 Author Share Posted February 2, 2022 Hallo Zusammen, falls jemand vor dem selben Problem steht. Anbei die Lösung: #Mitgebende Variablen log_n = _Additional.AuslesenMessreihen(i_Messreihen, index) RESULT=gom.script.sys.execute_user_defined_dialog (content='<dialog>' \ ' <title>Erstellung Referenzpunktmessung</title>' \ ' <style></style>' \ ' <control id="OkCancel"/>' \ ' <position></position>' \ ' <embedding></embedding>' \ ' <sizemode>automatic</sizemode>' \ ' <size height="282" width="264"/>' \ ' <content rows="7" columns="1">' \ ' <widget column="0" type="label" rowspan="1" columnspan="1" row="0">' \ ' <name>label</name>' \ ' <tooltip></tooltip>' \ ' <text>Index des Messaufbau\'s wählen:</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget column="0" type="label" rowspan="1" columnspan="1" row="1">' \ ' <name>label_2</name>' \ ' <tooltip></tooltip>' \ ' <text>'+ log_n +'</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget column="0" type="input::list" rowspan="1" columnspan="1" row="2">' \ ' <name>list</name>' \ ' <tooltip></tooltip>' \ ' <items>' \ ' <item>0</item>' \ ' <item>1</item>' \ ' </items>' \ ' <default>0</default>' \ ' </widget>' \ ' <widget column="0" type="label" rowspan="1" columnspan="1" row="3">' \ ' <name>label_3</name>' \ ' <tooltip></tooltip>' \ ' <text>Aufbau auswählen:</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget column="0" type="input::list" rowspan="1" columnspan="1" row="4">' \ ' <name>list_1</name>' \ ' <tooltip></tooltip>' \ ' <items>' \ ' <item>'+ Aufbauten[0]['Aufbau'] +' </item>' \ ' <item>'+ Aufbauten[1]['Aufbau'] +'</item>' \ ' <item>'+ Aufbauten[2]['Aufbau'] +'</item>' \ ' <item>'+ Aufbauten[3]['Aufbau'] +'</item>' \ ' <item>'+ Aufbauten[4]['Aufbau'] +'</item>' \ ' <item>'+ Aufbauten[5]['Aufbau'] +'</item>' \ ' <item>'+ Aufbauten[6]['Aufbau'] +'</item>' \ ' <item>'+ Aufbauten[7]['Aufbau'] +'</item>' \ ' </items>' \ ' <default>\'+ Aufbauten[5]['Aufbau'] +\'</default>' \ ' </widget>' \ ' <widget column="0" type="label" rowspan="1" columnspan="1" row="5">' \ ' <name>label_1</name>' \ ' <tooltip></tooltip>' \ ' <text>Wunsch-Buchstabe (Bitte nicht \'H\' oder \'I\'):</text>' \ ' <word_wrap>false</word_wrap>' \ ' </widget>' \ ' <widget column="0" type="input::string" rowspan="1" columnspan="1" row="6">' \ ' <name>input</name>' \ ' <tooltip></tooltip>' \ ' <value></value>' \ ' <read_only>false</read_only>' \ ' <password>false</password>' \ ' </widget>' \ ' </content>' \ '</dialog>') #Ausgabe-Variablen Index_Aufbau = int(RESULT.list) Wunsch = RESULT.input Auswahl_Aufbau = str.strip(RESULT.list_1) Link to comment Share on other sites More sharing options...
[Ma...] Posted February 2, 2022 Share Posted February 2, 2022 Hallo, ich glaube, es geht mit dem erweiterbaren Dialog etwas eleganter: liste = ['Wert_1', 'Wert_2', 'Wert_3', 'Wert_4', 'Wert_5',] wert = "TEST" DIALOG=gom.script.sys.create_user_defined_dialog (content='<dialog>' \ ' <title>Dialogtitel</title>' \ ' <style></style>' \ ' <control id="OkCancel"/>' \ ' <position></position>' \ ' <embedding></embedding>' \ ' <sizemode></sizemode>' \ ' <size height="147" width="220"/>' \ ' <content columns="1" rows="2">' \ ' <widget rowspan="1" type="input::list" column="0" row="0" columnspan="1">' \ ' <name>list</name>' \ ' <tooltip></tooltip>' \ ' <items/>' \ ' <default></default>' \ ' </widget>' \ ' <widget rowspan="1" type="input::string" column="0" row="1" columnspan="1">' \ ' <name>input</name>' \ ' <tooltip></tooltip>' \ ' <value></value>' \ ' <read_only>false</read_only>' \ ' </widget>' \ ' </content>' \ '</dialog>') # # Event handler function called if anything happens inside of the dialog # def dialog_event_handler (widget): pass DIALOG.handler = dialog_event_handler DIALOG.list.items = liste DIALOG.input.value = wert RESULT=gom.script.sys.show_user_defined_dialog (dialog=DIALOG) Gruß Marcus Link to comment Share on other sites More sharing options...
[Da...] Posted February 3, 2022 Author Share Posted February 3, 2022 Danke. Sieht sehr gut. Versuche ich mal unterzubringen. Link to comment Share on other sites More sharing options...
[Da...] Posted February 3, 2022 Author Share Posted February 3, 2022 gom.script.sys.create_user_defined_dialog Definitiv besser als mein Weg. Danke Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in