Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. populate database question
Qt 6.11 is out! See what's new in the release blog

populate database question

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gnngnn
    wrote on last edited by
    #1

    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 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_T 1 Reply Last reply
    0
    • G gnngnn

      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 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_T Offline
      the_T Offline
      the_
      wrote on last edited by
      #2

      @gnngnn
      can you explain what " does not seem to work " means? what do you expect and what do you get? any errors?

      -- No support in PM --

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gnngnn
        wrote on last edited by gnngnn
        #3

        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

        the_T 1 Reply Last reply
        0
        • G gnngnn

          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

          the_T Offline
          the_T Offline
          the_
          wrote on last edited by the_
          #4

          @gnngnn

          For the QComboBox you should connect either QComboBox::activated(int) or QComboBox::currentIndexChanged(int) (see QComboBox::activated and QComboBox::currentIndexChanged ) to a slot which updates the content of your QListWidget

          --
          edit:

          changed from c++ qt doc to python qt doc ;)

          -- No support in PM --

          1 Reply Last reply
          2
          • G Offline
            G Offline
            gnngnn
            wrote on last edited by
            #5

            Many thanks the_!! it's working perfectly :)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved