Universal Tool Template UI creation syntax

  • now all the creation is using qui function
format self.qui('elementA_ui | elementB_ui', 'parentObj;createOptX,createOptY', 'insertOpt')
self.qui('elementA_ui@label_txt;createOpt')
UI element syntax
QVBoxLayout self.qui('my_vbox')
self.qui('my_layout;vbox')
QHBoxLayout self.qui('my_hbox')
self.qui('my_layout;hbox')
QGridLayout self.qui('my_grid')
self.qui('my_layout;grid')
self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h')
description create and insert those 3 buttons as horizontal row in the grid
self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h')
self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h')
description create 2 rows of button, first row (Box,Sphere,Rig), second row (Box2,Sphere2,Ring2)
self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v')
self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v')
description create 2 column of button, first column (cat,dog,pig), second column (cat2,dog2,pig2)
QFormLayout self.qui('my_form')
self.qui('my_layout;form')
self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form')
description create a name input with label “Name:” and default text “John”, and then create email input with label “Email” and default text “test@test.com” inside entry_form form layout
QSplitter self.qui('user_layout | info_layout', 'my_split;h')
self.qui('user_grp | info_tab', 'my_split;h')
description put user UI and info UI side by side in split,
child can be either a layout or widget
QGroupBox self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data')
description put user UI and info UI inside “my_grp” group box and with internal vbox layout and title as “Personal Data”
Note:no ,() in title
QWidget self.qui('user_label;Name | user_input', 'user_widget;vbox')
description like Groupbox widget, but without a title, useful for hide show a set of UIs
QTabWidget self.qui('client_layout | product_layout', 'database_tab;h', '(Client,Product)')
description put client UI and product UI into database_tab tabwidget, as horizontal tab, with title as “Client”, “Product”, UI can be either widget or layout
QPushButton self.qui('my_btn;Submit')
description create pushbutton with title “Submit”
? self.qui('my_btnMsg')
QLabel self.qui('info_label;Please select all objects')
description a label with text “Please select all objects”
QLineEdit self.qui('user_input;Your Email')
description a line input with default text “Your Email”
QCheckBox self.qui('testOnly_check;Run as Test Only')
description create a check box with title “Run as Test Only”
QComboBox self.qui('objectType_choice;(Box,Sphere,Ring)')
description create a drop down list with option “Box”, “Sphere”, “Ring”
QTextEdit self.qui('comment_txt;Please write details here')
description create a text area with default text “Please write details here”
QListWidget self.qui('name_list')
description note, list has no header and single column
QTreeWidget self.qui('file_tree;(Name,Path)')
description create a tree widget with column names as “Name”, “Path”
QTableWidget self.qui('data_table;(Name,Email,Phone)')
description create a data table with column name as “Name”, “Email”, “Phone”
QSpacerItem self.qui('user_space;(100,30,4,3)')
description create a space item with policy expanding horizontally and normal vertically
# 0 = fixed; 1 > min; 2 < max; 3 = prefered; 4 = <expanding>; 5 = expanding> Aggresive; 6=4 ignored size input

Universal Qt GUI tool dev template

  • universal_tool_template.py: v7 (2016.09.20) my universal tool dev template
    • key feature:
      1. automatically detect whether run in Maya panel mode or Desktop mode and its location
      2. automatically detect to use PySide Qt binding or PyQt4 Qt binding
      3. universal coding format, seamlessly works in all 4 combination conditions
      4. built-in json file operation and format text operation
      5. built-in quickUI() v4.0 features and more example integrated inside, supported nested quickUI without expanding elements
      6. built-in qui() v1.0 features and more example integrated inside
      7. built-in automatically button, menuItem, message button action binding
      8. standalone, frameless, transparent-irregular-win-shape and always-on-top option
      9. drag, move, right-click-menu window interface interaction functions
      10. example of invisible but functional button
      11. automatically use modern style for desktop app
      12. automatically icon load
      13. auto self location detection for both script mode and app mode
    • to do
  • UITranslator tool for Universal Tool Template: (2016.08.18) a UI language json creator
  • 3rd mod UI template:
    • use it As “a quick change template”
      • sometimes, the idea pops, it is just a simple in and out process based on universal tool template
      • rewriting the whole universal_too_template.py becomes a over-kill, thus the idea of a-template-of-THE-template becomes “uni-Pop-corn”, make a app as quickly as like a popcorn
    • use it a simpler way to write Update-To-Date-template-based App
      • with uni-pop-corn template, your app will always be update to date to latest universal_tool_template.py file, no need keep porting the code around for each update of universal_tool_template.py
    • it also containts some quick code to make “some quick text process tool”
      (note: universal_too_template.py (>v6.1.3) and LNTextEdit (>v3.1.2))
      • windows url file to url text

Other Code Snippet

Maya Qt GUI tool dev template

  • installTool.mel: a auto-install-tool-to-shelf script template, that automatically put your python script and icons into shelf

Desktop Qt GUI tool dev template

  • auto (windows) desktop python tool runner, rename the bat name to yourToolName.bat, and put next to your python file
    YourToolName.bat
    @echo off
    call python %~dp0%~n0.py
    pause
  • desktop_tool_template.py: (out of date, replaced by universal_tool_template.py) (2016.07.18) my desktop qt ui tool template
  • text_edit_template.py: (out of date, replaced by universal_tool_template.py) my text edit Type app template

Template related Resource