Пример #1
0
    def OnInit(self):

        #        self.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)

        skininit("../../../res")
        f = F()
        f.Bind(wx.EVT_CLOSE, lambda e: self.ExitMainLoop())

        wx.CallAfter(f.Show)
        #        pref=PreF()
        #        pref.Show(True)
        return True
Пример #2
0
    def OnInit(self):

#        self.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)

        skininit('../../../res')
        f=F()
        f.Bind(wx.EVT_CLOSE, lambda e: self.ExitMainLoop())

        wx.CallAfter(f.Show)
#        pref=PreF()
#        pref.Show(True)
        return True
Пример #3
0
        BuddyList.__init__(self, parent, expanded = [expanded_id(grp)])
        self.set_root([grp])

statuses = 'away available idle'.split()
def OnButton(event):
    print 'All Away'
    f.MBL.dude[0].status=random.choice(statuses)
    f.MBL.dude[1].status=random.choice(statuses)
    f.MBL.dude[2].status=random.choice(statuses)
    f.MBL.dude[3].status=random.choice(statuses)



if __name__ == '__main__':
    import gettext, sys
    from gui.skin import skininit
    gettext.install('Digsby', './locale', unicode=True)

    app = wx.PySimpleApp()
    skininit('../../../res')
    f = wx.Frame(None, -1, 'BuddyList test')
    f.Sizer=wx.BoxSizer(wx.VERTICAL)
    f.MBL=MockBuddyList(f)
    f.Sizer.Add(f.MBL,1,wx.EXPAND)
    rrb=wx.Button(f,-1,'Randomize')
    rrb.Bind(wx.EVT_BUTTON,OnButton)
    f.Sizer.Add(rrb,0,wx.EXPAND)
    f.Size=(200,400)
    f.Show()
    f.Bind(wx.EVT_CLOSE, lambda e: app.Exit())
    app.MainLoop()
Пример #4
0
from gui import skin as skincore



class F(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, wx.NewId(), "Progress Bar sampler",(0,0),(600,250))

        self.Bind(wx.EVT_SLIDER, self.on_slide)
        self.content = wx.BoxSizer(wx.VERTICAL)
        self.g = UberProgressBar(self,wx.NewId(),100,'progressbar',showlabel=True,size=(300,20))
        self.s = wx.Slider(self, -1, 0, 0, 100, (0,0), (300, 50))

        self.content.Add(self.g,0,wx.ALIGN_CENTER_HORIZONTAL)
        self.content.Add(self.s,0,wx.ALIGN_CENTER_HORIZONTAL)
        self.SetSizer(self.content)

    def on_slide(self,e):
        self.g.SetValue(self.s.GetValue())
        print self.s.GetValue()



if __name__=='__main__':
    a = wx.PySimpleApp( 0 )
    skincore.skininit('../../../../res')
    f=F()
    f.Show(True)

    a.MainLoop()
Пример #5
0
    def OnInit(self):

        skininit('../../../../res')
        self.Go()

        return True
Пример #6
0
        #wx.BitmapFromBuffer(Image.string)
        pdc.DrawBitmap(bitmap, 0, 0)  #wximage.ConvertToBitmap(),0,0)


class F(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None)

        events = [(wx.EVT_BUTTON, self.OnButton)]
        [self.Bind(event, method) for (event, method) in events]

        self.b1 = wx.Button(self, label='color')
        self.cp = UberColorPicker(self)

    def OnButton(self, event):
        self.cp.SetPosition(wx.GetMousePosition())
        self.cp.Popup()


class A(wx.App):
    def OnInit(self):
        f = F()
        f.Show(True)
        return True


if __name__ == '__main__':
    skininit('../../res')
    assert gSkin() is not None
    a = A(0)
    a.MainLoop()
Пример #7
0
    def OnInit(self):

        skininit('../../../../res')
        self.Go()

        return True
Пример #8
0
 def OnInit(self):
     skininit('../../../../res')
     f=F()
     f.Show(True)
     return True
Пример #9
0
    def __init__(self):
        wx.Frame.__init__(self, None, wx.NewId(), "Progress Bar sampler",
                          (0, 0), (600, 250))

        self.Bind(wx.EVT_SLIDER, self.on_slide)
        self.content = wx.BoxSizer(wx.VERTICAL)
        self.g = UberProgressBar(self,
                                 wx.NewId(),
                                 100,
                                 'progressbar',
                                 showlabel=True,
                                 size=(300, 20))
        self.s = wx.Slider(self, -1, 0, 0, 100, (0, 0), (300, 50))

        self.content.Add(self.g, 0, wx.ALIGN_CENTER_HORIZONTAL)
        self.content.Add(self.s, 0, wx.ALIGN_CENTER_HORIZONTAL)
        self.SetSizer(self.content)

    def on_slide(self, e):
        self.g.SetValue(self.s.GetValue())
        print self.s.GetValue()


if __name__ == '__main__':
    a = wx.PySimpleApp(0)
    skincore.skininit('../../../../res')
    f = F()
    f.Show(True)

    a.MainLoop()
Пример #10
0
def testapp(pypath = None, appname = 'Digsby', skinname = 'default', prefs = None, username = '******',
            on_message = lambda message: None,
            plugins = True, logging = True):
    'A test application framework for test __main__s.'


    if wxMSW: preload_comctrls()

    import gettext, os.path

    import options
    sys.opts, _args = options.parser.parse_args()
    import logextensions

    digsbysite.COLORIZE_EXCEPTIONS = sys.opts.console_color

    # Install gui elements
    gettext.install(appname, unicode=True)

    from bootstrap import install_N_
    install_N_()

    # Create the app
    app = TestApp()
    app.SetAppName(appname)

    # initialize stdpaths
    from stdpaths import init
    init()

    if wxMSW:
        import gui.native.win.winutil as winutil
        winutil.disable_callback_filter()

    from gui import skin
    from gui.toolbox import setuplogging
    if logging:
        import logging
        setuplogging(level=logging.INFO)


    # make wxLogError go to stderr, not popup dialogs
    wx.Log.SetActiveTarget(wx.LogStderr())

    app.PreShutdown = Delegate()

    if pypath is None:
        pypath = discover_digsby_root()

    sys.path.insert(0, pypath)

    skin.set_resource_paths([
                             util.program_dir() / 'res', # Apparently this has to be first?
                             stdpaths.userdata,
                             stdpaths.config,
                             ])

    if plugins:
        from main import init_plugins
        app.plugins = init_plugins()
    else:
        app.plugins = []


    skin.skininit(os.path.join(pypath, 'res'), skinname = skinname)

    from util.threads.threadpool import ThreadPool
    ThreadPool(5)

    from prefs.prefsdata import flatten
    import syck
    from util.observe import ObservableDict


    prefs_path = os.path.join(pypath, 'res', 'defaults.yaml')

    prefs = ObservableDict(prefs) if prefs is not None else ObservableDict()
    prefs.update({'appearance.skin': skinname,
                  'appearance.variant': None,
                  'debug.shell.font': shellfont()})
    import common
    common.set_active_prefs(prefs, {})

    from util.observe import ObservableDict

    sys.modules['digsbyprofile'] = Storage()
    import digsbyprofile
    from common.notifications import default_notifications
    p = digsbyprofile.profile = Storage(name     = username,
                                    username = username,
                                    prefs    = prefs,
                                    on_message = on_message,
                                    notifications = default_notifications)



    f = file(prefs_path)
    defaults = Storage(flatten(syck.load(f)))
    f.close()
    user = ObservableDict(defaults)
    user.update(prefs)

    from prefs.prefsdata import localprefs
    import prefs
    p.defaultprefs = prefs.defaultprefs()
    p.localprefs = localprefs()

    import common
    common.setfakeprefs(user)

    def toggle_prefs(user=user, defaults=defaults):
        import prefs
        prefs.edit(user, defaults, None)

    def toggle_crust(app=app):
        if not getattr(app, 'crust', None):
            import gui.shell
            wins =  wx.GetTopLevelWindows()
            parent = wins[0] if wins else None
            app.crust = gui.shell.PyCrustFrame(None)
            if parent is not None:
                parent.crust = app.crust
            app.crust.Bind(wx.EVT_CLOSE, lambda evt: app.Exit())
        app.crust.toggle_shown()

        # keyboard focus goes to shell prompt
        if app.crust.IsShown():
            app.crust.crust.SetFocus()

    def on_key(e):
        code = e.GetKeyCode()
        if code == wx.WXK_F11:
            toggle_prefs()
        elif code == wx.WXK_F12:
            toggle_crust()
        elif code == wx.WXK_F5:
            from gui import skin
            skin.reload()
        else:
            e.Skip()

    app.Bind(wx.EVT_KEY_DOWN, on_key)
    app.toggle_crust = toggle_crust

    from main import initialize_webkit, SetStatusPrompt
    initialize_webkit()
    app.SetStatusPrompt = SetStatusPrompt

    return app