Esempio n. 1
0
    def __init__(self,
                 parent,
                 offset,
                 maxOffset,
                 position=(0, 0),
                 margins=(0, 0),
                 width=1000,
                 height=1000,
                 selected=0,
                 tapped=-1):
        self.xpos = position[0]
        self.ypos = position[1]
        self.xMargin = margins[0]
        self.yMargin = margins[1]
        self.width = width
        self.height = height
        self.parent = parent
        self.offset = offset
        self.maxOffset = maxOffset
        self.itemList = []
        self.auxDict = {}
        self.highlight = []
        self.selected = selected
        self.__tapped = -1
        self.__amber_sel = -1
        self.__tappedItem = -1
        self.lineSpacing = 0
        self.gridlines = []

        imageName = resource.find_release_resource('app_browser2',
                                                   'green_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.green = image.ConvertToBitmap()
        imageName = resource.find_release_resource('app_browser2',
                                                   'red_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.red = image.ConvertToBitmap()
        imageName = resource.find_release_resource('app_browser2',
                                                   'yellow_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.yellow = image.ConvertToBitmap()
        imageName = resource.find_release_resource('app_browser2',
                                                   'folder.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.folder = image.ConvertToBitmap()
Esempio n. 2
0
    def __init__(self, parent, size, style=wx.BORDER_NONE):
        wx.Window.__init__(self, parent, -1, size=size, style=style)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.doNothing)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.SetBackgroundColour(colours.frame_border)
        self.Bind(wx.EVT_PAINT, self.onPaint)

        self.connectionStatus = ''
        imageName = resource.find_release_resource('app_commander',
                                                   'green_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.green = image.ConvertToBitmap()
        imageName = resource.find_release_resource('app_commander',
                                                   'red_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.red = image.ConvertToBitmap()
Esempio n. 3
0
    def __init__(self, parent, size, agent, style=wx.BORDER_NONE):
        wx.Window.__init__(self, parent, -1, size=size, style=style)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.SetBackgroundColour(colours.borderGradient1)
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.onLeftUp)
        self.Bind(wx.EVT_MOTION, self.onMotion)
        self.__agent = agent
        self.model = self.__agent[8].model
        self.model.addPathListener(self)
        self.pathButtons = []
        self.Bind(wx.EVT_PAINT, self.onPaint)
        self.path = []
        self.aux_oldv = 1
        self.aux_oldh = -1
        #        self.font=wx.Font(13,wx.FONTFAMILY_MODERN,wx.FONTSTYLE_NORMAL,weight=wx.FONTWEIGHT_LIGHT)
        self.font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.font.SetPointSize(11)

        imageName = resource.find_release_resource('app_browser2',
                                                   'green_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.green = image.ConvertToBitmap()
        imageName = resource.find_release_resource('app_browser2',
                                                   'red_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.red = image.ConvertToBitmap()
        imageName = resource.find_release_resource('app_browser2',
                                                   'yellow_button.png')
        if imageName:
            image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
            self.yellow = image.ConvertToBitmap()

        self.scrollLength = 1
        self.scrollPos = 1
Esempio n. 4
0
    def load_documentation(self):
        self.__agents = {}
        self.__cache = {}

        user_doc = resource.find_resource('Help', 'documentation.xml')
        release_doc = resource.find_release_resource('Help',
                                                     'documentation.xml')

        try:
            self.load_file(user_doc)
            return
        except:
            print user_doc, 'invalid'
            pass

        self.load_file(release_doc)
Esempio n. 5
0
 def __init__(self, name, logfunc):
     gui.App.__init__(self, logfunc=logfunc, name=name)
     #        gui.App.__init__(self,name=name)
     print '<browser starting>'
     imageName = resource.find_release_resource('app_browser2',
                                                'browser_splash.png')
     if imageName:
         image = wx.Image(imageName, wx.BITMAP_TYPE_PNG)
         bmp = image.ConvertToBitmap()
         wx.SplashScreen(bmp,
                         wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                         2000, None, -1)
         wx.Yield()
     print 'browser starting 2'
     self.agent = ViewManager(name)
     print 'browser starting 3'
     piw.tsd_server(name, self.agent)
     print 'browser starting 4'
     self.agent.advertise('<main>')
     print 'browser starting 5'
Esempio n. 6
0
    def read_user(self):
        if not os.path.exists(self.__user):
            print 'no scale file', self.__user
            fr = resource.find_release_resource('scale_manager',
                                                'User Scales.txt')
            if not fr:
                print 'no factory scale file', fr
                return
            print 'copy', fr, self.__user
            shutil.copyfile(fr, self.__user)

        cp = ConfigParser.ConfigParser()
        cp.read(self.__user)

        for s in sorted(cp.sections()):
            if not cp.has_option(s, 'intervals'):
                continue
            line = cp.get(s, 'intervals')
            line = line.strip()
            self.add_scale(line, s)
Esempio n. 7
0
    def __init__(self, callback):
        self.__callback = callback

        self.__user_file_name = resource.user_resource_file(
            'Fingerer', 'User Fingerings.txt', version='')
        self.__factory_file_name = os.path.join(os.path.dirname(__file__),
                                                'Factory Fingerings.txt')
        self.__user_seed_file = resource.find_release_resource(
            'fingerer', 'User Fingerings.txt')
        self.__timestamp = piw.tsd_time()
        self.__timer = piw.thing()
        self.__timer.set_slow_timer_handler(utils.notify(
            self.__timer_callback))

        if not resource.os_path_exists(
                self.__user_file_name) and resource.os_path_exists(
                    self.__user_seed_file):
            resource.shutil_copyfile(self.__user_seed_file,
                                     self.__user_file_name)

        self.__user_file_time = 0
        self.__factory_fingerings = {}
        self.__user_fingerings = {}

        self.__load_factory()
        self.__load_user()

        fn = set(self.__factory_fingerings.keys())
        fn.update(set(self.__user_fingerings.keys()))

        atom.Atom.__init__(self,
                           names='fingering',
                           domain=domain.String(),
                           init='simple whistle',
                           policy=atom.default_policy(self.__change_fingering),
                           protocols='browse')
Esempio n. 8
0
    def read_user(self):
        fn = resource.user_resource_file('Scale Manager',
                                         'User Scales.txt',
                                         version='')

        if not os.path.exists(fn):
            print 'no scale file', fn
            fr = resource.find_release_resource('scale_manager',
                                                'User Scales.txt')
            if not fr:
                print 'no factory scale file', fr
                return
            print 'copy', fr, fn
            shutil.copyfile(fr, fn)

        cp = ConfigParser.ConfigParser()
        cp.read(fn)

        for s in cp.sections():
            if not cp.has_option(s, 'intervals'):
                continue
            line = cp.get(s, 'intervals')
            line = line.strip()
            self[2].add_scale(line, s)