def __init__(self, container): super().__init__() self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout) color = Clutter.Color.new(100, 170, 190, 255) self.set_background_color(color) self._init_elements(container)
def __init__(self): self.index = 0 self.new_slide_transition = Clutter.PropertyTransition.new("x") self.new_slide_transition.connect("stopped", self._clean_up) self.old_slide_transition = Clutter.PropertyTransition.new("x") self.set_clip_to_allocation(True) self.transition_duration = 1000 self.idle_duration = 1000 self.pending_slides = () self.slideshow_on = False self.fullscreen_on = False self.slideshow_on_fullscreen = True self.old_slide = None self.slide = None self.album_length = None self.cached_slide_width = None self.cached_slide_height = None self._prev_content = None self._middleware = None self._exit_button = None self._cover = Clutter.Actor() self._cover.set_layout_manager(Clutter.BinLayout()) self._cover.set_size(unit.w(1), unit.h(1)) self.apply_props()
def __init__(self): super().__init__() self.button = Mx.Button() self.button.set_label("Don't click") self.add_child(self.button) self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout)
def __init__(self): super().__init__() self.set_title("TextApp") self.set_size(800, 600) self.text = TestText() self.cursor = Cursor_Canvas() layout = Clutter.BinLayout() self.container = Clutter.Actor() self.container.set_layout_manager(layout) self.container.add_child(self.text) self.container.add_child(self.cursor) self.pos = Clutter.Text() self.pos2 = Clutter.Text() self.pos.set_background_color(Clutter.Color.new(0, 0, 255, 255)) cursor_pos = self.text.get_cursor_position() coords = self.text.position_to_coords(cursor_pos) self.pos.set_text(''.join(["Kursor na pozycji: ", str(cursor_pos)])) self.pos2.set_text(''.join(["Kursor na koordynatach: ", str(coords)])) self.layout = Clutter.BoxLayout() self.layout.set_orientation(Clutter.Orientation.VERTICAL) self.set_layout_manager(self.layout) self.add_child(self.pos) self.add_child(self.container) self.add_child(self.pos2) self.text.connect("cursor_changed", lambda _1: self.onKeyPress(_1))
def __init__(self): super().__init__() self.button = Mx.Button() self.script = Clutter.Script() self.script.load_from_file('concept/mxButton/button.json') self.button = self.script.get_object('button') self.icon = self.script.get_object('icon') handle = Rsvg.Handle() svg = handle.new_from_file('concept/mxButton/edytuj.svg') pixbuf = svg.get_pixbuf() pixbuf = pixbuf.scale_simple(100, 100, 3) self.icon.set_from_data(pixbuf.get_pixels(), Cogl.PixelFormat.RGBA_8888, pixbuf.get_width(), pixbuf.get_height(), pixbuf.get_rowstride()) self.add_child(self.button) self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout)
def _init_content(self): self.set_layout_manager(Clutter.BinLayout()) json = dirs.get_json_path('loading_screen', '_'.join(['default', pisak.config['skin']])) script = Clutter.Script() script.load_from_file(json) main = script.get_object('main') self.add_actor(main)
def __init__(self, descriptor): super().__init__() self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout) self.views = descriptor.get("views") self.initial = descriptor.get("initial-view") self.initial_data = descriptor.get("initial-data") self.load_view(self.initial, self.initial_data)
def __init__(self): self._hilited = [] self._scanned = [] self._strategy = None self.paused = False self.killed = False self._scanning_hilite = False super().__init__() self.set_layout_manager(Clutter.BinLayout())
def __init__(self): Clutter.Box.__init__(self) self.set_layout_manager(Clutter.BinLayout()) self.set_color(Clutter.Color.new(0, 0, 0, 96)) Gst.bind('show-map-coords', self, 'visible') MapView.bin_layout_add(self, START, START) self.get_layout_manager().add(CoordLabel, CENTER, CENTER) MapView.connect('notify::width', lambda *ignore: self.set_size(MapView.get_width(), 30))
def _load_script(self): self.script = Clutter.Script() self.script.load_from_file("button_layout.json") self.script.connect_signals_full(signals.connect_registered) self.view_actor = self.script.get_object("main") self.image = self.script.get_object("image") self.image.set_from_file(os.path.join(res.PATH, "jagoda.jpg")) self.image.set_scale_mode(2) self.set_layout_manager(Clutter.BinLayout()) self.add_child(self.view_actor)
def __init__(self, container): super().__init__() self.container = container layout = Clutter.BinLayout() self.set_layout_manager(layout) self.set_y_expand(True) self.set_x_expand(True) self.set_reactive(True) self.connect('button_release_event', lambda x, y: self.exit_panel()) self._init_elements()
def __init__(self, text_buffer): super(TextField, self).__init__() self.set_scroll_mode(Clutter.ScrollMode.VERTICALLY) self.text_buffer = text_buffer self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout) white_color = Clutter.Color.new(255, 255, 255, 255) self.set_background_color(white_color) self.font = 'Sans 100px' self._init_field()
def __init__(self): super().__init__() Mx.Style.get_default() script = Clutter.Script() script.load_from_file("scanning.json") script.connect_signals_full(signals.python_connect) main_actor = script.get_object("main") self.add_child(main_actor) self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout)
def __init__(self, container): super(ResultInfoPanel, self).__init__() self.container = container self.word = container.word self.user_word = container.user_word self.result = container.result layout = Clutter.BinLayout() self.set_layout_manager(layout) self.set_y_expand(True) self.set_x_expand(True) self._init_result_info()
def __init__(self): super().__init__() self.button = Mx.Button() self.button.connect("clicked", self.move_cursor) self.button.set_label("Click me to move cursor to (0, 0) position") self.display = Gdk.Display.get_default() self.screen = self.display.get_default_screen() self.add_child(self.button) self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout)
def __init__(self): super(PisakEduContainer, self).__init__() margin = Clutter.Margin() margin.left = margin.right = margin.top = margin.bottom = unit.mm(10) self.set_margin(margin) layout = Clutter.BinLayout() self.set_layout_manager(layout) self.set_x_expand(True) self.set_y_expand(True) self._init_training_set() self._init_params() self._init_panel()
def __init__(self): super().__init__() self._exit_button = None self._engine = None self._menu = None self._middleware = None self._exit_handler = 0 self._prev_content = None self._cover = Clutter.Actor() self._cover.set_layout_manager(Clutter.BinLayout()) self._cover.set_size(unit.w(1), unit.h(1)) self.fullscreen = False
def __init__(self): super().__init__() #self.set_size(dims.MENU_BUTTON_W_PX, dims.MENU_BUTTON_H_PX) self.connect("clicked", self._on_activate) self.idle_icon_name = "hourglass" self.icon_name = None self.icon_size = 50 self.set_layout_manager(Clutter.BinLayout()) self.layout = self.get_children()[0] self.clutter_text = [ i for i in self.layout.get_children() if type(i) == Clutter.Text ][0] self.clutter_text.set_property("ellipsize", 0) self.clutter_text.connect("text-changed", self._resize_reflow) self.connect("notify::mapped", self._initial_label)
def custom_content(self): self.set_icon_visible(False) self.box = Box() original_box = self.get_children()[0] self.clutter_text = original_box.get_children()[1] self.clutter_text.set_property("ellipsize", 0) text_content = self.clutter_text.get_text() if text_content.strip() == '': original_box.set_layout_manager(Clutter.BinLayout()) original_box.add_actor(self.box, 1) else: original_box.add_actor(self.box, 1) self.space = Clutter.Actor() self.box.add_child(self.space) self.image = Mx.Image() self.image.set_scale_mode(1) self.box.add_child(self.image)
def __init__(self, **kw): kw.setdefault("layout-manager", Clutter.BinLayout()) super(PhotosImageWidget, self).__init__(**kw) self._ratio = 1.0 self._base_image = Clutter.Texture() self.add_child(self._base_image) self._border_image = Clutter.Texture() self.add_child(self._border_image) self._crop_overlay = CropOverlay() self.add_child(self._crop_overlay) self._crop_overlay.hide_crop_overlay() self.crop_overlay_visible = False bind_overlay_size = Clutter.BindConstraint( coordinate=Clutter.BindCoordinate.SIZE, source=self._base_image) self._crop_overlay.add_constraint(bind_overlay_size) self.connect('allocation-changed', self.alloc_changed)
def __init__(self): self.fresh_subgroups = False self._subgroups = [] self._hilited = [] self._scanned = [] self._lag_hilited = [] self._strategy = None self._sound = dirs.get_sound_path('scan.wav') self.paused = False self.killed = False self.suppress_collapse_select_on_init = False self.parent_group = None self.signal_source = None self._scanning_hilite = False self.user_action_handler = None self.input_handler_token = None super().__init__() self.observer = _GroupObserver(self) self.set_layout_manager(Clutter.BinLayout()) self.apply_props()
def setup_ui(self): viewport = self.get_stage() video_preview = Clutter.Actor.new() video_preview.set_content_gravity(Clutter.ContentGravity.RESIZE_ASPECT) video_preview.set_x_expand(True) video_preview.set_y_expand(True) video_preview.props.min_height = 100.0 video_preview.props.min_width = 100.0 video_texture = video_preview viewport_layout = Clutter.Actor.new() viewport_layout.add_child(video_preview) viewport_layout_manager = Clutter.BinLayout() background_layer = Clutter.Actor.new() background_layer.props.background_color = \ Clutter.Color.from_string("Black")[1] background_layer.props.x = 0 background_layer.props.y = 0 background_layer.props.width = 100 background_layer.props.height = 100 video_preview.props.request_mode = Clutter.RequestMode.HEIGHT_FOR_WIDTH viewport.add_child(background_layer) viewport_layout.set_layout_manager(viewport_layout_manager) viewport.add_child(viewport_layout) viewport.connect("allocation_changed", self.on_stage_resize, viewport_layout, background_layer) return video_texture
def __init__(self): self.black = Clutter.Box.new(Clutter.BinLayout()) self.black.set_color(Clutter.Color.new(0, 0, 0, 96)) self.label = Clutter.Text() self.label.set_color(Clutter.Color.new(255, 255, 255, 255)) self.xhair = Clutter.Rectangle.new_with_color( Clutter.Color.new(0, 0, 0, 64)) for signal in ['latitude', 'longitude']: map_view.connect('notify::' + signal, display, get_obj('maps_link'), self.label) map_view.connect( 'notify::width', lambda view, param, black: black.set_size(view.get_width(), 30), self.black) scale = Champlain.Scale.new() scale.connect_view(map_view) map_view.bin_layout_add(scale, Clutter.BinAlignment.START, Clutter.BinAlignment.END) map_view.bin_layout_add(self.black, Clutter.BinAlignment.START, Clutter.BinAlignment.START) self.black.get_layout_manager().add(self.label, Clutter.BinAlignment.CENTER, Clutter.BinAlignment.CENTER)
def main(self): # Clutter.init(sys.argv) Gtk.init(sys.argv) GtkClutter.init(sys.argv) window = Gtk.Window() window.resize(800, 600) window.set_title("Clutter tests window") # Window's title window.move(100, 100) window.connect('destroy', lambda x: Gtk.main_quit()) # Connect signal 'destroy' window.set_decorated(False) self.screen = window.get_screen() self.visual = self.screen.get_rgba_visual() if self.visual and self.screen.is_composited(): window.set_visual(self.visual) window.set_app_paintable(True) window.connect("draw", area_draw) box = Gtk.VBox() box.set_margin_top(30) box.set_margin_bottom(30) box.set_margin_left(30) box.set_margin_right(30) make_transparent(box) window.add(box) embed = GtkClutter.Embed() make_transparent(embed) box.add(embed) stage = embed.get_stage() # stage = Clutter.Stage() # Create the Stage color = Clutter.Color.new(77, 75, 69, 0.9 * 255) stage.set_use_alpha(True) stage.set_color(color) #stage.set_opacity(128) stage.set_size(800, 600) stage.set_title("Clutter tests stage") # Window's title #stage.set_fullscreen(True) layout = Clutter.BinLayout() stage.set_layout_manager(layout) # folder = '/d/Pics/Wallpapers/Favorites/' images = [ os.path.join(folder, f) for f in os.listdir(folder) if f.endswith('.jpg') ] self.current = images[1] self.current_texture = get_texture(self.current) stage.add_actor(self.current_texture) web_view = WebKit.WebView() web_view.set_transparent(True) make_transparent(web_view) web_view.set_can_focus(True) web_view.load_string( "<html><body style='background: rgba(100, 0, 0, 0.5); color: white;'>AAAAAAAAAAA</body></html>", "text/html", "UTF-8", "file://" + os.path.dirname(__file__) + "/") web_view_actor = GtkClutter.Actor.new_with_contents(web_view) # web_view_actor.set_width(800) make_transparent(web_view_actor.get_widget()) layout.add(web_view_actor, Clutter.BinAlignment.FILL, Clutter.BinAlignment.END) # web_view_actor.set_opacity(0) # web_view_actor.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 1000, ["opacity"], [255]) # stage.show_all() window.show_all() def go(*args): self.current = images[(images.index(self.current) + 1) % len(images)] nextt = get_texture(self.current) nextt.set_opacity(0) nextt.set_x((stage.get_width() - nextt.get_width()) / 2) nextt.set_y((stage.get_height() - nextt.get_height()) / 2) stage.add_actor(nextt) def a(): a1 = self.current_texture.animatev( Clutter.AnimationMode.EASE_OUT_SINE, 250, ["opacity"], [0]) nextt.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 250, ["opacity"], [255]) previoust = self.current_texture self.current_texture = nextt a1.connect('completed', lambda x: previoust.destroy()) stage.raise_child(web_view_actor, None) GObject.idle_add(a) stage.connect('button-press-event', go) # Clutter.main() # Start the application Gtk.main() # Start the application
def _init_elements(self): self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout) self.contents = PisakSpellerContainer(self) self.add_actor(self.contents)
def _init_layout(self): '''Each class should implement it's own specific layout''' self.stage.set_layout_manager(Clutter.BinLayout())
Bimport sys import os import random from gi.repository import Clutter import unit import widgets import switcher_app class RewardPanel(Clutter.Actor): def __init__(self, container): 1;2802;0c super(RewardPanel, self).__init__() self.container = container layout = Clutter.BinLayout() self.set_layout_manager(layout) self.set_y_expand(True) self.set_x_expand(True) self._init_elements() def _init_elements(self): self._init_reward_info() self._init_reward() def _init_reward_info(self): self.reward_info = widgets.TextField() self.add_actor(self.reward_info) def _init_reward(self): pass #self.reward = song/movie def run_reward(self, reward_file_path):
def __init__(self): super().__init__() self.box = MyBox() self.add_child(self.box) self.set_layout_manager(Clutter.BinLayout())
def _init_elements(self): self.layout = Clutter.BinLayout() self.set_layout_manager(self.layout) self.content = PisakEduContainer() self.content.connect('destroy', lambda _: self.exit_app()) self.add_actor(self.content)
from gi.repository import Clutter, Mx, Mash, Toggle, Cogl, GObject, GLib if __name__ == '__main__': Clutter.init([]) stage = Clutter.Stage() stage.set_size(800, 480) stage.set_title('Clutter - Load image') stage.set_user_resizable(True) stage.set_layout_manager(Clutter.BinLayout()) splash = Clutter.Texture.new_from_file("Toggle_splash.png") stage.add_child(splash) # quit when the window gets closed stage.connect("destroy", lambda w: Clutter.main_quit()) stage.show() Clutter.main()