0

template for creating ui elements?

I'm just getting my feet wet with attempting to add UI components to RV.

Using some of the examples I found on-line and the manual I'm trying to just get off the ground.

I've made what I think is a very basic plugin package which should simply print the QApplication.topLevelWidgets()

Ultimately I would like to create a list which will toggle on and off and live either docked to the side of the main window or as a separate HUD.

The package loads, however, nothing seems to ever actually do anything.  I've tried several different key bindings but nothing I try seems to get picked up.

The init for the class is being called, however the key binding does not seem to get made.

_______

import types
import os

from rv import rvtypes, commands
from PySide.QtGui import QApplication

import testgui # need to get at the module itself - not sure I understand this part.


class TestGui(rvtypes.MinorMode):
    def __init__(self):
        rvtypes.MinorMode.__init__(self)
    self.visable = 0
        self.init("test-gui",
          [ ("key-down-alt-p",self.toggle,"toggle TestGui") ],
          None,
          None)

    def toggle(self, event):
        print "toggle testgui"
    self.visable = 1 - self.visable
    if self.visable == 1:
        print(QApplication.topLevelWidgets())


def createMode():
    "Required to initialize the module. RV will call this function to create the mode."
    return TestGui()




testgui-0.1.rvpkg

2 条评论

  • 0
    Avatar
    Pumplerod

    I made a couple adjustments.  It seems there was a syntax error in my key binding.  And, for some reason, PySide is not working correctly for me with RV.  When I switched to PyQt4 everything seemed to work. 

    I'm including the testgui.rvpkg in the even anyone else might find it a good jumping off point.

  • 0
    Avatar
    Jon Morley

    Thank you for sharing this!

    Can you please share any PySide errors you encountered or explain what happened when you tried to get PySide working?

    Thanks,
    Jon

请先登录再写评论。