Hello,
is it possible to format a dialog box using the command: waptguihelper.message_dialog or another command?
If so, where can I find the available options?
[SOLVED] Customizing a waptguihelper.message_dialog dialog box
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
-
regis.lemonnier
- Messages: 10
- Registration: Oct 15, 2022 - 4:41 p.m.
WAPT version installed: 2.2.1.11957
Server OS: Red Hat Enterprise Linux 8.6
Administration machine OS: Windows 10
Server OS: Red Hat Enterprise Linux 8.6
Administration machine OS: Windows 10
waptguihelper doesn't offer any real customization options...
One question at a time.
Apart from waptguihelper.grid_dialog(..) which allows input in a grid
Alternatively, you can use waptmessage with an HTML form
Example:
setup.py
One question at a time.
Apart from waptguihelper.grid_dialog(..) which allows input in a grid
Code: Select all
Parameters:
- Title: the title for the dialog
- Data: a list or JSON string
Optional:
- ResultType: GRT_ALL or GRT_SELECTED - default is GRT_ALL
- MetaData: it can be used to change columns data type
- it must be a JSON
- all types: String, Date, Time, DateTime, Integer, Float, Boolean, Memo
- example: {"columns":[{"propertyname":"id","datatype":"Integer"}]}
- Text: the label above search box - default is "Search"
- StayOnTop: indicates if the form will always stay on top - default is FalseExample:
setup.py
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
import base64
import json
form = """\
<html encoding="utf8">
<form method="STDOUT">
<h2>Formulaire</h2>
Votre machine :
<input type="text" name="machine" value="%(machine)s"><br>
Votre nom:
<input type="text" name="nom" value="%(nom)s"><br>
Votre prénom:
<input type="text" name="prenom" value="%(prenom)s"><br>
<label for="pet-select">Choose a pet:</label>
<select name="pets" id="pet-select">
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
<option value="parrot">Parrot</option>
<option value="spider">Spider</option>
<option value="goldfish">Goldfish</option>
</select>
<input type="submit" value="Valider">
</form>
</html>
"""
def install():
pass
def update_package():
nom = ''
prenom = ''
machine = get_computername()
pets=''
s = base64.b64encode((form % locals()).encode('utf8'))
result = run(['waptmessage','-c','-b',s])
if result:
data = json.loads(result)
nom = data['result']['nom']
prenom = data['result']['prenom']
machine = data['result']['machine']
pets = data['result']['pets']
print("""\
Nom: %s
Prénom: %s
Machine: %s
Animal: %s
""" % (nom,prenom,machine,pets))
Tranquil IT
-
regis.lemonnier
- Messages: 10
- Registration: Oct 15, 2022 - 4:41 p.m.
Using waptmessage with HTML meets my display needs, but when I use the code portion provided as an example, the "if result" returns 'False' even though the form fields are completed and validated (buttons "Validate" + Ok).
Any idea what caused the failure?
Any idea what caused the failure?
htouvet wrote: ↑July 6, 2023 - 4:27 PM waptguihelper doesn't offer any real customization options...
One question at a time.
Apart from waptguihelper.grid_dialog(..) which allows input in a gridAlternatively, you can use waptmessage with an HTML formCode: Select all
Parameters: - Title: the title for the dialog - Data: a list or JSON string Optional: - ResultType: GRT_ALL or GRT_SELECTED - default is GRT_ALL - MetaData: it can be used to change columns data type - it must be a JSON - all types: String, Date, Time, DateTime, Integer, Float, Boolean, Memo - example: {"columns":[{"propertyname":"id","datatype":"Integer"}]} - Text: the label above search box - default is "Search" - StayOnTop: indicates if the form will always stay on top - default is False
Example:
setup.py
Code: Select all
# -*- coding: utf-8 -*- from setuphelpers import * import base64 import json form = """\ <html encoding="utf8"> <form method="STDOUT"> <h2>Formulaire</h2> Votre machine : <input type="text" name="machine" value="%(machine)s"><br> Votre nom: <input type="text" name="nom" value="%(nom)s"><br> Votre prénom: <input type="text" name="prenom" value="%(prenom)s"><br> <label for="pet-select">Choose a pet:</label> <select name="pets" id="pet-select"> <option value="">--Please choose an option--</option> <option value="dog">Dog</option> <option value="cat">Cat</option> <option value="hamster">Hamster</option> <option value="parrot">Parrot</option> <option value="spider">Spider</option> <option value="goldfish">Goldfish</option> </select> <input type="submit" value="Valider"> </form> </html> """ def install(): pass def update_package(): nom = '' prenom = '' machine = get_computername() pets='' s = base64.b64encode((form % locals()).encode('utf8')) result = run(['waptmessage','-c','-b',s]) if result: data = json.loads(result) nom = data['result']['nom'] prenom = data['result']['prenom'] machine = data['result']['machine'] pets = data['result']['pets'] print("""\ Nom: %s Prénom: %s Machine: %s Animal: %s """ % (nom,prenom,machine,pets))
WAPT version installed: 2.2.1.11957
Server OS: Red Hat Enterprise Linux 8.6
Administration machine OS: Windows 10
Server OS: Red Hat Enterprise Linux 8.6
Administration machine OS: Windows 10
This might be due to the version difference. I tested the code snippet with my development version of Wapt.
You're apparently using version 2.2.
You can try running it manually in a command prompt to see the output (or lack thereof in your case).
You're apparently using version 2.2.
You can try running it manually in a command prompt to see the output (or lack thereof in your case).
Tranquil IT
This works with ensure_unicode
Code: Select all
s = ensure_unicode(base64.b64encode((form % locals()).encode("utf8")))
{"method":"STDOUT","action":"","target":"","enctype":"","result":{"machine":"jpe-clt-win11","nom":"jghjgj","prenom":"","pets":"--Please choose an option--"}} 