本文整理汇总了Python中tests.testapp.testapp函数的典型用法代码示例。如果您正苦于以下问题:Python testapp函数的具体用法?Python testapp怎么用?Python testapp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了testapp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fakeprefs
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)
示例2: test_status_dialog
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()
示例3: main
def main():
from tests.testapp import testapp
import netextensions
with testapp():
from pprint import pprint
OneRiotAdSource('digsby01').request_ads(pprint)
示例4: main
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()
示例5: main
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()
示例6: main
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()
示例7: main
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()
示例8: test_account_panel
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()
示例9: main2
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])
示例10: main
def main():
from tests.testapp import testapp
app = testapp()
show_dialog()
app.MainLoop()
示例11: main
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)
示例12: main
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()
示例13: main
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()
示例14: main2
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()
示例15: main2
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()