我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用gi.repository.Gtk.Grid()。
def create_buttons(self): self.grid = Gtk.Grid() self.parent.pack_start(self.grid, True, True, 0) self._buttons = [] x, y = 0, 0 for label in self.BUTTONS: if label: w = self.generate_widget(label) w.set_name("osd-key-buton") self.grid.attach(w, x, y, 1, 1) self._buttons.append(w) x += 1 if x > 2: x = 0 y += 1 w = self.generate_widget(_("Run")) self.grid.attach(w, x, y, 1, 1) self.grid.set_name("osd-dialog-buttons")
def __init__(self): #self._widget = Gtk.Notebook() self._widget = Gtk.Label("Configuration panel for JSHint Plugin") #grid = Gtk.Grid() #for i in range(30): # button = Gtk.CheckButton("Button {}".format(i)) # button.set_tooltip_text("This is the button {}".format(i)) # grid.attach(button, i // 10, i % 10, 1, 1) #self._widget.append_page(grid, Gtk.Label("Enforcing")) #page = Gtk.Box() #page.add(Gtk.Label("Relaxing options")) #self._widget.append_page(page, Gtk.Label("Relaxing")) #page = Gtk.Box() #page.add(Gtk.Label("Environments options")) #self._widget.append_page(page, Gtk.Label("Environments"))
def __init__(self, exname, callback, sensicallback, vars_to_watch): IntervalButtonsWidgetBase.__init__(self, exname, callback, sensicallback) g1 = Gtk.Grid() for i, (x, y) in enumerate(( (0, 0), (1, 0), (2, 0), (3, 0), (0, 1), (1, 1), (2, 1), (3, 1), (0, 2), (1, 2), (2, 2), (3, 2))): g1.attach(self.mk_button(i + 1), x, y, 1, 1) g2 = Gtk.Grid() for i, (x, y) in enumerate(( (0, 0), (1, 0), (2, 0), (3, 0), (0, 1), (1, 1), (2, 1), (3, 1), (0, 2), (1, 2), (2, 2), (3, 2))): g2.attach(self.mk_button(i + 13), x, y, 1, 1) self.set_row_spacing(gu.hig.SPACE_MEDIUM) self.add(g1) self.add(g2) self.post_construct(vars_to_watch)
def __create_album_flowboxitem(self, album, image, margin): label_album = Gtk.Label(f'{album.Name} ({album.Year})', max_width_chars=0, justify=Gtk.Justification.LEFT, wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR, xalign=0, margin_top=5) label_artist = Gtk.Label(album.Artist, max_width_chars=0, justify=Gtk.Justification.LEFT, ellipsize=Pango.EllipsizeMode.END, xalign=0, margin_top=5) label_album.get_style_context().add_class('text110') label_artist.get_style_context().add_class('dim-label') flowboxchild = Gtk.FlowBoxChild(halign=Gtk.Align.CENTER) grid = Gtk.Grid(margin=margin, halign=Gtk.Align.CENTER) grid.attach(image, 0, 0, 1, 1) grid.attach(label_album, 0, 1, 1, 1) grid.attach(label_artist, 0, 2, 1, 1) flowboxchild.add(grid) flowboxchild.data = album return flowboxchild
def __init__(self,main_grid): Gtk.Grid.__init__(self) self.maingrid = main_grid self.n_row = 0 self.set_row_spacing(2) self.widgetlist = widget_list() button1 = step_box("browser",self) self.add(button1) button2 = step_box("alienarena",self) self.add(button2) button3 = step_box("live",self) self.add(button3) button4 = step_box("cs-network",self) self.add(button4)
def __init__(self): Gtk.Grid.__init__(self) self.n_col = 2 self.widget_count = 0 self.set_column_spacing(2) self.set_row_spacing(2) button1 = toolbutton("browser") self.add(button1) button2 = toolbutton("alienarena") self.add(button2) button3 = toolbutton("live") self.add(button3) button4 = toolbutton("cs-network") self.add(button4)
def setup_window(self): self.menubar = controlBar() self.set_titlebar(self.menubar) self.connect_control_buttons() self.edit_menu = dataMenu() self.add_menu = addMenu() self.connect_menu_buttons() main_grid = Gtk.Grid() self.add(main_grid) main_grid.attach(self.menubar, 0, 0, 1, 1) self.interface_switcher = Gtk.Notebook() self.interface_switcher.set_show_tabs(False) main_grid.attach(self.interface_switcher, 0, 1, 1, 1) self.setup_viewer() self.setup_builder()
def __init__(self, title, priority=ItemsProcessorPriority.NORMAL, default=False): super().__init__() self.items = [] self.priority = priority self.default = default self.set_valign(Gtk.Align.FILL) self.set_halign(Gtk.Align.FILL) self.set_hexpand(True) self.set_vexpand(True) self.title = title self.grid = Gtk.Grid() self.add(self.grid) self.show_all()
def make_box(text, length, digit): label = Gtk.Label() label.set_markup("<span size='small'>{}</span>".format(text)) label.set_alignment(0.0, 0.5) label.set_property("margin-top", 10) label.set_property("margin-bottom", 10) entry = Gtk.Entry() if length: entry.set_max_length(length) if digit: entry.set_name(str(digit)) entry.connect("changed", digits_only) grid = Gtk.Grid() grid.attach(label, 0, 0, 1, 1) grid.attach(entry, 0, 1, 1, 1) return grid
def cert(self): page = self.tabs[self.current_page][0] reveal(page.cert_revealer, False) data = page.webview.get_tls_info() popover = build_scrollable_popover(Gtk.PositionType.BOTTOM, -1, 500) grid = Gtk.Grid() grid.set_column_homogeneous(True) for x in range(0, 14): grid.attach(cert_declarations(data, x+1), 0, x, 1, 1) for i in popover: if type(i) == Gtk.ScrolledWindow: i.add(grid) entry = page.main_url_entry popover.set_relative_to(entry) popover.set_pointing_to(entry.get_icon_area(Gtk.EntryIconPosition.SECONDARY)) popover.show_all() self.update_status() return True
def __init__(self): self.placeholder_image = Gtk.Image.new_from_icon_name( Gtk.STOCK_NEW, Gtk.IconSize.DIALOG) self.new_feed_button = Gtk.Button("New Feed") self.new_feed_vbox = Gtk.Box(Gtk.Orientation.VERTICAL) self.new_feed_vbox.set_halign(Gtk.Align.CENTER) self.new_feed_vbox.set_valign(Gtk.Align.CENTER) _pack_widgets(self.new_feed_vbox, self.placeholder_image, self.new_feed_button) self._grid = Gtk.Grid() self._grid.set_row_homogeneous(True) self._grid.set_column_homogeneous(True) self._grid.attach(self.new_feed_vbox, 0, 0, 1, 1) self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG1"), 1, 0, 1, 1) # DEBUG self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG2"), 0, 1, 1, 1) # DEBUG self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG3"), 1, 1, 1, 1) # DEBUG self._grid.show_all() self.container = self._grid
def get_grid(self): """ @description: get the grid @return a Gtk.Grid """ return self.grid
def __init__(self, store, iter=None): self.grid = Gtk.Grid() self.grid.set_border_width(5) self.grid.set_row_spacing(5) self.grid.set_vexpand(True) self.grid.set_hexpand(True) self.grid.set_column_spacing(2) self.grid.set_column_homogeneous(False) self.grid.set_row_homogeneous(False) label1 = Gtk.Label('key sentence') label1.set_justify(Gtk.Justification.LEFT) label1.set_halign(Gtk.Align.START) label1.set_hexpand(True) label2 = Gtk.Label('your command') label2.set_justify(Gtk.Justification.LEFT) label2.set_halign(Gtk.Align.START) ll = Gtk.Label() ll.set_vexpand(True) self.entry1 = Gtk.Entry() if iter is not None: self.entry1.set_text(store[iter][0]) self.combo = self.__get_combobox(store, iter) button = Gtk.Button.new_from_stock(Gtk.STOCK_OK) button.connect("clicked", self.button_clicked, store, iter) button_cancel = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL) button_cancel.connect("clicked", self.do_destroy) self.grid.attach(label1, 0, 0, 11, 1) self.grid.attach(self.entry1, 11, 0, 4, 1) self.grid.attach(label2, 0, 1, 11, 1) self.grid.attach(self.combo, 11, 1, 4, 1) self.grid.attach(ll, 0, 2, 15, 1) self.grid.attach(button_cancel, 13, 3, 1, 1) self.grid.attach(button, 14, 3, 1, 1) self.grid.show_all()
def __init__(self, store, iter=None): self.grid = Gtk.Grid() self.grid.set_border_width(5) self.grid.set_row_spacing(5) self.grid.set_vexpand(True) self.grid.set_hexpand(True) self.grid.set_column_spacing(2) self.grid.set_column_homogeneous(False) label1 = Gtk.Label('key sentence') label1.set_hexpand(True) label1.set_justify(Gtk.Justification.LEFT) label1.set_halign(Gtk.Align.START) label2 = Gtk.Label('your command') label2.set_justify(Gtk.Justification.LEFT) label2.set_halign(Gtk.Align.START) ll = Gtk.Label() ll.set_vexpand(True) self.entry1 = Gtk.Entry() self.entry2 = Gtk.Entry() if iter is not None: self.entry1.set_text(store[iter][0]) self.entry2.set_text(store[iter][1]) button = Gtk.Button.new_from_stock(Gtk.STOCK_OK) button.connect("clicked", self.button_clicked, store, iter) button_cancel = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL) button_cancel.connect("clicked", self.do_destroy) self.grid.attach(label1, 0, 0, 11, 1) self.grid.attach(self.entry1, 11, 0, 4, 1) self.grid.attach(label2, 0, 1, 11, 1) self.grid.attach(self.entry2, 11, 1, 4, 1) self.grid.attach(ll, 0, 2, 15, 1) self.grid.attach(button_cancel, 13, 3, 1, 1) self.grid.attach(button, 14, 3, 1, 1) self.grid.show_all()
def create_parent(self): g = Gtk.Grid() g.set_name("osd-menu") return g
def setup_widgets(self): self.parent = Gtk.Grid() self.parent.set_name("osd-gesture") self._left_draw = GestureDraw(self.SIZE, self._left_detector) # self._right_draw = GestureDraw(self.SIZE, self._right_detector) sep = Gtk.VSeparator() sep.set_name("osd-gesture-separator") self.parent.attach(self._left_draw, 0, 0, 1, 1) # self.parent.attach(sep, 1, 0, 1, 1) # self.parent.attach(self._right_draw, 2, 0, 1, 1) self.add(self.parent)
def __init__(self, app, name, use_icon, enable_press, widget): self.pressed = Gtk.Label() if enable_press else None self.click_button = SCButtons.STICKPRESS ControllerWidget.__init__(self, app, name, use_icon, widget) grid = Gtk.Grid() self.widget.set_events(Gdk.EventMask.POINTER_MOTION_MASK) self.widget.connect('motion-notify-event', self.on_cursor_motion) self.label.set_property("vexpand", True) self.label.set_property("hexpand", True) if self.pressed: self.label.set_xalign(0.0); self.label.set_yalign(0.5) self.pressed.set_property("hexpand", True) self.pressed.set_xalign(0.0); self.pressed.set_yalign(1.0) grid.attach(self.pressed, 2, 2, 1, 1) else: self.label.set_xalign(0.5); self.label.set_yalign(0.5) self.pressed = None if self.icon: self.icon.set_margin_right(5) grid.attach(self.icon, 1, 1, 1, 2) grid.attach(self.label, 2, 1, 1, 1) self.over_icon = False self.enable_press = enable_press self.widget.add(grid) self.widget.show_all()
def h_spacer(self, addwidth): # horizontal spacer spacegrid = Gtk.Grid() if addwidth: label1 = Gtk.Label() label2 = Gtk.Label() spacegrid.attach(label1, 0, 0, 1, 1) spacegrid.attach(label2, 1, 0, 1, 1) spacegrid.set_column_spacing(addwidth) return spacegrid
def __init__(self, exname, callback, sensicallback): """ callback -- the function to call when the user click on a button. sensicallback -- a function that will return a list of all interval it will be asked for. """ Gtk.Grid.__init__(self) cfg.ConfigUtils.__init__(self, exname) self.set_orientation(Gtk.Orientation.VERTICAL) self.get_sensitive_buttons = sensicallback self.m_callback = callback self.m_buttons = {}
def row(self, *data): row = Gtk.Grid() row.set_column_homogeneous(True) self.add(row) for i in data: row.add(self.mk_button(i))
def create_grid (self): self.grid = Gtk.Grid()
def __create_artist_flowboxitem(self, artist, image, margin): label_album = Gtk.Label(artist.Name, max_width_chars=0, justify=Gtk.Justification.LEFT, ellipsize=Pango.EllipsizeMode.END, xalign=0, margin_top=5) label_album.get_style_context().add_class('text110') flowboxchild = Gtk.FlowBoxChild() grid = Gtk.Grid(margin=margin, halign=Gtk.Align.CENTER) grid.attach(image, 0, 0, 1, 1) grid.attach(label_album, 0, 1, 1, 1) flowboxchild.add(grid) flowboxchild.data = artist return flowboxchild
def __init__(self): Gtk.Grid.__init__(self) self.spinner = Gtk.Spinner(halign=Gtk.Align.CENTER, valign=Gtk.Align.CENTER, expand=True) self.spinner.start() self.add(self.spinner)
def rows(grid: Gtk.Grid) -> int: return max(map(lambda child: grid.child_get_property(child, 'top-attach'), grid.get_children()), default=-1) + 1
def __init__(self, grid: Gtk.Grid): self.grid = grid self.base_row = rows(grid) self.attached = []
def add_to_grid(self, grid: Gtk.Grid): raise Exception('abstract')
def add_to_grid(self, grid: Gtk.Grid): if self.tenant: raise Exception('Already added to a grid') tenant = self.tenant = GridRowTenant(grid) base = 0 if tenant.base_row > 0: tenant.attach(Gtk.Separator(visible=True, hexpand=True), width=FINISHED_JOB_COLUMNS) base += 1 tenant.attach(self.title_box, top=base) tenant.attach(self.finish_box, top=base, left=1) tenant.attach(self.buttons, top=base, left=2) tenant.attach(self.extra, top=base+1, width=FINISHED_JOB_COLUMNS) grid.get_toplevel().register_interest_in_sources(on_update_callback=self.on_source_update)
def add_to_grid(self, grid: Gtk.Grid): if self.tenant: raise Exception('Already added to a grid') tenant = self.tenant = GridRowTenant(grid) base = 0 if tenant.base_row > 0: tenant.attach(Gtk.Separator(visible=True, hexpand=True), width=FINISHED_JOB_COLUMNS) base += 1 tenant.attach(self.title_box, top=base) tenant.attach(self.finish_box, top=base, left=1) tenant.attach(self.buttons, top=base, left=2) tenant.attach(self.extra, top=base + 1, width=FINISHED_JOB_COLUMNS) grid.get_toplevel().register_interest_in_sources(on_update_callback=self.on_source_update)
def add_to_grid(self, grid: Gtk.Grid): if self.tenant: raise Exception('Already added to a grid') tenant = self.tenant = GridRowTenant(grid) base = 0 if tenant.base_row > 0: tenant.attach(Gtk.Separator(visible=True, hexpand=True), width=FINISHED_JOB_COLUMNS) base += 1 tenant.attach(self.title_box, top=base) tenant.attach(self.finish_box, top=base, left=1) tenant.attach(self.buttons, top=base, left=2) tenant.attach(self.extra, top=base+1, width=FINISHED_JOB_COLUMNS)
def add_to_grid(self, grid: Gtk.Grid): if self.tenant: raise Exception('Already added to a grid') tenant = self.tenant = GridRowTenant(grid) base = 0 if tenant.base_row > 0: tenant.attach(Gtk.Separator(visible=True, hexpand=True), width=FINISHED_JOB_COLUMNS) base += 1 tenant.attach(self.title_box, top=base) tenant.attach(self.finish_box, top=base, left=1) tenant.attach(self.buttons, top=base, left=2) tenant.attach(self.extra, top=base + 1, width=FINISHED_JOB_COLUMNS)
def __init__(self): Gtk.Grid.__init__(self) self.contentbox = content_box() stepgrid = step_grid(self) self.attach(stepgrid,0,0,1,1) self.attach(self.contentbox,0,1,1,1)
def __init__(self, n_col): Gtk.Grid.__init__(self) self.n_col = n_col self.widget_count = 0 self.set_column_spacing(2) self.set_row_spacing(2)
def __init__(self): Gtk.Window.__init__(self, title="TextView Example") self.set_default_size(-1, 350) self.grid = Gtk.Grid() self.add(self.grid) self.create_textview() self.create_toolbar() self.create_buttons()
def __init__(self,MainGrid): Gtk.Grid.__init__(self) self.MainGrid=MainGrid self.imgbox = img_box(self) self.attach(self.imgbox,0,0,1,1) self.set_hexpand(True) self.set_valign(Gtk.Align(3))
def __init__(self,window): Gtk.Grid.__init__(self) self.window = window self.set_column_spacing(25) #arbitrary initialisations for underdeveloped stuff self.stepsbox = steps_box(self) self.contentgrid = content_grid2(self) #end of arbitary stuff self.attach(self.stepsbox,0,0,1,1) self.attach_next_to(self.contentgrid,self.stepsbox,Gtk.PositionType.RIGHT,1,1) self.name = "HELLO"
def __init__(self): Gtk.Window.__init__(self, title="FileChooser Example") self.maximize() self.fold_str = None self.grid = Gtk.Grid(column_homogeneous=False, column_spacing=10, row_spacing=0) self.add(self.grid) button1 = Gtk.Button("Choose File") button1.connect("clicked", self.on_file_clicked) self.grid.add(button1) self.text_file = Gtk.Entry() self.grid.attach(self.text_file,1,0,4,1) button2 = Gtk.Button("Choose Folder") button2.connect("clicked", self.on_folder_clicked) button2.set_relief(Gtk.ReliefStyle(0)) self.grid.attach_next_to(button2,button1,Gtk.PositionType.BOTTOM,1,1) self.text_folder = Gtk.Entry() self.grid.attach(self.text_folder,1,1,4,1) but3=buttontest() self.grid.attach(but3,0,2,1,1)
def __init__(self,parent): Gtk.Grid.__init__(self) self.set_border_width(10) self.vbox = Gtk.VBox(spacing=6) self.vbox = Gtk.Box(spacing=6) self.add(self.vbox) self.button1 = Gtk.ToggleButton("Button1") self.button1.connect("toggled", self.on_button_toggled, "1") self.button1.set_active(True) #self.button1img = Gtk.Image.new_from_icon_name("filenew", Gtk.IconSize.MENU) #self.button1.set_image(self.button1img) self.vbox.pack_start(self.button1, True, True, 0) self.button2 = Gtk.ToggleButton("Button 2") self.button2.connect("toggled", self.on_button_toggled, "2") self.vbox.pack_start(self.button2, True, True, 0) self.button3 = Gtk.ToggleButton("Button 3") self.button3.connect("toggled", self.on_button_toggled, "3") self.vbox.pack_start(self.button3, True, True, 0) self.attach(self.button1, 0, 0, 1, 1) self.attach(self.button2, 1, 0, 3, 1) self.attach(self.button3, 2, 0, 1, 1)
def __init__(self,parent): Gtk.Grid.__init__(self) self.set_column_spacing(25) step = stepbox(self) main= mainbox(self) side = sidebox(self) self.attach(step, 0, 0, 20, 10) self.attach(main, 21, 0, 40, 10) self.attach(side, 61, 0, 10, 10)
def __init__(self, years=4): Gtk.Grid.__init__(self) # Tells which position the rightmost column is self.width = 0 self.nth = { 1: "First", 2: "Second", 3: "Third", 4: "Fourth", 5: "Fifth", 6: "Sixth" } self.year_map = {} self.set_margin_top(10) self.set_margin_bottom(10) self.set_margin_start(10) self.set_margin_end(10) horizontal_separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL) horizontal_separator.set_margin_top(5) horizontal_separator.set_margin_bottom(10) self.attach(horizontal_separator, 0, 1, 2, 1) for x in range(1,years+1): self.add_year(x) self.show_all()
def __init__(self): #########Setting_Basic_Window_Size&Border######################################## Gtk.Window.__init__(self,title="Impress Writer") self.set_border_width(1) self.set_default_size(1366,768) ###################Header_Bar################################################### hb=Gtk.HeaderBar() hb.set_show_close_button(True) hb.props.title="Impress Writer" self.set_titlebar(hb) #############################Adding_Overall_Grid################################ self.grid=Gtk.Grid() self.add(self.grid) ###################Adding_Toolbar############################################ self.create_toolbar_top() ###########Adding_TextView################################################# self.text_grid = Gtk.Grid() self.create_main_view() self.create_textview() self.create_toolbar() self.create_buttons() #############Adding synonyms flowbox###################################### self.create_synonyms_flowbox()
def __init__(self, app): super().__init__() self.set_application(app) self.set_title(version.APP_NAME) self.set_position(Gtk.WindowPosition.CENTER) self.set_skip_taskbar_hint(True) self.set_skip_pager_hint(True) self.set_urgency_hint(True) self.set_decorated(False) self.set_name('MainWindow') self.set_icon_from_file(common.ICON_PATH) self.set_keep_above(True) self.set_keep_below(False) self.set_type_hint(Gdk.WindowTypeHint.NORMAL) self.stick() self.maximize() screen = self.get_screen() visual = screen.get_rgba_visual() self.set_visual(visual) self.grid = Gtk.Grid() self.grid.set_valign(Gtk.Align.FILL) self.grid.set_halign(Gtk.Align.FILL) self.grid.set_vexpand(True) self.grid.set_hexpand(True) self.add(self.grid)
def createSubTab(Tab, notebook, label): Tab.set_border_width(10) notebook.append_page(Tab, Gtk.Label(label)) Frame = Gtk.Frame() Tab.add(Frame) Grid = Gtk.Grid() Frame.add(Grid) return Grid # Setting Columns in TreeView
def createSubFrame(Tab): Frame = Gtk.Frame() Tab.add(Frame) grid = Gtk.Grid() Frame.add(grid) return grid
def create_widgets(self): self.grid = Gtk.Grid() self.file_selecter = FileSelecter() self.paint_area = PaintArea() self.paint_background = BackgroundColor() self.paint_color = PaintColor() self.size = Size() self.var_list = VariableList() self.name = Gtk.Entry() self.name.get_buffer().set_text('MyTheme', -1) export = Gtk.Button('Export') export.connect('clicked', self.export) load = Gtk.Button('Load') load.connect('clicked', self.load) paned2 = Gtk.Paned() paned2.set_position(200) paned2.add1(self.paint_area) paned2.add2(self.var_list) paned = Gtk.Paned() paned.set_position(200) paned.add1(self.file_selecter) paned.add2(paned2) self.grid.attach(paned, 0, 0, 10, 10) self.grid.attach(self.paint_background, 1, 10, 1, 1) self.grid.attach(self.paint_color, 2, 10, 1, 1) self.grid.attach(self.size, 3, 10, 1, 1) self.grid.attach(export, 8, 10, 1, 1) self.grid.attach(load, 9, 10, 1, 1) self.grid.attach(self.name, 7, 10, 1, 1) self.add(self.grid) return None
def make_plugin_grid(icon, plg, mdesc, mexts, mtype): grid = Gtk.Grid() grid.set_column_homogeneous(False) grid.set_property("margin", 20) plg_grid = Gtk.Grid() plg_grid.set_column_spacing(10) plg_grid.attach(icon, 0, 0, 1, 1) plg_grid.attach(plg, 1, 0, 1, 1) mime_grid = Gtk.Grid() mime_grid.set_hexpand(True) mime_grid.set_column_spacing(10) mime_grid.set_row_spacing(5) mime_grid.set_column_homogeneous(True) mime_grid.set_row_homogeneous(False) mime_grid.attach(make_mime_label("<b>{}</b>".format(_("MIME Type")), 1,), 0, 0, 1, 1) mime_grid.attach(make_mime_label("<b>{}</b>".format(_("Description")), 1), 1, 0, 1, 1) mime_grid.attach(make_mime_label("<b>{}</b>".format(_("Extension")), 1), 2, 0, 1, 1) for c, i in enumerate(mtype): mime_grid.attach(make_mime_label(i, 0), 0, c+1, 1, 1) for c, i in enumerate(mdesc): mime_grid.attach(make_mime_label(i, 0), 1, c+1, 1, 1) for c, i in enumerate(mexts): if not i: i = "" else: i = ", ".join(i) mime_grid.attach(make_mime_label(i, 0), 2, c+1, 1, 1) frame_mime = Gtk.Frame(name="frame_mime") frame_mime.add(mime_grid) grid.attach(plg_grid, 0, 0, 1, 1) grid.attach(frame_mime, 0, 1, 1, 1) return grid
def setting_element(option, title, value, tp, desc, list): grid = Gtk.Grid() label = Gtk.Label() label.set_alignment(0.0, 0.5) label.set_property("margin-bottom", 10) if desc: label.set_markup(\ "{}\n<span size='small'>{}</span>".format(_(title), _(desc))) else: label.set_markup(_(title)) if tp == "1": elem = Gtk.Entry(name=option) elem.set_width_chars(30) elem.set_text(value) if tp == "2": elem = Gtk.ComboBoxText(name=option) elem.set_entry_text_column(0) for i in list: elem.append_text(i) elem.set_active(int(value)) grid.attach(label, 0, 0, 1, 1) grid.attach(elem, 0, 1, 1, 1) grid.set_property("margin", 10) return grid
def on_created_destination(self, download, destination): name = get_filename(destination) unname = unparse(destination) item = Gtk.ModelButton(name=unname) item.set_alignment(0.0, 0.5) item.set_label("<span size='small'>{}: {}</span>\r<span size='x-small'>{}: {}</span>"\ .format(_("Downloading"), minify(html.escape(name), 50),\ _("In"), minify(html.escape(destination.replace("file://", "")), 50))) item.get_child().set_use_markup(True) item.get_child().set_padding(5, 5) item.connect("clicked", lambda x: subprocess.Popen\ ([app_launcher, os.path.dirname(destination)])) canc = make_button(make_icon("edit-delete.svg"), None, False) canc.connect("clicked", lambda x: [download.cancel(),\ self.dlview.remove(grid), self.on_cancel_download()]) rest = make_button(make_icon("refresh.svg"), None, False) rest.connect("clicked", lambda x: [download.cancel(),\ self.dlview.remove(grid), self.on_cancel_download(),\ self.on_restart_download(download)]) pbar = Gtk.ProgressBar(name=unname) grid = Gtk.Grid() grid.set_column_spacing(0) grid.attach(canc, 0, 0, 1, 1) grid.attach(rest, 1, 0, 1, 1) grid.attach(item, 2, 0, 1, 1) grid.attach(pbar, 2, 1, 1, 1) grid.set_column_homogeneous(False) self.dlview.add(grid) self.dlview.reorder_child(grid, 0) self.on_download_menu()
def preparePostEditingAnalysis(self): self.saveChangedFromPostEditing() self.diff_tab_grid = Gtk.Grid() self.diff_tab_grid.set_row_spacing(1) self.diff_tab_grid.set_column_spacing(20) self.tables["diff_table"] = Table("diff_table",self.post_editing_source,self.post_editing_reference, self.preparePostEditingAnalysis_event,self.preparePostEditingAnalysis, self.calculate_statistics_event, self.diff_tab_grid,self.output_directory) self.addDifferencesTab() self.tables["translation_table"].save_post_editing_changes_button.hide() self.visibility_of_statistics_menu = False self.tables["translation_table"].statistics_button.show()