class Zaguan(object): def __init__(self, uri, controller=None): if controller is None: controller = WebContainerController() self.controller = controller self.uri = uri self.on_close = None def run(self, settings=None, window=None, debug=False, on_close=None): self.on_close = on_close threads_init() if window is None: self.window = Window(WindowType.TOPLEVEL) self.window.set_position(WindowPosition.CENTER_ALWAYS) else: self.window = window browser = self.controller.get_browser(self.uri, debug=debug, settings=settings) self.window.connect("delete-event", self.quit) self.window.set_border_width(0) self.window.add(browser) sleep(1) self.window.show_all() self.window.show() main() def quit(self, widget, event): if self.on_close is not None: self.on_close(widget, event)
def build_image_compare_window(window: Gtk.Window): grouped_images = {} for image in get_duplicates(): grouped_images.setdefault(image["phash"], []).append(image) duplicates_app = DuplicatesApp(grouped_images) window.add(duplicates_app)
def load_tlp_config(_, window: Gtk.Window, reloadtlpconfig: bool) -> None: """Load TLP configuration to UI.""" if reloadtlpconfig: init_tlp_file_config() newmainbox = create_main_box(window) children = window.get_children() for child in children: window.remove(child) window.add(newmainbox) window.show_all()
def load_tlp_config(self, window: Gtk.Window, reloadtlpconfig: bool): if reloadtlpconfig: settings.tlpconfig = read_tlp_file_config(settings.tlpconfigfile) settings.tlpconfig_original = copy.deepcopy(settings.tlpconfig) newmainbox = create_main_box(window) children = window.get_children() for child in children: window.remove(child) window.add(newmainbox) window.show_all()
def load_tlp_config(_, window: Gtk.Window, reloadtlpconfig: bool) -> None: """Load TLP configuration to UI""" if reloadtlpconfig: settings.tlpconfig = read_tlp_file_config(settings.tlpconfigfile) settings.tlpconfig_original = copy.deepcopy(settings.tlpconfig) newmainbox = create_main_box(window) children = window.get_children() for child in children: window.remove(child) window.add(newmainbox) window.show_all()
class MainWindow(object): def __init__(self, extensions): # Start threads threads_init() self.extensions = extensions # Create the main Bluemindo window self.main_window = Window() functions.open_bluemindo(self.main_window) # Handling close button def close_window(wdg, ka): functions.close_bluemindo(self.main_window, True) self.main_window.connect('delete_event', close_window) # Create the whole Header Bar box = HeaderBar() box.set_show_close_button(True) box.props.title = 'Bluemindo' self.main_window.set_titlebar(box) # Add an icon to the window icon_file = join(functions.datadir, 'image', 'logo_head_small.png') pixbuf = Pixbuf.new_from_file(icon_file) self.main_window.set_icon(pixbuf) # Add the about button about_button = Button(relief=2) about_button.add( Image.new_from_gicon(ThemedIcon(name='help-about-symbolic'), IconSize.BUTTON)) box.pack_end(about_button) # Add the reload button refresh_button = Button(relief=2) refresh_button.add( Image.new_from_gicon(ThemedIcon(name='view-refresh-symbolic'), IconSize.BUTTON)) box.pack_end(refresh_button) # Add PREVIOUS/STOP/PLAYPAUSE/NEXT buttons player_box = Box(orientation=Orientation.HORIZONTAL) StyleContext.add_class(player_box.get_style_context(), 'linked') previous_b = Button() previous_b.set_size_request(42, -1) previous_b.add( Image.new_from_gicon( ThemedIcon(name='media-skip-backward-symbolic'), IconSize.BUTTON)) player_box.add(previous_b) stop_b = Button() stop_b.set_size_request(42, -1) stop_b.add( Image.new_from_gicon( ThemedIcon(name='media-playback-stop-symbolic'), IconSize.BUTTON)) player_box.add(stop_b) playpause_b = Button() playpause_b.set_size_request(55, -1) playpause_b.add( Image.new_from_gicon( ThemedIcon(name='media-playback-start-symbolic'), IconSize.BUTTON)) player_box.add(playpause_b) next_b = Button() next_b.set_size_request(42, -1) next_b.add( Image.new_from_gicon( ThemedIcon(name='media-skip-forward-symbolic'), IconSize.BUTTON)) player_box.add(next_b) box.pack_start(player_box) # Create the main window glade_main = join(functions.datadir, 'glade', 'mainwindow.ui') win = gtk_builder() win.set_translation_domain('bluemindo') win.add_from_file(glade_main) self.main_window.add(win.get_object('box1')) # Connect to the about button def show_dialog(wdg): dialog = AboutDialog() dialog.set_transient_for(self.main_window) dialog.set_artists(['Thomas Julien <*****@*****.**>']) dialog.set_authors([ 'Erwan Briand <*****@*****.**>', 'Vincent Berset <*****@*****.**>', 'Thibaut Girka <*****@*****.**>', 'Ľubomír Remák <*****@*****.**>', 'Anaël Verrier <*****@*****.**>' ]) dialog.set_translator_credits( 'Bruno Conde <*****@*****.**>\n' + 'Niklas Grahn <*****@*****.**>\n' + 'Ľubomír Remák <*****@*****.**>\n' + 'Salvatore Tomarchio <*****@*****.**>\n' + 'Shang Yuanchun <*****@*****.**>') dialog.set_copyright('Copyright © 2007-2016 Erwan Briand ' + '<*****@*****.**>') dialog.set_comments( _('Ergonomic and modern music player ' + 'designed for audiophiles.')) dialog.set_license('GNU General Public License (v3)') dialog.set_license_type(10) dialog.set_program_name('Bluemindo') dialog.set_version('1.0RC1') dialog.set_website('http://bluemindo.codingteam.net') pxbf = Pixbuf.new_from_file_at_scale( join(functions.datadir, 'image', 'logo_head_big.png'), 60, 60, True) dialog.set_logo(pxbf) dialog.show_all() about_button.connect('clicked', show_dialog) # Start main handler headerbar_wdg = [ box, None, about_button, refresh_button, player_box, previous_b, stop_b, playpause_b, next_b, None, win.get_object('box1'), self.main_window ] self.wdg = [headerbar_wdg, win] def start_thread(self): # Tell extensions that Bluemindo is now launched self.extensions.load_event('OnBluemindoStarted', self.wdg) # Start the GTK main thread self.main_window.show() self.wdg[0][0].show_all() self.wdg[1].get_object('box3').show() self.wdg[1].get_object('box6').show() gtk_main()