How to make a password control in Houdini?

   1866   6   0
User Avatar
Member
75 posts
Joined: Oct. 2018
Offline
Hi guys,

I need to make a login GUI in Houdini so that users can input their usename and password to log into our internal server to download assets for editing. The username control is easy but the password one is hard in that it needs to mask the input, e.g. with ‘*’. Is there any way to make this happen? Thanks for any inputs!

I'm working on Houdini 16.5 and our plugin needs to know the login status, so it's better that the suggested way can communicate the status between C++ code.

Thanks,
Quan
User Avatar
Member
75 posts
Joined: Oct. 2018
Offline
I also tried to get the password control and then addInterest to its VALUE CHANGE event, by following the doc here:
https://www.sidefx.com/docs/hdk/_h_d_k__u_i_native.html#HDK_UINative_Glue_GetGadget [www.sidefx.com]


But the problem is that, in my Houdini 16.5 Core installation, I couldn't find the actual definition of UI_Feel. Any thoughts?
Edited by quchen - March 18, 2019 04:46:44

Attachments:
cantfinduifeel.png (108.7 KB)

User Avatar
Member
75 posts
Joined: Oct. 2018
Offline
Can anyone help? Thanks a million!
User Avatar
Member
75 posts
Joined: Oct. 2018
Offline
Although I could get the UI_Feel object of the password control by doing this in the .ui file and corresponding .c file:
in .ui
password.gad = STRING_FIELD “Password”:LABEL_WIDTH VALUE(password.val) HSTRETCH;
in .c:
myPasswordGad = getFeelSymbol(“password.gad”);

But the problem is that I couldn't register a value change event for it as UI_Feel is not derived from the UI_Object:
//myPasswordVal.addInterest(myPasswordGad, CHANGECB(passwordValChanged)); ==> this won't compile.

So the new question is: how can I register a callback to handle the value change event of an edit control?
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
you could do this with python/pyside in a shelf tool.
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Staff
397 posts
Joined: Feb. 2018
Offline
Hi,

Following Michael's suggestion, here's a little demo for implementing a tool password dialog with python

import hou
from PySide2 import QtWidgets
from PySide2.QtWidgets import QApplication, QDialog, QLineEdit, QPushButton

class PasswordDialog(QDialog):
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.setWindowTitle("Type a password")
        
        pw = QtWidgets.QLineEdit()
        pw.setEchoMode(QtWidgets.QLineEdit.Password)

        vlayout =  QtWidgets.QVBoxLayout()        
        vlayout.addWidget(pw)
        self.setLayout(vlayout)        
        
pwd= PasswordDialog(hou.ui.mainQtWindow())
pwd.show()
User Avatar
Member
75 posts
Joined: Oct. 2018
Offline
Thank you Marc and Michael for the idea and demo code! Really helpful.
Next I will look into how to interact the C++ side, e.g. I will need to keep the connection status and update it on GUI. Any suggestion is appreciated!
  • Quick Links