def fakeprefs(): # from common import setfakeprefs global TESTAPP if not TESTAPP: TESTAPP = True from tests.testapp import testapp testapp(prefs={'digsby.status.promote_tag.upgrade_response':True}, logging = False)
def test_status_dialog(): import gettext gettext.install('digsby') from tests.testapp import testapp testapp('../../..') from social.twitter import get_snurl from util.threads.threadpool import ThreadPool ThreadPool(2) a = wx.PySimpleApp() d = TwitterStatusDialog.ShowSetStatus(None, 'foobar_username', initial_text='hello', tiny_url = get_snurl) d2 = TwitterStatusDialog.ShowSetStatus(None, 'foobar_username', initial_text='hello', tiny_url = get_snurl) assert d is d2 d.Show() a.MainLoop()
def main(): from tests.testapp import testapp a = testapp('../../..') from gui.skin.skinparse import makeImage b = makeImage('popupshadow.png 12 12 25 25') #slices = (12, 12, 25, 25) f = Popup(b) def onbutton(e): #f.Fit() f2 = Popup(b) f2.Size = (300, 100) f2.DesiredSize = Size(300, 100) stack.Add(f2) f.button.Bind(wx.EVT_BUTTON, onbutton) stack = PopupStack(1, BOTTOM | LEFT) f.DesiredSize = Size(300, 100) stack.Add(f) ctrl = wx.Frame(None) #slider = wx.Slider(ctrl, value = 255, minValue = 0, maxValue = 255) #def onslide(e): # setalpha(f, slider.Value) # f.border.Refresh() #f.SetTransparent(slider.Value) #slider.Bind(wx.EVT_SLIDER, onslide) ctrl.Show() a.MainLoop()
def main(): from tests.testapp import testapp from tests.mock.mockbuddy import MockBuddy from path import path a = testapp('../../..') from gui.imwin.messagearea import MessageArea from gui.imwin.styles import get_theme from common.logger import history_from_files from gui import skin f = wx.Frame(None, title = 'Conversation Preview') msgarea = MessageArea(f) buddy = MockBuddy('digsby01') theme = get_theme('GoneDark', 'Steel') msgarea.init_content(theme, buddy.alias, buddy, show_history = False) msgs = history_from_files([skin.resourcedir() / 'Example Conversation.html']) msgarea.replay_messages(msgs, buddy) f.Show() a.MainLoop()
def test_account_panel(): import gettext gettext.install('digsby') from tests.testapp import testapp testapp('../../..') from util.threads.threadpool import ThreadPool ThreadPool(2) a = wx.PySimpleApp() f = wx.Frame(None) p = TwitterAccountPanel(f) f.SetSize((450, 350)) f.Layout() f.Fit() f.Show() a.MainLoop()
def main(): from tests.testapp import testapp app = testapp() f = wx.Frame(None) w = wx.webview.WebView(f) w.Bind(wx.webview.EVT_WEBVIEW_CONSOLE_MESSAGE, on_console_message) from gui.infobox.infoboxapp import init_host, set_hosted_content account = MockAccount() init_host(w) def do_set_content(): for x in xrange(100): set_hosted_content(w, account) def on_load(e): if e.GetState() == wx.webview.WEBVIEW_LOAD_ONLOAD_HANDLED: pass w.Bind(wx.webview.EVT_WEBVIEW_LOAD, on_load) set_content_button = wx.Button(f, -1, 'set content') set_content_button.Bind(wx.EVT_BUTTON, lambda e: do_set_content()) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(set_content_button) f.Sizer = wx.BoxSizer(wx.VERTICAL) f.Sizer.AddMany([(hsizer, 0, wx.EXPAND), (w, 1, wx.EXPAND)]) f.Show() app.MainLoop()
def main(): from common.notifications import get_notification_info from common.notifications import Popup userInfo = {None: {'contact.available': [{'reaction': Popup}], 'contact.away': [{'reaction': Popup}], 'email.new': [{'reaction': Popup}], 'error': [{'reaction': Popup}], 'facebook.alert': [{'reaction': Popup}], 'filetransfer.request': [{'reaction': Popup}], 'message.received.background': [{'reaction': Popup}], 'myspace.alert': [{'reaction': Popup}]}} from tests.testapp import testapp app = testapp('../../..') f = wx.Frame(None, -1, 'notifications gui test') p = NotifyPanel(f) n = p.NotifyView n.NotificationInfo = get_notification_info() n.UserNotifications = userInfo f.Show() app.MainLoop()
def main(): from tests.testapp import testapp app = testapp() show_dialog() app.MainLoop()
def main(): from tests.testapp import testapp import netextensions with testapp(): from pprint import pprint OneRiotAdSource('digsby01').request_ads(pprint)
def main2(): from tests.testapp import testapp a = testapp('../../..') frames = [wx.Frame(None, -1, 'test %d' % c) for c in xrange(5)] stack = PopupStack(1, BOTTOM | LEFT) stack.Add(frames[0])
def main(): app = testapp() import cPickle fbdata_file = os.path.join(os.path.dirname(__file__), r'fbdata.dat') fbdata = cPickle.loads(open(fbdata_file, 'rb').read()) benchmark(fbdata)
def test_status_dialog(): import gettext gettext.install('digsby') from tests.testapp import testapp testapp('../../..') from social.twitter import get_snurl from util.threads.threadpool import ThreadPool ThreadPool(2) a = wx.PySimpleApp() d = TwitterStatusDialog.ShowSetStatus(None, 'foobar_username', initial_text='hello', tiny_url=get_snurl) d2 = TwitterStatusDialog.ShowSetStatus(None, 'foobar_username', initial_text='hello', tiny_url=get_snurl) assert d is d2 d.Show() a.MainLoop()
def main(): app = testapp() style = wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR | wx.FRAME_TOOL_WINDOW f = wx.Frame(None, style=style, pos=(400, 300), size=(300, 300)) p = wx.Panel(f, -1) p.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) s = wx.BoxSizer(wx.VERTICAL) w = wx.webview.WebView(p) def paint(e): """ i = wx.ImageFromBitmap(w.Bitmap) b = wx.BitmapFromImage(i) b.UseAlpha() """ print "Hello..." bitmap = wx.EmptyBitmap(*w.Size) dc = wx.MemoryDC(bitmap) dc.Clear() # w.PaintOnDC(dc, False) dc.SetBrush(wx.Brush(wx.Colour(0, 0, 0, 0))) dc.DrawRectangle(0, 0, 400, 400) # dc.SetBrush(wx.RED_BRUSH) # dc.DrawRectangle(50, 50, 300, 200) if wxMSW: ApplyAlpha(f, bitmap) dc = wx.PaintDC(e.GetEventObject()) dc.DrawBitmap(bitmap, 0, 0, True) # wx.ScreenDC().DrawBitmap(bitmap, 0, 0, True) if not wxMSW: p.Bind(wx.EVT_PAINT, paint) f.Bind(wx.EVT_PAINT, paint) s.Add(w, 1, wx.EXPAND) p.SetSizer(s) w.SetPageSource(html) f.SetTransparent(125) w.SetTransparent(True) # wx.CallLater(2000, lambda: ApplyAlpha(f, w.Bitmap)) f.Show() f.SetSize((500, 500)) if wxMSW: paint(None) app.MainLoop()
def main(): app = testapp() style = wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR | wx.FRAME_TOOL_WINDOW f = wx.Frame(None, style=style, pos=(400, 300), size=(300, 300)) p = wx.Panel(f, -1) p.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) s = wx.BoxSizer(wx.VERTICAL) w = wx.webview.WebView(p) def paint(e): ''' i = wx.ImageFromBitmap(w.Bitmap) b = wx.BitmapFromImage(i) b.UseAlpha() ''' print "Hello..." bitmap = wx.EmptyBitmap(*w.Size) dc = wx.MemoryDC(bitmap) dc.Clear() #w.PaintOnDC(dc, False) dc.SetBrush(wx.Brush(wx.Colour(0, 0, 0, 0))) dc.DrawRectangle(0, 0, 400, 400) #dc.SetBrush(wx.RED_BRUSH) #dc.DrawRectangle(50, 50, 300, 200) if wxMSW: ApplyAlpha(f, bitmap) dc = wx.PaintDC(e.GetEventObject()) dc.DrawBitmap(bitmap, 0, 0, True) #wx.ScreenDC().DrawBitmap(bitmap, 0, 0, True) if not wxMSW: p.Bind(wx.EVT_PAINT, paint) f.Bind(wx.EVT_PAINT, paint) s.Add(w, 1, wx.EXPAND) p.SetSizer(s) w.SetPageSource(html) f.SetTransparent(125) w.SetTransparent(True) #wx.CallLater(2000, lambda: ApplyAlpha(f, w.Bitmap)) f.Show() f.SetSize((500, 500)) if wxMSW: paint(None) app.MainLoop()
def main(): a = testapp('../../..') f = wx.Frame(None) f.fontsize = 12 def paint(e): dc = wx.AutoBufferedPaintDC(f) dc.SetPen(wx.TRANSPARENT_PEN) dc.SetBrush(wx.BLACK_BRUSH) dc.DrawRectangleRect(f.ClientRect) font = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) font.SetPixelSize(wx.Size(0, -f.fontsize)) font.SetFaceName('Times New Roman') dc.TextForeground = wx.WHITE dc.Font = font str = 'test hello world xyz' x, y = 40, 10 dc.DrawText(str, x, y) w, h, desc, externalLeading = dc.GetFullTextExtent(str) print w, h, desc, externalLeading r = wx.Rect(x, y + desc, w, h - desc * 2) realHeight = (h - desc * 2) f.SetTitle('%s / %s = %s' % (f.fontsize, realHeight, f.fontsize / realHeight)) #dc.SetPen(wx.RED_PEN) #dc.SetBrush(wx.TRANSPARENT_BRUSH) #dc.DrawRectangleRect(r) f.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) f.Bind(wx.EVT_PAINT, paint) sl = wx.Slider(f, minValue=-10, maxValue=50, value=f.fontsize) def onslide(e): f.fontsize = sl.Value f.Refresh() f.SetTitle(str(sl.Value)) sl.Bind(wx.EVT_SLIDER, onslide) f.Sizer = s = wx.BoxSizer(wx.VERTICAL) s.AddStretchSpacer(1) s.Add(sl, 0, wx.EXPAND) f.Show() a.MainLoop()
def main(): a = testapp() f = wx.Frame(None) bar = UberBar(f, skinkey='ButtonBarSkin', overflowmode=True) for x in xrange(5): title = 'test %d' % x b = UberButton(bar, -1, title) bar.Add(b) f.Show() a.MainLoop()
def main(): a = testapp("../../..") f = wx.Frame(None) f.fontsize = 12 def paint(e): dc = wx.AutoBufferedPaintDC(f) dc.SetPen(wx.TRANSPARENT_PEN) dc.SetBrush(wx.BLACK_BRUSH) dc.DrawRectangleRect(f.ClientRect) font = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) font.SetPixelSize(wx.Size(0, -f.fontsize)) font.SetFaceName("Times New Roman") dc.TextForeground = wx.WHITE dc.Font = font str = "test hello world xyz" x, y = 40, 10 dc.DrawText(str, x, y) w, h, desc, externalLeading = dc.GetFullTextExtent(str) print w, h, desc, externalLeading r = wx.Rect(x, y + desc, w, h - desc * 2) realHeight = h - desc * 2 f.SetTitle("%s / %s = %s" % (f.fontsize, realHeight, f.fontsize / realHeight)) # dc.SetPen(wx.RED_PEN) # dc.SetBrush(wx.TRANSPARENT_BRUSH) # dc.DrawRectangleRect(r) f.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) f.Bind(wx.EVT_PAINT, paint) sl = wx.Slider(f, minValue=-10, maxValue=50, value=f.fontsize) def onslide(e): f.fontsize = sl.Value f.Refresh() f.SetTitle(str(sl.Value)) sl.Bind(wx.EVT_SLIDER, onslide) f.Sizer = s = wx.BoxSizer(wx.VERTICAL) s.AddStretchSpacer(1) s.Add(sl, 0, wx.EXPAND) f.Show() a.MainLoop()
def main2(): #app = wx.PySimpleApp() from tests.testapp import testapp app = testapp() from gui import skin f = wx.Frame(None) f.Sizer = sizer = wx.BoxSizer(wx.VERTICAL) tabs = cgui.TabNotebook(f) def maketab(color, name): p = wx.Panel(f, name=name) def leftdown(e): def later(): from gui.native.toplevel import FlashOnce win = p if not wx.GetKeyState(wx.WXK_SHIFT) else p.Top print 'flashing', win FlashOnce(win) wx.CallLater(2000, later) e.Skip() def rightdown(e): e.Skip() print tabs.SetTabActive(p) p.Bind(wx.EVT_LEFT_DOWN, leftdown) p.Bind(wx.EVT_RIGHT_DOWN, rightdown) p.SetBackgroundColour(color) sizer.Add(p, 1, wx.EXPAND) p.tab = tabs.CreateTab(f, MyTabController()) maketab(wx.RED, 'foo') maketab(wx.BLUE, 'bar') maketab(wx.GREEN, 'meep') icon = skin.get('AppDefaults.UnreadMessageIcon') success = tabs.SetOverlayIcon(icon) print print '###'*30 print success #print cgui.TaskbarTab() f.Show() app.MainLoop()
def main2(): a = testapp('../../..') f = wx.Frame(None) from gui.skin import get as skinget icons = skinget('serviceicons') services = 'digsby aim icq jabber gtalk yahoo'.split() f.imgsize = 0 def paint(e): dc = wx.AutoBufferedPaintDC(f) dc.SetPen(wx.TRANSPARENT_PEN) dc.SetBrush(wx.BLACK_BRUSH) dc.DrawRectangleRect(f.ClientRect) drawbitmap = dc.DrawBitmap sizes = [(32, 32), (16, 16), (100, 100)] diff = f.imgsize y = 0 for size in sizes: x = 0 for srv in services: icon = icons[srv].Resized((size[0] + diff, size[1] + diff)) drawbitmap(icon, x, y, True) x += size[0] + diff y += size[1] + diff f.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) f.Bind(wx.EVT_PAINT, paint) sl = wx.Slider(f, minValue = -10, maxValue = 50, value = 0) def onslide(e): f.imgsize = sl.Value f.Refresh() f.SetTitle(str(sl.Value)) sl.Bind(wx.EVT_SLIDER, onslide) f.Sizer = s = wx.BoxSizer(wx.VERTICAL) s.AddStretchSpacer(1) s.Add(sl, 0, wx.EXPAND) f.Show() a.MainLoop()
def main(): from tests.testapp import testapp app = testapp() import wx.webview f = wx.Frame(None, -1, size=(300, 700)) from gui.imwin.styles.msgstyles import get_theme style = SocialFeedStyle(get_theme('Smooth Operator').path) w = wx.webview.WebView(f) w.SetPageSource(style.initialContents('', None, False)) f.Show() app.MainLoop()
def main(): fix_logging() AsyncoreThread.start() import wx; a = testapp('../../..') a.toggle_crust() from oscar import protocol oscar = protocol('digsby01', 'no passwords', user = object(), server = ('login.oscar.aol.com',5190)) oscar.Connect() oscar.send_im('digsby04', u'hello world') a.MainLoop()
def run_tests(): from tests.testapp import testapp app = testapp() runner = unittest.TextTestRunner(verbosity=2) all_tests = get_tests(app) orig_dir = os.getcwd() os.chdir(unittest_basedir) try: test_result = runner.run(all_tests) finally: os.chdir(orig_dir) sys.exit(not test_result.wasSuccessful())
def main(): a = testapp() f = wx.Frame(None) bar = UberBar(f, skinkey = 'ButtonBarSkin', overflowmode = True) for x in xrange(5): title = 'test %d' % x b = UberButton(bar, -1, title) bar.Add(b) f.Show() a.MainLoop()
def run_tests(): from tests.testapp import testapp app = testapp() runner = unittest.TextTestRunner(verbosity = 2) all_tests = get_tests(app) orig_dir = os.getcwd() os.chdir(unittest_basedir) try: test_result = runner.run(all_tests) finally: os.chdir(orig_dir) sys.exit(not test_result.wasSuccessful())
def main(): from tests.testapp import testapp app = testapp() il = WebKitImageLoader() def test_onLoad(img, url): print 'onLoad', img, url def test_onError(url): print 'onError', url il.on_load += test_onLoad il.on_error += test_onError il.get('http://img.digsby.com/logos/digsby_196x196.png') il.frame.Show() app.MainLoop()
def main(): from tests.testapp import testapp a = testapp(skinname='Windows 7') f = wx.Frame(None, -1, 'roomlist') AIM = ('aim', [ caps.BLOCKABLE, caps.EMAIL, caps.FILES, caps.IM, caps.PICTURES, caps.SMS ]) MSN = ('msn', [caps.BLOCKABLE, caps.EMAIL, caps.FILES, caps.IM]) JBR = ('jabber', [caps.EMAIL, caps.FILES, caps.IM]) YHO = ('yahoo', [caps.BLOCKABLE, caps.EMAIL, caps.FILES, caps.IM, caps.SMS]) global contacts contacts = ObservableList([ MockBuddy('Aaron', 'away', *JBR), MockBuddy('Chris', 'available', *JBR), MockBuddy('Jeff', 'offline', *AIM), MockBuddy('Kevin', 'away', *YHO), MockBuddy('Mike', 'available', *MSN), MockBuddy('Steve', 'offline', *AIM), ]) buddies = dict((c.name, c) for c in contacts) contacts.extend([ MockBuddy('Agatha', 'offline', *AIM), MockBuddy('Abel', 'away', *YHO), MockBuddy('Adam', 'available', *MSN), MockBuddy('Amanda', 'offline', *AIM), MockBuddy('Beatrice', 'offline', *AIM), MockBuddy('Betty', 'away', *YHO), MockBuddy('Brian', 'available', *MSN), MockBuddy('Biff', 'away', *YHO), MockBuddy('Bart', 'available', *MSN), ]) rl = RoomListPanel(f, buddies) rl.RoomList = contacts f.SetSize((200, 400)) f.Show() a.MainLoop()
def main(): fix_logging() AsyncoreThread.start() import wx a = testapp('../../..') a.toggle_crust() from oscar import protocol oscar = protocol('digsby01', 'no passwords', user=object(), server=('login.oscar.aol.com', 5190)) oscar.Connect() oscar.send_im('digsby04', u'hello world') a.MainLoop()
def main(): from tests.testapp import testapp app = testapp() from path import path import os os.chdir(path(__file__).parent) import wx.webview f = wx.Frame(None) w = wx.webview.WebView(f) from gui.browser.webkit import setup_webview_logging setup_webview_logging(w, 'webview') w.SetPageSource(html) app.MainLoop()
def main(): from tests.testapp import testapp a = testapp(skinname='Windows 7') f = wx.Frame(None, -1, 'roomlist') AIM=('aim', [caps.BLOCKABLE, caps.EMAIL, caps.FILES, caps.IM, caps.PICTURES, caps.SMS]) MSN=('msn', [caps.BLOCKABLE, caps.EMAIL, caps.FILES, caps.IM]) JBR=('jabber', [caps.EMAIL, caps.FILES, caps.IM]) YHO=('yahoo', [caps.BLOCKABLE, caps.EMAIL, caps.FILES, caps.IM, caps.SMS]) global contacts contacts = ObservableList([MockBuddy('Aaron', 'away', *JBR), MockBuddy('Chris', 'available', *JBR), MockBuddy('Jeff', 'offline', *AIM), MockBuddy('Kevin', 'away', *YHO), MockBuddy('Mike', 'available', *MSN), MockBuddy('Steve', 'offline', *AIM),]) buddies = dict((c.name, c) for c in contacts) contacts.extend([ MockBuddy('Agatha', 'offline', *AIM), MockBuddy('Abel', 'away', *YHO), MockBuddy('Adam', 'available', *MSN), MockBuddy('Amanda', 'offline', *AIM), MockBuddy('Beatrice', 'offline', *AIM), MockBuddy('Betty', 'away', *YHO), MockBuddy('Brian', 'available', *MSN), MockBuddy('Biff', 'away', *YHO), MockBuddy('Bart', 'available', *MSN), ]) rl = RoomListPanel(f, buddies) rl.RoomList = contacts f.SetSize((200,400)) f.Show() a.MainLoop()
def main(): fix_logging() AsyncoreThread.start() import wx; a = testapp('../../..') a.toggle_crust() from jabber import protocol global jabber jargs, jkwargs = connection_settings['gtalk'] jabber = protocol(*jargs, **jkwargs) jabber.Connect() a.MainLoop() try: jabber.Disconnect() except: pass AsyncoreThread.join(timeout = None)
def main(): from tests.testapp import testapp with testapp(skinname='Windows 7'): f = wx.Frame(None, size=(400, 140)) from twitter.twitter_gui import TwitterInputBoxBase #screen_names = sorted_screen_names(sample_users()) users = sorted(sample_users().values(), key=lambda user: user['screen_name'].lower()) t = TwitterInputBoxBase(f) from twitter.twitter_gui import TwitterAutoCompleteController def complete(): from gui.autocomplete import autocomplete from twitter.twitter_gui import TwitterSearchResult t.a = autocomplete(t, [TwitterSearchResult(u) for u in users], TwitterAutoCompleteController(users)) f.Show()
def main(): from tests.testapp import testapp with testapp(): f = wx.Frame(None) def paint(e): i = 1 dc = wx.PaintDC(e.GetEventObject()) # dc.DrawSplines(((0, 0), (100, 5), (350, 200))) for _x in xrange(100000): # i = i + i dc.DrawSplines(((0, 0), (100, 5), (350, 200))) # dc.DrawLine(0, 0, 50, 50) import gc gc.collect() f.Bind(wx.EVT_PAINT, paint) f.Show()
def main(): from tests.testapp import testapp a = testapp() f = wx.Frame(None, -1, 'history test') t = wx.TextCtrl(f, -1, style = txtFlags) t.history = TestTextHistory(t) st = wx.StaticText(f, -1, '') def onenter(e = None): t.history.commit(t.Value) t.Clear() prnt('index:\t\t',t.history.index,'\nclip:\t\t',t.history.clip,'\nhistory:\t',len(t.history.history),t.history.history) def onkey(e): wx.CallAfter(lambda: st.SetLabel(to_hex(t.Value))) if e.ControlDown() and e.AltDown() and e.KeyCode == wx.WXK_SPACE: from random import choice, randrange import string for i in xrange(200): rstr = ''.join(choice(string.letters) for x in xrange(randrange(5,300))) t.AppendText(rstr) onenter() return e.Skip() t.Bind(wx.EVT_TEXT_ENTER, onenter) t.Bind(wx.EVT_KEY_DOWN, onkey) s = f.Sizer = wx.BoxSizer(wx.VERTICAL) s.Add(t, 1, wx.EXPAND) s.Add(st, 1, wx.EXPAND) f.Show() a.MainLoop() pass
def main(): from tests.testapp import testapp with testapp(release_logging=True, plugins=False): threads = [] for x in xrange(10): threads.append(LogThread(10000)) def foo(): print sys.LOGFILE_NAME with timed(logtofile=r'c:\log.txt'): for thread in threads: thread.start() for thread in threads: thread.join() foo() import os os._exit(0)
def main(): fix_logging() AsyncoreThread.start() import wx a = testapp('../../..') a.toggle_crust() from jabber import protocol global jabber jargs, jkwargs = connection_settings['gtalk'] jabber = protocol(*jargs, **jkwargs) jabber.Connect() a.MainLoop() try: jabber.Disconnect() except: pass AsyncoreThread.join(timeout=None)
def main(): a = testapp() f = wx.Frame(None) w = wx.webview.WebView(f) def on_js_console_message(e): print u'JS {e.LineNumber:>4}: {message}'.format( e=e, message=e.Message.encode('ascii', 'replace')) w.Bind(wx.webview.EVT_WEBVIEW_CONSOLE_MESSAGE, on_js_console_message) js = path(__file__) / '../../../..' / 'res/html/infobox/infobox.js' url = js.abspath().url() html = '''\ <!doctype html> <html> <head> <script src="%s" /> <script> function loadme() { console.log('in load'); updateContent('foo', 'bar'); updateContent('baz', 'meep'); swapToContent('foo'); } </script> <style type="text/css" src="" id="appCSS"></style> </head> <body onload="loadme();"> <a href="javascript:swapToContent('foo');">foo</a> <a href="javascript:swapToContent('baz');">baz</a> <p> <div id="digsby_app_content"></div> </body> </html>''' % url w.SetPageSource(html, 'file://') f.Show() a.MainLoop()
def main(): a = testapp('../../..') f = wx.Frame(None, style = wx.DEFAULT_FRAME_STYLE | wx.FULL_REPAINT_ON_RESIZE) from gui.skin import get as skinget icons = skinget('serviceicons') def paint(e): dc = wx.AutoBufferedPaintDC(f) dc.SetPen(wx.TRANSPARENT_PEN) dc.SetBrush(wx.BLACK_BRUSH) dc.DrawRectangleRect(f.ClientRect) dc.DrawBitmap(icons.gmail, 0, 0, True) dc.DrawBitmap(draw_tiny_text(icons.gmail, 'test').WXB, 0, 40, True) f.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) f.Bind(wx.EVT_PAINT, paint) f.Show() a.MainLoop()
def main(): from tests.testapp import testapp app = testapp() from cgui import TransparentFrame class TransparentWebKit(TransparentFrame): def __init__(self, parent): TransparentFrame.__init__(self, parent) self.webview = wx.webview.WebView(self) def GetBitmap(self): s = self.ClientSize img = wx.EmptyImage(*s) bmp = wx.BitmapFromImage(img) bmp.UseAlpha() dc = wx.MemoryDC(bmp) dc.Clear() dc.DrawRectangleRect(self.ClientRect) self.webview.PaintOnDC(dc, False) dc.SelectObject(wx.NullBitmap) return bmp f = TransparentWebKit(None) w = f.webview w.SetTransparent(True) w.SetPageSource(open(os.path.join(thisdir, 'test.html')).read()) #w.LoadURL('http://webkit.org/blog/138/css-animation/') f.Show() f.SetRect((200, 200, 400, 400)) assert w.IsTransparent() app.MainLoop()
def main(): from tests.testapp import testapp app = testapp() from gui import skin icon = skin.get('AppDefaults.UnreadMessageIcon') #f = wx.Frame(None) #f.Show() #f.SetFrameIcon(skin.get('appdefaults.taskbaricon')) #w = wx.Panel(f) #n = cgui.TabNotebook(f) #n.CreateTab(w, MyTabController()) #print '\n\n' icon = icon.PIL.ResizeCanvas(16, 16).WXB #print n.SetOverlayIcon(icon) import gui.native.win.taskbar as tb print '*'*80 print tb.set_overlay_icon(icon) app.MainLoop()
def main(): app = testapp() import cPickle fbdata_file = os.path.join(os.path.dirname(__file__), r'fbdata.dat') fbdata = cPickle.loads(open(fbdata_file, 'rb').read()) from util import Storage account = Storage(protocol='fb20', connection=Storage(last_stream=fbdata['stream'], last_alerts=fbdata['alerts'], last_status=fbdata['status'])) from fb20.fbacct import FBIB def doit(): before = clock() FBIB(account).get_html(None) return clock() - before print 'first ', doit() print 'second', doit()