Forum

Author Topic: Python Feature Request: Processing window  (Read 5339 times)

s093294

  • Newbie
  • *
  • Posts: 23
    • View Profile
Python Feature Request: Processing window
« on: October 17, 2014, 04:56:50 PM »
I am toying with a few extensions that i will provide from python. You already have some nice functions to get user intput.

I think it would be good with a method that could open the processing in progress while I do a heavy background task.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Python Feature Request: Processing window
« Reply #1 on: October 18, 2014, 12:16:47 AM »
Hello s093294,

You can create your own dialog box using build-in PySide module and implement progress bar there.
Best regards,
Alexey Pasumansky,
Agisoft LLC

s093294

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Python Feature Request: Processing window
« Reply #2 on: October 18, 2014, 07:06:27 PM »
Thanks. I will read up about that.


s093294

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Python Feature Request: Processing window
« Reply #3 on: October 20, 2014, 02:43:06 PM »
I tried the follwoing:

from PySide import QtWebKit
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: cannot import name QtWebKit


I wanted to try open a browser window.  Do you have some examples using PySide together with Photoscan. I am new to PySide, so might the issue for me.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Python Feature Request: Processing window
« Reply #4 on: October 20, 2014, 02:48:56 PM »
Hello s093294,

Code: [Select]
from PySide import QtGui, QtCore
import PhotoScan


def process_something():
doc = PhotoScan.app.document
try:
chunk = doc.activeChunk

chunk.matchPhotos("medium")
chunk.alignPhotos()
except:
PhotoScan.app.messageBox("There was a problem processing your request.")

def create_dlg():

app = QtGui.QApplication.instance()
parent = app.activeWindow()
dlg  = QtGui.QDialog(parent)
dlg.setWindowTitle("Test")
dlg.resize(800, 500)

btnQuit = QtGui.QPushButton("&Exit",dlg)
btnQuit.resize(150,50)
btnQuit.move(600,400)

btnP = QtGui.QPushButton("&Process",dlg)
btnP.resize(150,50)
btnP.move(100,400)
lblP = QtGui.QLabel("Aligns photos in current chunk", dlg)
lblP.move(100,450)

QtCore.QObject.connect(btnP, QtCore.SIGNAL("clicked()"), process_something)
QtCore.QObject.connect(btnQuit, QtCore.SIGNAL("clicked()"), dlg, QtCore.SLOT("reject()"))

print("Testing successfull. Dialog created.")
dlg.exec()


label = "New Menu/Custom GUI window"
PhotoScan.app.addMenuItem(label, create_dlg)
Best regards,
Alexey Pasumansky,
Agisoft LLC

s093294

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Python Feature Request: Processing window
« Reply #5 on: October 20, 2014, 04:43:30 PM »
Thanks.

My issue was because i tried a QWebView which is not included.