Exemplo n.º 1
0
 def __init__(self, h):
     self.ctrl = Label()
     self.Initialize(h)
     self.image = Image()
     self.image.HorizontalAlignment = HorizontalAlignment.Center
     self.image.VerticalAlignment = VerticalAlignment.Center
     if h.get('image'):
         self.image.Source = BitmapImage(
             System.Uri(h['image'], System.UriKind.Relative))
     if h.get('stretch'): self.Stretch(h['stretch'])
     else: self.StretchUniform()
     if h.get('size'):
         self.image.Height = float(h['size'])
         self.image.Width = float(h['size'])
     if h.get('scroll') and h['scroll']:
         scroll = ScrollViewer()
         scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto
         scroll.Content = self.image
         self.ctrl.Content = scroll
     elif h.get('multiple') and h['multiple']:
         stack = StackPanel()
         stack.Orientation = Orientation.Horizontal
         stack.Children.Add(self.image)
         self.ctrl.Content = stack
     else:
         self.ctrl.Content = self.image
Exemplo n.º 2
0
import sys
from System.Threading import Thread, ThreadStart
from System.Windows import Application
from System.Windows.Controls import ScrollViewer

from utils import invoke, SetInvokeRoot

root = Application.Current.LoadRootVisual(ScrollViewer(), "test.xaml")

SetInvokeRoot(root)
output = root.output

class Writer(object):
    @invoke
    def write(self, data):
        output.Text += data
        root.ScrollToVerticalOffset(root.ScrollableHeight + root.ActualHeight)

sys.stderr = sys.stdout = Writer()

print 'Starting....'

# must setup redirection before importing miniunit for
# default streams to work
print 'Importing test framework'
import miniunit

print 'Importing tests'
from tests import test_storage
loader = miniunit.TestLoader()
runner = miniunit.TextTestRunner(verbosity=2)
Exemplo n.º 3
0
 def _showTextBlock():
     sv = ScrollViewer()
     sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto
     sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto
     sv.Content = _getTextBlock(rssItems)
     harriet.ChatWindow.RenderContent(sv)