Beispiel #1
0
    def get_a_child(self, child_name):

        child_dict = {"child_name": child_name, "provider": self}
        child_dict["child"] = Gtk.Label(label="Test Label")
        child_dict["icon"] = Gtk.Image.new_from_icon_name("test", 2)
        child_dict["header_child"] = Gtk.Label(label="Test Header")

        return child_dict
Beispiel #2
0
    def get_child_from_props(self, props):

        child = Gtk.Label(label=props["child_label"])
        header_child = Gtk.Label(label=props["header_label"])
        icon = Gtk.Image.new_from_icon_name("test", 2)

        child_dict = {
            "child": child,
            "icon": icon,
            "header_child": header_child
        }
        return child_dict
Beispiel #3
0
    def get_a_child(self, child_name):

        title = Gtk.Label(label="<b>Images</b>", use_markup=True)
        side_grid = Gtk.Grid()
        lb = Gtk.ListBox(expand=True)
        for name in self.row_names:
            label = Gtk.Label(label=name, halign=1)
            lb.prepend(label)
        side_grid.attach(title, 0, 0, 1, 1)
        side_grid.attach(lb, 0, 1, 1, 1)
        child_dict = {}
        child_dict["child_name"] = child_name
        child_dict["child"] = side_grid
        child_dict["header_child"] = None
        child_dict["icon"] = Gtk.Image.new_from_icon_name("image-x-generic-symbolic", 2)
        return child_dict
Beispiel #4
0
    def get_a_child(self, child_name):

        button_grid = Gtk.Grid(hexpand=True, margin=2)
        child_dict = {}
        child_dict["child_name"] = child_name
        child_dict["icon"] = Gtk.Image.new_from_icon_name(
            "document-properties-symbolic", 2
        )

        if child_name == "Vertical buttons":
            for y, name in enumerate(self.icon_names):
                icon = Gtk.Image.new_from_icon_name(name, 2)
                button = Gtk.Button(margin=2, relief=2)
                button.add(icon)
                button_grid.attach(button, 0, y, 1, 1)
                child_dict["header_child"] = None
                child_dict["child"] = button_grid

        elif child_name == "Horizontal buttons":
            for x, name in enumerate(self.icon_names):
                icon = Gtk.Image.new_from_icon_name(name, 2)
                button = Gtk.Button(margin=2, relief=2)
                button.add(icon)
                button_grid.attach(button, x, 0, 1, 1)
                child_dict["header_child"] = button_grid
                child_dict["child"] = Gtk.Label()

        return child_dict
Beispiel #5
0
    def get_a_child(self, child_name):

        label = Gtk.Label(margin=5, label="Hello world")

        icon = Gtk.Image.new_from_icon_name("glade", 2)
        child_props = {
            "child_name": "Label",
            "child": label,
            "icon": icon,
            "header_child": None,
        }
        return child_props
Beispiel #6
0
gi.require_version("GtkSource", "4")
from gi.repository import GtkSource
from Aduct import Gtk

img = Gtk.Image.new_from_file(
    "/home/j_arun_mani/Pictures/Abstracts and Stuff/Abstract 1.jpg")
scrolled = Gtk.ScrolledWindow(expand=True, margin=2)
scrolled.add(img)

lm = GtkSource.LanguageManager()
lang = lm.get_language("rst")
buf = GtkSource.Buffer(language=lang)
textview = GtkSource.View(editable=True, buffer=buf, margin=5)

title = Gtk.Label(label="<b>Images</b>", use_markup=True)
side_grid = Gtk.Grid()
lb = Gtk.ListBox(expand=True)
row_names = ["Nature.png", "Seashore.jpg", "Overview.png", "Dynamite.png"]
for name in row_names:
    label = Gtk.Label(label=name, halign=1)
    lb.prepend(label)
side_grid.attach(title, 0, 0, 1, 1)
side_grid.attach(lb, 0, 1, 1, 1)

button_grid = Gtk.Grid(hexpand=True, margin=2)
icon_names = [
    "list-add-symbolic",
    "document-new-symbolic",
    "document-save-symbolic",
    "edit-undo-symbolic",
Beispiel #7
0
# Pretty same as providers, but for tweak functions.
tweaks = {
    "Element": (Gtk.ModelButton(text="Remove"),),
    "Paned": (
        Gtk.ModelButton(text="Split left"),
        Gtk.ModelButton(text="Split right"),
        Gtk.ModelButton(text="Split up"),
        Gtk.ModelButton(text="Split down"),
    ),
}

tweak_grid = Gtk.Grid()

for x, title in enumerate(tweaks):
    label = Gtk.Label(label=title)
    tweak_grid.attach(label, x, 0, 1, 1)
    modbs = tweaks[title]
    for y, modb in enumerate(modbs):
        tweak_grid.attach(modb, x, y + 1, 1, 1)

tweak_popover = Gtk.PopoverMenu()
tweak_popover.add(tweak_grid)
tweak_grid.show_all()


def connect_tweaks():
    # Connecting model-buttons to required functions.
    elem_modb = tweaks["Element"][0]
    elem_modb.connect("clicked", remove_element)