Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
populate database question
gnngnn last edited by
i need to make an ui with QtDesigner for batch editing choosen maya scenes in a database:
when the user change the QComboBox 'EpisodeList',
the QListWidget 'ShotsList' must refreshing for multi selecting shots...
then run a script on selecteds shots when the QPushButton 'OKbtn' is pressed
but as i'm a newbee my python script doesn't seems to work... at all... any help is welcome
projectsDir= "X:/path/" def getWindow(): ptr = mui.MQtUtil.mainWindow() return sip.wrapinstance(long(ptr), QtCore.QObject) uiFile = os.path.join(os.path.dirname(__file__), 'Gui/ProjectManagerQuestion.ui') form_class, base_class = uic.loadUiType(uiFile) class ProjectManagerQuestion(base_class, form_class): def __init__(self, parent = getWindow()): super(base_class, self).__init__(parent) self.setupUi(self) self.setObjectName('Batch Maya Scenes') self.setWindowTitle('Batch Maya Scenes') #list the contents of the directory Episodes = os.listdir(projectsDir) for folders in Episodes : self.EpisodeList.addItem(folders) self.ShotsList.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) QtCore.QObject.connect(self.ShotsList, QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.select_ShotsList) QtCore.QObject.connect(self.OKbtn, QtCore.SIGNAL('clicked()'), self.create_Scenes) QtCore.QObject.connect(self.cancelbtn, QtCore.SIGNAL('clicked()'), self.closeApp) self.show() def select_ShotsList(self, *args): sel_Shots = [ str(eachref.text()) for eachref in self.ShotsList.selectedItems() ] sel_Shots_List =  for eachref in sel_Shots: print sel_Shots def create_Scenes(self, *args): print 'create_Scenes' def closeApp(self, *args): self.close()
the_ last edited by
can you explain what " does not seem to work " means? what do you expect and what do you get? any errors?
gnngnn last edited by gnngnn
first I don't know how to record the QComboBox named 'EpisodeList' when the user change it
and how to make this entry refreshing the QListWidget 'ShotsList'
but maybe i d'ont have the good vocabulary to explain,
i dont have any errors , as it doesn't do anything
the_ last edited by the_
QComboBoxyou should connect either
QComboBox::currentIndexChanged(int)(see QComboBox::activated and QComboBox::currentIndexChanged ) to a slot which updates the content of your
changed from c++ qt doc to python qt doc ;)
gnngnn last edited by
Many thanks the_!! it's working perfectly :)