Beispiel #1
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 #2
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 #3
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",
    "edit-redo-symbolic",
Beispiel #4
0
    def test_add_child_err(self):

        wid = Gtk.Grid()
        self.assertRaises(TypeError, self.notebook.add_child, wid)
Beispiel #5
0
    def test_replace_child_err_1(self):

        wid = Gtk.Grid()
        self.notebook.add_child(self.element)
        self.assertRaises(TypeError, self.notebook.replace_child, self.element,
                          wid)
Beispiel #6
0
def change_child_at_element(wid, prov, child_name):
    global last_widget
    Aduct.change_child_at_element(last_widget, prov, child_name)


# Making a model-button for each provider.
provs = [
    (Button_Provider, Gtk.ModelButton(text="Vertical buttons"), "Vertical buttons"),
    (Button_Provider, Gtk.ModelButton(text="Horizontal buttons"), "Horizontal buttons"),
    (Text_Provider, Gtk.ModelButton(text="Scratch pad"), "Scratch pad"),
    (Images_Provider, Gtk.ModelButton(text="Images"), "Images"),
    (Viewer_Provider, Gtk.ModelButton(text="Workspace"), "Workspace"),
]

prov_grid = Gtk.Grid()  # A grid to store them

for y, (prov, modb, child_name) in enumerate(provs):
    prov_grid.attach(modb, 0, y, 1, 1)
    modb.connect("clicked", change_child_at_element, prov, child_name)

prov_popover = Gtk.PopoverMenu()
prov_popover.add(prov_grid)
prov_grid.show_all()

# 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"),
Beispiel #7
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(margin=2)
icon_names = [
    "list-add-symbolic",
    "document-new-symbolic",
    "document-save-symbolic",
    "edit-undo-symbolic",
    "edit-redo-symbolic",