<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Here is an example using signals/slots<br>
    <br>
    <div class="moz-cite-prefix">On 11/12/13 09:56, Janwillem van Dijk
      wrote:<br>
    </div>
    <blockquote cite="mid:52A78016.4020008@xs4all.nl" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">
        <meta name="qrichtext" content="1">
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"><!--StartFragment-->Here is the snippet: It
          reads the filenames in a folder and determines new names for
          photo's based on the exif info.</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;">I apreciate that threading might be a
          solution but the problem seems too simple for that. Can you
          give an example on how to use the signal concept?<br>
        </p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"><br>
          self.outFolder = QFileDialog.getExistingDirectory(</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> caption='Destination folder',
          dir=self.defOutFolder)</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> self.outFiles = []</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> if self.outFolder:</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> self.outFolder =
          self.outFolder.replace('\\', '/')</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> self.lineEdit_dest.setText(self.outFolder)</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> self.progressBar.setRange(0,
          self.numFiles)</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> for i, fname in enumerate(self.inFiles):</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> self.progressBar.setValue(i + 1)</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> newpath, newfname =
          rename_photo(self.inFolder, fname)</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> newpath = path.join(self.outFolder,
          newpath)</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> self.outFiles.append([fname, newpath,
          newfname])</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> s = fname + ' --> ' + self.outFolder +
          '\n'</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> s += path.join(newpath,
          newfname).replace(self.outFolder, '')</p>
        <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
          margin-right:0px; -qt-block-indent:0; text-indent:0px;
          -qt-user-state:0;"> self.plainTextEdit_dest.appendPlainText(s)</p>
        <p style="-qt-paragraph-type:empty; margin-top:0px;
          margin-bottom:0px; margin-left:0px; margin-right:0px;
          -qt-block-indent:0; text-indent:0px;"><br>
          <!--EndFragment--></p>
        <meta http-equiv="Content-Type" content="text/html;
          charset=windows-1252">
        <style type="text/css">
p, li { white-space: pre-wrap; }
</style><br>
        On 10/12/13 21:35, Sean Fisk wrote:<br>
      </div>
      <blockquote
cite="mid:CAF-FwG9y7b-b0w41LfZj=RVRx1D8-3iMFy3J60atu-Q+UGc55Q@mail.gmail.com"
        type="cite">
        <div dir="ltr">
          <div class="markdown-here-wrapper"
            id="markdown-here-wrapper-427098" style="">
            <p style="margin:1.2em 0px!important">Hi Janwillem,</p>
            <p style="margin:1.2em 0px!important">Are you running the
              “lengthy part that processes a files list” within the GUI
              thread? If so, you will probably see your GUI hang while
              this is happening (you won’t be able to click or do
              anything). In this case, you should consider running the
              processing in a different thread using <a
                moz-do-not-send="true"
href="http://seanfisk.github.io/pyside-docs/pyside/PySide/QtCore/QThread.html">QThread</a>
              or <a moz-do-not-send="true"
href="http://seanfisk.github.io/pyside-docs/pyside/PySide/QtCore/QThreadPool.html">QThreadPool</a>.</p>
            <p style="margin:1.2em 0px!important">Can you post the
              relevant part of the code?</p>
            <p style="margin:1.2em 0px!important">Thanks,</p>
          </div>
        </div>
        <div class="gmail_extra"><br clear="all">
          <div>
            <div><br>
            </div>
            <div>--</div>
            <div>Sean Fisk</div>
          </div>
          <br>
          <br>
          <div class="gmail_quote">On Tue, Dec 10, 2013 at 3:17 PM,
            Janwillem van Dijk <span dir="ltr"><<a
                moz-do-not-send="true"
                href="mailto:jwevandijk@xs4all.nl" target="_blank">jwevandijk@xs4all.nl</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> Hi, I have a PySide
                script that uses QFileDialog.getExistingDirectory().
                After clicking the Open button the script proceeds with
                a lengthy part that processes a files list and writes to
                a QPlainTextEdit. Unfortunately the QFileDialog widget
                does only disappear after this processing is finished,
                hiding the QPlainTextEdit.<br>
                <br>
                How can I make that the QFileDialog widget is gone
                before the processing starts?<br>
                <br>
                Cheers, Janwillem<br>
                <br>
                <br>
                <br>
              </div>
              <br>
              _______________________________________________<br>
              PySide mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:PySide@qt-project.org">PySide@qt-project.org</a><br>
              <a moz-do-not-send="true"
                href="http://lists.qt-project.org/mailman/listinfo/pyside"
                target="_blank">http://lists.qt-project.org/mailman/listinfo/pyside</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>