populate database question
-
Hello all,
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 welcomeprojectsDir= "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()
-
Hello the_,
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 -
For the
QComboBox
you should connect eitherQComboBox::activated(int)
orQComboBox::currentIndexChanged(int)
(see QComboBox::activated and QComboBox::currentIndexChanged ) to a slot which updates the content of yourQListWidget
--
edit:changed from c++ qt doc to python qt doc ;)