Strange, I don't get this error when using pure Python, only when using PyQt. 

Can anyone tell me what is going on here?  Thanks!





 File "/acct/pjb9508/RAT/Scripts/PyQt/RatDialog.py", line 30, in NewClipButton_clicked
    self.rat.planeClip(self.o,"SQUARE"+str(self.squareCounter),width,origin)
  File "/acct/pjb9508/RAT/Scripts/PyQt/rat.py", line 12, in planeClip
    plane1[1] = origin[1]-width
TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'


--

Peter Bismuti
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'Dialog.ui'
#
# Created: Thu Mar 16 09:42:22 2006
#      by: The PyQt User Interface Compiler (pyuic) 3.13
#
# WARNING! All changes made in this file will be lost!


from qt import *


class Dialog(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("Dialog")


        DialogLayout = QGridLayout(self,1,1,11,6,"DialogLayout")

        layout14 = QVBoxLayout(None,0,6,"layout14")

        layout13 = QHBoxLayout(None,0,6,"layout13")

        self.ClipListView = QListView(self,"ClipListView")
        self.ClipListView.addColumn(self.__tr("Column 1"))
        layout13.addWidget(self.ClipListView)

        self.ClipTextEdit = QTextEdit(self,"ClipTextEdit")
        layout13.addWidget(self.ClipTextEdit)
        layout14.addLayout(layout13)

        layout10 = QHBoxLayout(None,0,6,"layout10")

        layout9 = QVBoxLayout(None,0,6,"layout9")

        layoutWidth = QHBoxLayout(None,0,6,"layoutWidth")

        self.WidthLabel = QLabel(self,"WidthLabel")
        layoutWidth.addWidget(self.WidthLabel)

        self.WidthLineEdit = QLineEdit(self,"WidthLineEdit")
        layoutWidth.addWidget(self.WidthLineEdit)
        layout9.addLayout(layoutWidth)

        layout5 = QVBoxLayout(None,0,6,"layout5")

        self.OriginLabel = QLabel(self,"OriginLabel")
        self.OriginLabel.setAlignment(QLabel.WordBreak | QLabel.AlignCenter)
        layout5.addWidget(self.OriginLabel)

        layoutX = QHBoxLayout(None,0,6,"layoutX")

        self.XLabel = QLabel(self,"XLabel")
        layoutX.addWidget(self.XLabel)

        self.XLineEdit = QLineEdit(self,"XLineEdit")
        layoutX.addWidget(self.XLineEdit)
        layout5.addLayout(layoutX)

        layoutY = QHBoxLayout(None,0,6,"layoutY")

        self.YLabel = QLabel(self,"YLabel")
        layoutY.addWidget(self.YLabel)

        self.YLineEdit = QLineEdit(self,"YLineEdit")
        layoutY.addWidget(self.YLineEdit)
        layout5.addLayout(layoutY)

        layoutZ = QHBoxLayout(None,0,6,"layoutZ")

        self.ZLabel = QLabel(self,"ZLabel")
        layoutZ.addWidget(self.ZLabel)

        self.ZLineEdit = QLineEdit(self,"ZLineEdit")
        layoutZ.addWidget(self.ZLineEdit)
        layout5.addLayout(layoutZ)
        layout9.addLayout(layout5)
        layout10.addLayout(layout9)

        self.ButtonGroup = QButtonGroup(self,"ButtonGroup")

        self.CircleRadioButton = QRadioButton(self.ButtonGroup,"CircleRadioButton")
        self.CircleRadioButton.setGeometry(QRect(20,50,56,21))

        self.SquareRadioButton = QRadioButton(self.ButtonGroup,"SquareRadioButton")
        self.SquareRadioButton.setGeometry(QRect(20,20,64,21))
        self.SquareRadioButton.setChecked(1)
        layout10.addWidget(self.ButtonGroup)
        layout14.addLayout(layout10)

        layout11 = QHBoxLayout(None,0,6,"layout11")

        self.NewClipButton = QPushButton(self,"NewClipButton")
        layout11.addWidget(self.NewClipButton)

        self.DeleteClipButton = QPushButton(self,"DeleteClipButton")
        layout11.addWidget(self.DeleteClipButton)

        self.CloseButton = QPushButton(self,"CloseButton")
        layout11.addWidget(self.CloseButton)
        layout14.addLayout(layout11)

        DialogLayout.addLayout(layout14,0,0)

        self.languageChange()

        self.resize(QSize(340,427).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.NewClipButton,SIGNAL("clicked()"),self.NewClipButton_clicked)
        self.connect(self.DeleteClipButton,SIGNAL("clicked()"),self.DeleteClipButton_clicked)
        self.connect(self.CloseButton,SIGNAL("clicked()"),self.CloseButton_clicked)


    def languageChange(self):
        self.setCaption(self.__tr("RAT"))
        self.ClipListView.header().setLabel(0,self.__tr("Column 1"))
        self.ClipListView.clear()
        item = QListViewItem(self.ClipListView,None)
        item.setText(0,self.__tr("New Item"))

        self.WidthLabel.setText(self.__tr("<b>Width/Radius</b>"))
        self.OriginLabel.setText(self.__tr("<b>Origin</b>"))
        self.XLabel.setText(self.__tr("<b>X</b>"))
        self.YLabel.setText(self.__tr("<b>Y</b>"))
        self.ZLabel.setText(self.__tr("<b>Z</b>"))
        self.ButtonGroup.setTitle(self.__tr("Clip Type"))
        self.CircleRadioButton.setText(self.__tr("Circle"))
        self.SquareRadioButton.setText(self.__tr("Square"))
        self.NewClipButton.setText(self.__tr("New"))
        self.DeleteClipButton.setText(self.__tr("Delete"))
        self.CloseButton.setText(self.__tr("Close"))


    def NewClipButton_clicked(self):
        print "Dialog.NewClipButton_clicked(): Not implemented yet"

    def DeleteClipButton_clicked(self):
        print "Dialog.DeleteClipButton_clicked(): Not implemented yet"

    def CloseButton_clicked(self):
        print "Dialog.CloseButton_clicked(): Not implemented yet"

    def __tr(self,s,c = None):
        return qApp.translate("Dialog",s,c)

Attachment: RatDialog.pyc
Description: Binary data

#!/usr/bin/python

#........................................................................
#  "planeClip"
#........................................................................
class rat:
  def planeClip(self,o,clipName,width,origin):
    plane1 = [None]*3
    plane2 = [None]*3
    plane3 = [None]*3
    plane1[0] = origin[0]
    plane1[1] = origin[1]-width
    plane1[2] = origin[2]+width
    plane2[0] = origin[0]
    plane2[1] = origin[1]+width
    plane2[2] = origin[2]+width
    plane3[0] = origin[0]
    plane3[1] = origin[1]+width
    plane3[2] = origin[2]-width
    o.sendmesg("clip: select_default")
    o.sendmesg("part: modify_begin")
    o.sendmesg("clip: tool plane")
    o.sendmesg("clip: plane 1 -3.000000e+04 3.294000e+04 3.000000e+04")
    o.sendmesg("clip: plane 2 -3.000000e+04 3.294000e+04 2.994000e+04")
    o.sendmesg("clip: plane 3 -3.000000e+04 3.300000e+04 2.994000e+04")
    o.sendmesg("part: modify_end")
    o.sendmesg("tools: plane ON")
    o.sendmesg("clip: select_default")
    o.sendmesg("part: modify_begin")
    o.sendmesg("clip: plane_type grid")
    o.sendmesg("clip: plane_extents finite")
    o.sendmesg("clip: grid_pts 100 100")
    o.sendmesg("clip: tool plane")
    o.sendmesg("part: modify_end")
    o.sendmesg("part: select_partname_begin")
    o.sendmesg("\"(CASE:Case 1)GROUP: field\"")
    o.sendmesg("part: select_partname_end")
    o.sendmesg("clip: begin")
    o.sendmesg("clip: domain intersect")
    o.sendmesg("clip: tool plane")
    o.sendmesg("clip: plane 1 " + str(plane1[0]) + " " + str(plane1[1]) + " " + str(plane1[2]))
    o.sendmesg("clip: plane 2 " + str(plane2[0]) + " " + str(plane2[1]) + " " + str(plane2[2]))
    o.sendmesg("clip: plane 3 " + str(plane3[0]) + " " + str(plane3[1]) + " " + str(plane3[2]))
    o.sendmesg("clip: end")
    o.sendmesg("clip: create")
    o.sendmesg("tools: plane OFF")
    o.sendmesg("part: select_lastcreatedpart")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: description " + clipName)
    o.sendmesg("part: modify_end")
    o.sendmesg("part: select_partname_begin")
    o.sendmesg("\"" + clipName + "\"")
    o.sendmesg("part: select_partname_end")

  #........................................................................
  #  "circleClip"
  #........................................................................
  def circleClip(self,o,squareClipName,circleClipName,radius,origin):
    o.sendmesg("clip: select_default")
    o.sendmesg("part: modify_begin")
    o.sendmesg("clip: domain intersect")
    o.sendmesg("clip: tool cylinder")
    o.sendmesg("part: modify_end")
    o.sendmesg("part: modify_begin")
    o.sendmesg("clip: domain inside")
    o.sendmesg("part: modify_end")
    o.sendmesg("part: select_partname_begin")
    o.sendmesg("\"(CASE:Case 1)" + squareClipName + "\"")
    o.sendmesg("part: select_partname_end")
    o.sendmesg("clip: begin")
    o.sendmesg("clip: tool cylinder")
    o.sendmesg("clip: origin " + str(origin[0]) + " " + str(origin[1]) + " " + str(origin[2]))
    o.sendmesg("clip: axis 1.000000e+00 0.000000e+00 0.000000e+00")
    o.sendmesg("clip: radius " + str(radius))
    o.sendmesg("clip: end")
    o.sendmesg("clip: create")
    o.sendmesg("part: select_lastcreatedpart")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: description " + circleClipName)
    o.sendmesg("part: modify_end")
    o.sendmesg("part: select_partname_begin")
    o.sendmesg("\"" + squareClipName + "\"")
    o.sendmesg("part: select_partname_end")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: visible OFF")
    o.sendmesg("part: modify_end")

  def record(self,o,caseName):
    o.sendmesg("part: select_partname_begin")
    o.sendmesg("\"(CASE:Case 1)ALL\"")
    o.sendmesg("part: select_partname_end")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: visible ON")
    o.sendmesg("part: modify_end")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: colorby_palette none")
    o.sendmesg("part: colorby_rgb 1.000000e+00 0.000000e+00 1.000000e+00")
    o.sendmesg("part: modify_end")
    o.sendmesg("view_transf: fit 0")
    o.sendmesg("view_transf: restore_view " + caseName + ".view")
    o.sendmesg("view: hidden_surface ON")
    o.sendmesg("file: image_format jpeg")
    o.sendmesg("file: image_file " + caseName)
    o.sendmesg("file: image_window_size full")
    o.sendmesg("file: save_image")
    o.sendmesg("file: scenario_format enliten1")
    o.sendmesg("file: save_scenario_file " + caseName + ".els")


  #........................................................................
  #  "readOverflowData"
  #........................................................................
  def readOverflowData(self,o):
    o.sendmesg("data: binary_files_are big_endian")
    o.sendmesg("data: format plot3d")
    o.sendmesg("data: plot3diblank ON")
    o.sendmesg("data: plot3dmulti_zone ON")
    o.sendmesg("data: plot3dread_as fortran_binary")
    o.sendmesg("data: plot3ddimension 3d")
    #o.sendmesg("data: path /acct/boeing/mas5036/support/diana/B747-8/landing_RAT/re37p9M_m0p19/a04_junk")
    o.sendmesg("data: geometry grid.in")
    o.sendmesg("data: boundary mixsur.i.fvbnd")
    o.sendmesg("data: result q_solution")
    o.sendmesg("data: shift_time 1.000000 0.000000 0.000000")
    o.sendmesg("data: read")
    o.sendmesg("data_partbuild: begin")
    o.sendmesg("data_partbuild: begin")
    o.sendmesg("data_partbuild: begin")
    o.sendmesg("part: select_default")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: elt_representation bounding_box")
    o.sendmesg("part: modify_end")
    o.sendmesg("data_partbuild: data_type structured")
    o.sendmesg("data_partbuild: select_all")
    o.sendmesg("data_partbuild: domain inside")
    o.sendmesg("data_partbuild: noderange_i 1 10000")
    o.sendmesg("data_partbuild: noderange_j 1 10000")
    o.sendmesg("data_partbuild: noderange_k 1 10000")
    o.sendmesg("data_partbuild: nodestep 1 1 1")
    o.sendmesg("data_partbuild: nodedelta 0 0 0")
    o.sendmesg("data_partbuild: description ")
    o.sendmesg("data_partbuild: create")
    o.sendmesg("data_partbuild: end")
    o.sendmesg("part: select_default")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: elt_representation 3D_border_2D_full")
    o.sendmesg("part: modify_end")
    o.sendmesg("part: select_all")
    o.sendmesg("part: group field")
    o.sendmesg("part: select_all")
    o.sendmesg("data_partbuild: begin")
    o.sendmesg("data_partbuild: begin")
    o.sendmesg("data_partbuild: begin")
    o.sendmesg("data_partbuild: begin")
    o.sendmesg("data_partbuild: data_type unstructured")
    o.sendmesg("data_partbuild: select_all")
    o.sendmesg("data_partbuild: description ")
    o.sendmesg("data_partbuild: create")
    o.sendmesg("data_partbuild: end")
    o.sendmesg("part: select_all")
    o.sendmesg("part: modify_begin")
    o.sendmesg("part: visible OFF")
    o.sendmesg("part: modify_end")


from qt import *
from RatDialog import RatDialog 
import sys

if __name__ == "__main__":
   app = QApplication(sys.argv)
   dialog = RatDialog()
   dialog.show()
   app.setMainWidget(dialog)
   app.exec_loop()


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to