def _init_elements(self): self.preview = Mx.Image() self.preview.set_allow_upscale(True) self.box.add_child(self.preview) self.label = Mx.Label() self.label.set_style_class("PisakPhotoTileLabel") self.box.add_child(self.label)
def __init__(self): super().__init__() self.button = Mx.Button() self.style = Mx.Style() self.style.load_from_file(os.path.join(res.PATH, "style.css")) self.button.set_style(self.style) self.button.set_label("Don't click") print(self.button.list_properties()) self.add_child(self.button)
def _init_text(self): self.box = Mx.BoxLayout() self.box.set_orientation(Mx.Orientation.VERTICAL) self.box.set_scroll_to_focused(True) self.text = Mx.Label() self.margin = Clutter.Margin.new() self.margin.top = 20 self.margin.left = self.margin.right = 10 self.text.set_margin(self.margin) self.box.add_actor(self.text, 0) self.clutter_text = self.text.get_clutter_text() self.connect("notify::mapped", self._check_to_resize) self.clutter_text.connect("text-changed", self._check_to_resize) self.clutter_text.connect("cursor-changed", self._scroll_to_view) self._set_text_params() self.add_actor(self.box)
def make_keyboard(self, keyset=0): # yapf: disable keys = [[["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", " << "], ["a", "s", "d", "f", "g", "h", "j", "k", "l", "'"], [" ^", "z", "x", "c", "v", "b", "n", "m", ",", ".", " ^"], [" 123 ", " ", " }]? "] ], [["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " << "], ["=", "-", "+", "*", "/", "\\", ":", ";", "'", "\""], ["(", ")", "#", "$", "!", "?", "@", "m", ",", "."], [" ABC ", " ", " ABC "] ], [["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", " << "], ["A", "S", "D", "F", "G", "H", "J", "K", "L", "'"], ["^ ", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "^ "], [" 123 ", " ", " }]? "] ]] # yapf: enable for i, row in enumerate(keys[keyset]): key_row = self.config.ui.get_object("row-" + str(i)) key_row.remove_all_children() for letter in row: key = Mx.Button() key.set_style_class("keyboard") key.set_label(letter) key.letter = letter key_row.add_actor(key) tap = Clutter.TapAction() key.add_action(tap) tap.connect("tap", self.keyboard_tap) self.config.ui.get_object("wifi-overlay").show()
def _init_text(self): text = Mx.Label() text.set_style_class("LoadingPanel") text.set_text(MESSAGES["application_loading"]) text.set_x_align(Clutter.ActorAlign.CENTER) text.set_y_align(Clutter.ActorAlign.CENTER) self.add_child(text)
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__(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, mailbox): super().__init__() self.hilite_tool = widgets.Aperture() self.label = layout.Box() self.box.add_child(self.label) self.label.orientation = Clutter.Orientation.VERTICAL self.label.ratio_spacing = 0.03 frame = widgets.Frame() frame.set_style_class('PisakEmailMessageTile') self.add_child(frame) margin = unit.h(0.0095) # create separate label for each header, specific to the given # `mailbox`; each label is set as an attribute of `self` with a # name of the corresponding header's lower-cased name; # list of headers is at the moment taken from the `imap_client` module. for header in imap_client.MAILBOX_HEADERS[mailbox]: label = Mx.Label() setattr(self, header.lower(), label) label.set_margin_right(margin) label.set_margin_left(margin) label.get_clutter_text().set_line_alignment(Pango.Alignment.CENTER) label.set_style_class('PisakEmailMessageTile' + header) self.label.add_child(label)
def __init__(self): super().__init__() self.photo_path = None self.image_buffer = None self.photo = Mx.Image() self.photo.set_scale_mode(Mx.ImageScaleMode.FIT) self.add_child(self.photo)
def with_target(self, value): self._with_target = value if value and self._face is None: self._face = Mx.Image() self._face.set_from_file(self.FACE_PATH) self._face.set_scale_mode(Mx.ImageScaleMode.FIT) self._face.hide() self.get_parent().add_child(self._face)
def __init__(self): super().__init__() margin = 8 self.label = layout.Box() self.box.add_child(self.label) self.label.orientation = Clutter.Orientation.VERTICAL self.label.spacing = 20 self.title = Mx.Label() self.date = Mx.Label() self.title.set_margin_right(margin) self.title.set_margin_left(margin) self.date.set_margin_right(margin) self.date.set_margin_left(margin) self.title.get_clutter_text().set_line_alignment( Pango.Alignment.CENTER) self.date.get_clutter_text().set_line_alignment( Pango.Alignment.CENTER) self.title.set_style_class("PisakBlogPostTileTitle") self.date.set_style_class("PisakBlogPostTileDate") self.label.add_child(self.title) self.label.add_child(self.date)
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().__init__() self.layout = Clutter.BoxLayout() self.set_layout_manager(self.layout) # Uncomment one of these lines #self.box = self.create_box_actor() #self.box = self.create_box_mx() self.box = self.create_box_custom() self.box.set_x_expand(True) self.box.set_y_expand(True) self.add_child(self.box) self.button_a = Mx.Button() self.button_a.set_label("A") self.box.add_child(self.button_a) self.button_b = Mx.Button() self.button_b.set_label("B") self.button_b.set_x_expand(True) self.box.add_child(self.button_b)
def _init_text(self): self.box = Mx.BoxLayout() self.box.set_orientation(Mx.Orientation.VERTICAL) self.box.set_scroll_to_focused(True) self.text = widgets.Label() self.margin = Clutter.Margin.new() self.margin.top = 20 self._lines_quantity = 0 self.margin.left = self.margin.right = 10 self.text.set_margin(self.margin) self.box.add_actor(self.text, 0) self.clutter_text = self.text.get_clutter_text() self.connect("notify::mapped", self._init_setup) self._set_text_params() self.add_actor(self.box)
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 make_keyboard(ui): # yapf: disable keys = [["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "<<"], ["a", "s", "d", "f", "g", "h", "j", "k", "l", "m"], [" ^", "z", "x", "c", "v", "b", "n", "m", ",", ".", "^ "], [" 123 ", " ", " }]? "] ] # yapf: enable for i, row in enumerate(keys): key_row = ui.get_object("row-" + str(i)) for letter in row: key = Mx.Button() key.set_style_class("keyboard") #key.set_property("min-width", 20) key.set_label(letter) key_row.add_actor(key)
def make_wifi_tab(self, ap): logging.debug("make_wifi") actor = Clutter.Actor() actor.set_size(self.actor_width, 40) text = Mx.Label() text.set_position(120, 0) apName = ap["service"][1]["Name"] if ap["active"]: text.set_text("* " + apName) else: text.set_text( " " + apName ) # the space is to keep the names aligned on the display text.set_style_class("wifi") actor.add_actor(text) tap = Clutter.TapAction() actor.add_action(tap) actor.ap = ap tap.connect("tap", self.ap_tap) actor.set_reactive(True) return actor
def _init_label(self): self.label = Mx.Label() self.add_actor(self.label)
def _init_icon(self): self.icon = Mx.Image() self.add_actor(self.icon)
def _display_popup_widget(self, container, message): popup = Mx.Label() popup.set_text(message) popup.set_style_class("PisakPopUp") container.add_child(popup)
def _init_bar(self): self.bar = Mx.ProgressBar() self.bar.set_x_expand(True) self.bar.set_y_expand(True) self.insert_child_below(self.bar, None)
def __init__(self): super().__init__() self.label = Mx.Label() self.label.set_style_class("PisakViewerProgressBar") self.bar.get_children()[0].set_style_class("PisakViewerProgressBar") self.bar.set_style_class("PisakViewerProgressBar")
def create_box_mx(self): return Mx.BoxLayout()