Exemplo n.º 1
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader() 
        uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        #group = QGroupBox()
        #box = QVBoxLayout(group)
        #button = QPushButton(group)
        #box.addWidget(button)
        #group.show()
        #self.canvas.AddWidget(group)

        lineedit = QLineEdit()
        self.widget = lineedit
        #lineedit.show()
        #uiprops = UiWidgetProperties("PythonQt Test")
        #uism.AddWidgetToScene(lineedit) #uiprops) #self.canvas.AddWidget(lineedit)

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty()
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        lineedit.connect('textChanged(QString)', self.changed)

        r.logInfo("TestGui inited.")
Exemplo n.º 2
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader() 
        uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        #group = QGroupBox()
        #box = QVBoxLayout(group)
        #button = QPushButton(group)
        #box.addWidget(button)
        #group.show()
        #self.canvas.AddWidget(group)

        lineedit = QLineEdit()
        self.widget = lineedit
        #lineedit.show()
        #uiprops = UiWidgetProperties("PythonQt Test")
        #uism.AddWidgetToScene(lineedit) #uiprops) #self.canvas.AddWidget(lineedit)

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty()
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        lineedit.connect('textChanged(QString)', self.changed)

        r.logInfo("TestGui inited.")
Exemplo n.º 3
0
    def __init__(self):
        self.sels = []
        Component.__init__(self)
        self.window = window.ObjectEditWindow(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()

        self.mouse_events = {
            #r.LeftMouseClickPressed: self.LeftMousePressed,
            r.InWorldClick: self.LeftMousePressed,
            r.LeftMouseClickReleased: self.LeftMouseReleased,
            r.RightMouseClickPressed: self.RightMousePressed,
            r.RightMouseClickReleased: self.RightMouseReleased
        }

        self.shortcuts = {
            #r.PyObjectEditDeselect: self.deselect,
            r.PyObjectEditToggleMove:
            self.window.manipulator_move,  #"ALT+M", #move
            r.PyObjectEditToggleScale:
            self.window.manipulator_scale,  #"ALT+S" #, #scale
            r.Delete:
            self.deleteObject,
            r.Undo:
            self.undo,
            r.PyDuplicateDrag:
            self.duplicateStart,
            r.ObjectLink:
            self.linkObjects,
            r.ObjectUnlink:
            self.unlinkObjects,
        }

        self.resetManipulators()

        loader = QUiLoader()
        selectionfile = QFile(self.SELECTIONRECT)
        self.selection_rect = loader.load(selectionfile)
        rectprops = r.createUiWidgetProperty(2)
        #~ print type(rectprops), dir(rectprops)
        #print rectprops.WidgetType
        #uiprops.widget_name_ = "Selection Rect"

        #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it
        proxy = r.createUiProxyWidget(self.selection_rect, rectprops)
        uism = r.getUiSceneManager()
        uism.AddProxyWidget(proxy)
        proxy.setWindowFlags(0)  #changing it to Qt::Widget

        self.selection_rect.setGeometry(0, 0, 0, 0)
        self.selection_rect_startpos = None

        r.c = self  #this is for using objectedit from command.py
Exemplo n.º 4
0
    def __init__(self):
        self.sels = []  
        Component.__init__(self)
        self.window = window.ObjectEditWindow(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()
        
        self.mouse_events = {
            #r.LeftMouseClickPressed: self.LeftMousePressed,
            r.InWorldClick: self.LeftMousePressed,
            r.LeftMouseClickReleased: self.LeftMouseReleased,  
            r.RightMouseClickPressed: self.RightMousePressed,
            r.RightMouseClickReleased: self.RightMouseReleased
        }

        self.shortcuts = {
            #r.PyObjectEditDeselect: self.deselect,
            r.PyObjectEditToggleMove: self.window.manipulator_move,#"ALT+M", #move
            r.PyObjectEditToggleScale: self.window.manipulator_scale,#"ALT+S" #, #scale
            r.Delete: self.deleteObject,
            r.Undo: self.undo, 
            r.PyDuplicateDrag: self.duplicateStart, 
            r.ObjectLink: self.linkObjects,
            r.ObjectUnlink: self.unlinkObjects,
        }
        
        self.resetManipulators()
        
        loader = QUiLoader()
        selectionfile = QFile(self.SELECTIONRECT)
        self.selection_rect = loader.load(selectionfile)
        rectprops = r.createUiWidgetProperty(2)
        #~ print type(rectprops), dir(rectprops)
        #print rectprops.WidgetType
        #uiprops.widget_name_ = "Selection Rect"
        
        #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it
        proxy = r.createUiProxyWidget(self.selection_rect, rectprops)
        uism = r.getUiSceneManager()
        uism.AddProxyWidget(proxy)
        proxy.setWindowFlags(0) #changing it to Qt::Widget
        
        self.selection_rect.setGeometry(0,0,0,0)
        self.selection_rect_startpos = None
        
        r.c = self #this is for using objectedit from command.py
Exemplo n.º 5
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader()
        #uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        group = QGroupBox()
        box = QVBoxLayout(group)

        button1 = QPushButton("Button 1", group)
        box.addWidget(button1)

        button2 = QPushButton("Button 2", group)
        box.addWidget(button2)

        slider = QtGui.QSlider(PythonQt.QtCore.Qt.Horizontal)
        box.addWidget(slider)
        slider.connect('valueChanged(int)', self.changed)

        #group.show()

        lineedit = QtGui.QLineEdit()
        box.addWidget(lineedit)
        lineedit.connect('textChanged(QString)', self.changed)

        self.widget = group

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty(1)
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        r.logInfo("TestGui inited.")
Exemplo n.º 6
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader()
        #uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        group = QGroupBox()
        box = QVBoxLayout(group)

        button1 = QPushButton("Button 1", group)
        box.addWidget(button1)

        button2 = QPushButton("Button 2", group)
        box.addWidget(button2)

        slider = QtGui.QSlider(PythonQt.QtCore.Qt.Horizontal)
        box.addWidget(slider)
        slider.connect('valueChanged(int)', self.changed)

        #group.show()

        lineedit = QtGui.QLineEdit()
        box.addWidget(lineedit)
        lineedit.connect('textChanged(QString)', self.changed)

        self.widget = group

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty(1)
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        r.logInfo("TestGui inited.")
Exemplo n.º 7
0
    def __init__(self, controller):
        self.controller = controller
        loader = QUiLoader()
        uifile = QFile(self.UIFILE)

        ui = loader.load(uifile)
        width = ui.size.width()
        height = ui.size.height()
        
        #if not DEV:
        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty(1) #1 is ModuleWidget, shown at toolbar
        uiprops.widget_name_ = "Object Edit"
        #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it
        self.proxywidget = r.createUiProxyWidget(ui, uiprops)

        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."
        
        self.widget = ui
        self.tabwidget = ui.findChild("QTabWidget", "MainTabWidget")

        self.mainTab = ui.findChild("QWidget", "MainFrame")
        self.materialTab = ui.findChild("QWidget", "MaterialsTab")
        self.tabwidget.setTabEnabled(1, False)
        self.materialTabFormWidget = self.materialTab.formLayoutWidget
        self.mainTab.label.text = "<none>"

        self.meshline = lines.MeshAssetidEditline(controller) 
        self.meshline.name = "meshLineEdit"

        button_ok = self.getButton("Apply", self.ICON_OK, self.meshline, self.meshline.applyAction)
        button_cancel = self.getButton("Cancel", self.ICON_CANCEL, self.meshline, self.meshline.cancelAction)
        
        box = self.mainTab.findChild("QHBoxLayout", "meshLine")
        box.addWidget(self.meshline)
        box.addWidget(button_ok)
        box.addWidget(button_cancel)
        
        self.propedit = r.getPropertyEditor()
        self.tabwidget.addTab(self.propedit, "Properties")
        self.tabwidget.setTabEnabled(2, False)
        
        def poschanger(i):
            def pos_at_index(v):
                self.controller.changepos(i, v)
            return pos_at_index
        for i, poswidget in enumerate([self.mainTab.xpos, self.mainTab.ypos, self.mainTab.zpos]):
            poswidget.connect('valueChanged(double)', poschanger(i))

        def rotchanger(i):
            def rot_at_index(v):
                self.controller.changerot(i, v)
            return rot_at_index
        for i, rotwidget in enumerate([self.mainTab.rot_x, self.mainTab.rot_y, self.mainTab.rot_z]):
            rotwidget.connect('valueChanged(double)', rotchanger(i))
        
        def scalechanger(i):
            def scale_at_index(v):
                self.controller.changescale(i, v)
            return scale_at_index
        for i, scalewidget in enumerate([self.mainTab.scalex, self.mainTab.scaley, self.mainTab.scalez]):
            scalewidget.connect('valueChanged(double)', scalechanger(i))
        
        self.mainTab.treeWidget.connect('clicked(QModelIndex)', self.itemActivated)
        self.mainTab.treeWidget.connect('activated(QModelIndex)', self.itemActivated)
        
        self.proxywidget.connect('Visible(bool)', self.controller.on_hide)
        #self.tabwidget.connect('currentChanged(int)', self.tabChanged)

        self.meshline.connect('textEdited(QString)', button_ok.lineValueChanged)
        self.meshline.connect('textEdited(QString)', button_cancel.lineValueChanged)
        
        self.mainTab.findChild("QPushButton", "newObject").connect('clicked()', self.controller.createObject)
        self.mainTab.findChild("QPushButton", "deleteObject").connect('clicked()', self.controller.deleteObject)
        self.mainTab.findChild("QPushButton", "duplicate").connect('clicked()', self.controller.duplicate)
        
        self.mainTab.findChild("QPushButton", "undo").connect('clicked()', self.controller.undo)
        
        self.mainTab.findChild("QToolButton", "move_button").connect('clicked()', self.manipulator_move)
        self.mainTab.findChild("QToolButton", "scale_button").connect('clicked()', self.manipulator_scale)
        self.mainTab.findChild("QToolButton", "rotate_button").connect('clicked()', self.manipulator_rotate)

        self.mainTabList = {}
        
        self.currentlySelectedTreeWidgetItem = []
Exemplo n.º 8
0
    
    def swoot():
        print "booyah!"
    
    def noswoot():
        print "!booyah!"
        
    from PythonQt.QtUiTools import QUiLoader
    from PythonQt.QtCore import QFile, QSize
    from PythonQt.QtGui import QLineEdit, QHBoxLayout, QComboBox, QLabel
    
    loader = QUiLoader()
    uifile = QFile("pymodules/editgui/materials.ui")
    ui = loader.load(uifile)
    uism = r.getUiSceneManager()
    uiprops = r.createUiWidgetProperty()
    uiprops.show_at_toolbar_ = False
    uiprops.widget_name_ = "Test"
    uiprops.my_size_ = QSize(ui.size.width(), ui.size.height())
    pw = r.createUiProxyWidget(ui, uiprops)
    uism.AddProxyWidget(pw)
    r.formwidget = ui.gridLayoutWidget
    r.pw = pw
    r.pw.show()
    
    #print dir(r.formwidget), r.formwidget.rowCount()

    #~ qprim = r.getQPrim(2985471908)
    #~ mats = qprim.Materials
    #~ print mats#, r.formwidget.formLayout.children() 
    #qprim.Materials = mats
Exemplo n.º 9
0
    def swoot():
        print "booyah!"

    def noswoot():
        print "!booyah!"

    from PythonQt.QtUiTools import QUiLoader
    from PythonQt.QtCore import QFile, QSize
    from PythonQt.QtGui import QLineEdit, QHBoxLayout, QComboBox, QLabel

    loader = QUiLoader()
    uifile = QFile("pymodules/editgui/materials.ui")
    ui = loader.load(uifile)
    uism = r.getUiSceneManager()
    uiprops = r.createUiWidgetProperty()
    uiprops.show_at_toolbar_ = False
    uiprops.widget_name_ = "Test"
    uiprops.my_size_ = QSize(ui.size.width(), ui.size.height())
    pw = r.createUiProxyWidget(ui, uiprops)
    uism.AddProxyWidget(pw)
    r.formwidget = ui.gridLayoutWidget
    r.pw = pw
    r.pw.show()

    #print dir(r.formwidget), r.formwidget.rowCount()

    #~ qprim = r.getQPrim(2985471908)
    #~ mats = qprim.Materials
    #~ print mats#, r.formwidget.formLayout.children()
    #qprim.Materials = mats
Exemplo n.º 10
0
    
    def swoot():
        print "booyah!"
    
    def noswoot():
        print "!booyah!"
        
    from PythonQt.QtUiTools import QUiLoader
    from PythonQt.QtCore import QFile, QSize
    from PythonQt.QtGui import QLineEdit, QHBoxLayout, QComboBox, QLabel
    
    loader = QUiLoader()
    uifile = QFile("pymodules/editgui/materials.ui")
    ui = loader.load(uifile)
    uism = naali.ui
    uiprops = r.createUiWidgetProperty() #note: createUiWidgetProperty doesn't exist anymore -Stinkfist
    uiprops.show_at_toolbar_ = False
    uiprops.widget_name_ = "Test"
    uiprops.my_size_ = QSize(ui.size.width(), ui.size.height())
    pw = r.createUiProxyWidget(ui, uiprops)
    uism.AddProxyWidget(pw)
    r.formwidget = ui.gridLayoutWidget
    r.pw = pw
    r.pw.show()
    
    #print dir(r.formwidget), r.formwidget.rowCount()

    #~ qprim = r.getQPrim(2985471908)
    #~ mats = qprim.Materials
    #~ print mats#, r.formwidget.formLayout.children() 
    #qprim.Materials = mats