我们从Python开源项目中,提取了以下35个代码示例,用于说明如何使用gtk.VBox()。
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
def __init__(self): super(PyApp, self).__init__() self.set_title("Web Stalker Browser") self.set_size_request(1000,600) self.set_position(gtk.WIN_POS_CENTER) vbox = gtk.VBox(False, 5) scw = gtk.ScrolledWindow(None, None) web = webkit.WebView() url = sys.argv[1] web.open(url) scw.add(web) vbox.add(scw) gobject.threads_init() self.add(vbox) self.connect("destroy", gtk.main_quit) self.show_all()
def __init__(self): imageLoc = random.choice(os.listdir(os.path.join(WORKINGDIR, "data", "splashScreens"))) imageSize = self.get_image_size(open(os.path.join(WORKINGDIR, "data", "splashScreens", imageLoc), 'rb').read()) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_decorated(False) self.window.set_title("Micro:Pi") self.window.set_icon_from_file(os.path.join(WORKINGDIR, "data", "icon.png")) self.window.set_size_request(imageSize[0], -1) self.window.set_position(gtk.WIN_POS_CENTER) main_vbox = gtk.VBox(False, 1) self.window.add(main_vbox) hbox = gtk.HBox(False, 0) self.img = gtk.Image() self.img.set_from_file(os.path.join(WORKINGDIR, "data", "splashScreens", imageLoc)) main_vbox.pack_start(self.img, True, True) self.lbl = gtk.Label('') font = pango.FontDescription("Monospace 7") self.lbl.modify_font(font) main_vbox.pack_end(self.lbl, False, False) self.refresh() self.window.show_all() self.refresh()
def __init__(self, mpi): import webkit self.webview = webkit.WebView() self.scroller = gtk.ScrolledWindow() self.scroller.add(self.webview) self.vbox = gtk.VBox(False, 1) self.vbox.pack_start(self.scroller, True, True) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_size_request(1100, 600) self.window.connect('delete-event', lambda w, e: w.hide() or True) self.window.add(self.vbox) self.browser_settings = self.webview.get_settings() self.browser_settings.set_property("enable-java-applet", False) self.browser_settings.set_property("enable-plugins", False) self.browser_settings.set_property("enable-scripts", True) self.browser_settings.set_property("enable-private-browsing", True) self.browser_settings.set_property("enable-spell-checking", True) self.browser_settings.set_property("enable-developer-extras", True) self.webview.set_settings(self.browser_settings)
def display_splash(self): """show splash screen""" self.splash = gtk.Window() self.splash.set_decorated(False) self.splash.set_transient_for(self.winMain) self.splash.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.splash.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.splash.set_keep_above(True) self.splash.set_border_width(self.splash_border_width) vbox = gtk.VBox() img = gtk.Image() self.splash_gfx = os.path.join(CONFIG_DIR, 'layouts', self.layout, 'main-splash.png') if os.path.exists(self.splash_gfx): self.log_msg('Custom splash found, loading ' + str(self.splash_gfx)) img.set_from_file(self.splash_gfx) else: self.splash_gfx = os.path.join(APP_PATH, 'pixmaps', 'wahcade-logo.png') self.log_msg('No custom splash found, loading ' + str(self.splash_gfx)) img.set_from_file(self.splash_gfx) if self.splash_show_text == 1: lbl = gtk.Label() lbl.set_alignment(0.5, 0.5) lbl.set_justify(gtk.JUSTIFY_CENTER) lbl.set_use_markup(True) lbl.set_markup('<big><b>Wah!Cade</b></big>\n%s "%s"' % (VERSION, VERSION_NAME)) vbox.pack_end(lbl) vbox.pack_start(img) self.splash.add(vbox) self.splash.show_all() if not self.tw_api: self.twitter_api = self.auth_twitter() ## Auth Twitter during startup self.wait_with_events(0.25)
def __init__(self, title, parent=None): gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_modal(True) self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.set_title(title) if parent: self.set_transient_for(parent) self.set_resizable(False) vbox = gtk.VBox(False, 2) self.label = gtk.Label("") self.label.set_size_request(100, 50) self.label.show() self.pbar = gtk.ProgressBar() self.pbar.show() vbox.pack_start(self.label, 0, 0, 0) vbox.pack_start(self.pbar, 0, 0, 0) vbox.show() self.add(vbox)
def __init__(self, msg, parent=None): gtk.Window.__init__(self) self.set_title("Please Wait") self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) if parent: self.set_transient_for(parent) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) else: self.set_position(gtk.WIN_POS_CENTER) vbox = gtk.VBox(False, 2) l = gtk.Label(msg) l.show() vbox.pack_start(l) self.prog = gtk.ProgressBar() self.prog.show() vbox.pack_start(self.prog) vbox.show() self.add(vbox)
def __init__(self, radiosel, download, upload, iport, eport): gtk.Window.__init__(self) self.tips = gtk.Tooltips() self.fn_radiosel = radiosel self.fn_download = download self.fn_upload = upload self.fn_iport = iport self.fn_eport = eport self.set_title("CHIRP: CSV Dump") self.set_resizable(False) vbox = gtk.VBox(False, 2) vbox.pack_start(self.make_radio_sel(), 0, , ) vbox.pack_start(self.make_image_ctl(), 0, , ) vbox.pack_start(self.make_file_ctl(), 0, , ) vbox.pack_start(self.make_status_bar(), 0, , ) vbox.show() self.add(vbox)
def open_file(): window = main_window('toplevel', 'Flash Player', 550, 400) vbox = gtk.VBox() hbox = gtk.HBox() button = gtk.Button("????") button.set_size_request(200, 70) button.connect("clicked", on_open_clicked, window, vbox) vbox.pack_start(hbox, fill=False) hbox.pack_start(button, fill=False) window.add(vbox) window.show_all()
def __init__(self): super(ProgressBarDetails, self).__init__() #Configure the Window self.set_resizable(False) self.connect("destroy", self.destroy_progress) self.set_title("Progress Bar") self.set_position(gtk.WIN_POS_CENTER) self.set_size_request(460, 150) self.set_border_width(0) #Create the VBox in case we want to add additional items later self.vbox = gtk.VBox(False, 5) self.vbox.set_border_width(10) self.add(self.vbox) self.vbox.show() #create the scrolled window self.scrolled_window =gtk.ScrolledWindow() self.scrolled_window.set_usize(460, 100) self.vbox.add(self.scrolled_window) self.scrolled_window.show() self.text_view = gtk.TextView() self.msg_i = 0 self.text_buffer = self.text_view.get_buffer() self.scrolled_window.add_with_viewport(self.text_view) self.text_view.connect("size-allocate", self.autoscroll) self.text_view.show() # Create the ProgressBar self.pbar = gtk.ProgressBar() #self.pbar.set_usize(460, 40) self.pbar.set_fraction(0.0) self.vbox.add(self.pbar) self.pbar.show() #Display the Window self.show()
def __init__(self): super(ProgressBar, self).__init__() #Configure the Window self.set_resizable(False) self.connect("destroy", self.destroy_progress) self.set_title("Progress Bar") self.set_position(gtk.WIN_POS_CENTER) self.set_size_request(460, 50) self.set_border_width(0) #Create the VBox in case we want to add additional items later vbox = gtk.VBox(False, 5) vbox.set_border_width(10) self.add(vbox) vbox.show() # Create the ProgressBar self.pbar = gtk.ProgressBar() self.pbar.set_fraction(0.0) self.pbar.set_text("Starting") vbox.add(self.pbar) self.pbar.show() #Display the Window self.show()
def show_plugin_configs(self, plugin_name, frame): if self.vbox_plugin_main: frame.remove(self.vbox_plugin_main) self.vbox_plugin_main = gtk.VBox() self.current_plugin = next(plugin for plugin in self.plugins if plugin.name == plugin_name) self.current_plugin_config = self.current_plugin.config if not self.current_plugin.is_running(): self.current_plugin_config.refresh_data() self.plugin_config_widgets = [] self.plugin_config_traces = [] self.sensitivity_groups = [] self.sensitivity_groups_switch = [] self.vbox_plugin_main = self.create_config_vbox( self.current_plugin_config.get_configs_data(), self.current_plugin_config.get_schema_configs_data(), self.current_plugin_config.get_schema_configs_constraints(), "") for sensitivity_group, switch in zip(self.sensitivity_groups, self.sensitivity_groups_switch): self.enabled_checkbox_toggled(switch, sensitivity_group) if self.current_plugin.is_running(): self.vbox_plugin_main.set_sensitive(False) frame.add(self.vbox_plugin_main) self.show_all()
def create_config_vbox(self, inputs, types, constraints, trace_str): vbox_main = gtk.VBox() sensitivity_group = [] for (key, value), (_, value_type) in zip(inputs.items(), types.items()): delimiter = self.current_plugin_config.TRACE_DELIMITER if trace_str == "": delimiter = "" cur_trace_str = trace_str + delimiter + str(key) if isinstance(value_type, dict): frame = gtk.Frame(key.title() + ":") sensitivity_group.append(frame) vbox_main.pack_start(frame) vbox_frame = self.create_config_vbox(inputs[key], value_type, constraints, cur_trace_str) frame.add(vbox_frame) else: if cur_trace_str in constraints: constraint = constraints[cur_trace_str] item = self.value_type_create.get(value_type, self.create_error_hbox)( key, inputs[key], cur_trace_str, sensitivity_group, constraint) else: item = self.value_type_create.get(value_type, self.create_error_hbox)( key, inputs[key], cur_trace_str, sensitivity_group) vbox_main.pack_start(item) return vbox_main
def _setup_ui(self): self.top_layout = gtk.VBox(homogeneous=False, spacing=0) self.add(self.top_layout) self.pref_dialog = PlayerPreferences(self) self._setup_ui_chooser() self._setup_ui_player() self.chooser_layout.show() self.top_layout.show() self.current_engine.xid = self.video_container.window.xid # _setup_ui()
def _setup_ui_chooser(self): self.chooser_layout = gtk.VBox(homogeneous=False, spacing=2) self.top_layout.pack_start(self.chooser_layout, fill=True, expand=True) msg = ("<big><b>Choose your media source</b></big>\n" "Click one of the buttons below to be able to " "select what to play") info = catota.ui.MultiLineLabel(msg) info.show() self.chooser_layout.pack_start(info, fill=True, expand=False) box = gtk.VBox(homogeneous=True, spacing=5) box.show() for o in self.sources: btn = gtk.Button() btn.add(o.gui_button_contents) btn.set_size_request(-1, 40) btn.show() btn.connect("clicked", self._source_activated, o) box.pack_start(btn, fill=True, expand=False) sw = gtk.ScrolledWindow() sw.set_shadow_type(gtk.SHADOW_NONE) sw.set_policy(hscrollbar_policy=gtk.POLICY_NEVER, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.add_with_viewport(box) sw.show() self.chooser_layout.pack_start(sw, fill=True, expand=True) # _setup_ui_chooser()
def _main_window_default_style(self): wcfg = self.config['main_window'] vbox = gtk.VBox(False, 5) vbox.set_border_width(5) # TODO: Allow user to configure alignment of message, padding? lbl = gtk.Label() lbl.set_markup(wcfg.get('message', '')) lbl.set_alignment(0.5, 0.5) if wcfg.get('image'): self._set_background_image(vbox, wcfg.get('image')) button_box = gtk.HBox(False, 5) self._main_window_indicator(vbox, button_box) self._main_window_add_actions(button_box) vbox.pack_start(lbl, True, True) vbox.pack_end(button_box, False, True) self.main_window['window'].add(vbox) self.main_window.update({ 'vbox': vbox, 'label': lbl, 'buttons': button_box}) # TODO: Add other window styles?
def __init__(self, title, message, default_text='', modal=True, mask=False): gtk.Dialog.__init__(self) self.set_title(title) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) if modal: self.set_modal(True) box = gtk.VBox(spacing=10) box.set_border_width(10) self.vbox.pack_start(box) box.show() if message: label = gtk.Label(message) box.pack_start(label) label.show() self.entry = gtk.Entry() self.entry.set_text(default_text) self.entry.set_visibility(not mask) box.pack_start(self.entry) self.entry.show() self.entry.grab_focus() button = gtk.Button(stock=gtk.STOCK_OK) button.connect("clicked", self.click) self.entry.connect("activate", self.click) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() button.grab_default() button = gtk.Button(stock=gtk.STOCK_CANCEL) button.connect("clicked", self.quit) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() self.ret = None
def __init__(self, parser, max_tree_depth): self.parser = parser self._max_tree_depth = max_tree_depth self.search_thread = None self.search_lock = threading.Lock() self.name_entry = name_entry = gtk.Entry() name_entry.connect('activate', self.on_name_entry_activate) search_button = self.search_button = gtk.Button(stock=gtk.STOCK_FIND) search_button.connect('clicked', self.on_search) search_button.set_no_show_all(True) search_button.show() stop_button = self.stop_button = gtk.Button(stock=gtk.STOCK_STOP) stop_button.connect('clicked', self.stop_search) stop_button.set_no_show_all(True) self.progress = progress = gtk.ProgressBar() progress.set_size_request(-1, 8) name_box = gtk.HBox(spacing=8) name_box.set_border_width(8) name_box.pack_start(name_entry, True, True) name_box.pack_start(search_button, False) name_box.pack_start(stop_button, False) self.store = gtk.TreeStore(str, str, str, str) # name, icon, fnstyle, info self.treeview = treeview = self._create_treeview(self.store) scroller = gtk.ScrolledWindow() scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scroller.add(treeview) settings_view = SettingsView(max_depth_value=max_tree_depth) settings_view.on_max_depth_changed = self.on_max_depth_changed extension = gtk.expander_new_with_mnemonic('_Settings') extension.add(settings_view.view) vbox = gtk.VBox() vbox.pack_start(name_box, False) vbox.pack_start(progress, False) vbox.pack_start(scroller, True, True) vbox.pack_start(extension, False) self.window = window = gtk.Window() window.set_title(Application.title) window.set_default_size(800, 600) window.set_icon(Application.get_icon()) window.add(vbox)
def searchfunc(self,widget): fileName = self.searchfile.get_text() paths = "\n" for root, dirs, files in os.walk('/home', topdown=False): for name in files: if name == fileName: paths += " " + str(os.path.join(root, name)) + " \n\n" for name in dirs: if name == fileName: paths += " " + str(os.path.join(root, name)) + " \n\n" paths = paths[:-1] if len(paths) > 0 : self.popup = gtk.Window() self.popup.set_title( "Paths" ) vbox = gtk.VBox(False,0) hbox = gtk.HBox(False) label = gtk.Label(paths) label.set_line_wrap( True ) label.connect( "size-allocate",self.size_allocate) vbox.pack_start(gtk.Label(paths),True,False,0) closeButton = gtk.Button(" Close ") closeButton.set_sensitive(True) closeButton.connect("clicked",self.on_destroy) hbox.pack_start(closeButton,True,False,0) vbox.pack_start(hbox,True,False,10) self.popup.add(vbox) self.popup.set_type_hint( gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.popup.show_all()
def _setup(self): self.thumbnail = gtk.Image() self.label = gtk.Label(self.layer.name) # creating the fix button, to anchor background frames. self._fix_button = Utils.toggle_button_stock(gtk.STOCK_MEDIA_RECORD,20) self._fix_button.set_tooltip_text("toggle fixed visibility.") # update fixed variable self.fixed = Utils.is_frame_fixed(self.layer) #images pin_img = gtk.Image() pin_img.set_from_stock(gtk.STOCK_YES,20) pin_img2 = gtk.Image() pin_img2.set_from_stock(gtk.STOCK_MEDIA_RECORD,20) self._fix_button_images = [pin_img,pin_img2] ## connect self._fix_button.connect('clicked',self.on_toggle_fix) if self.fixed: self._fix_button.set_image(self._fix_button_images[0]) self._fix_button.set_active(True) else : self._fix_button.set_image(self._fix_button_images[1]) self._fix_button.set_active(False) frame = gtk.Frame() layout = gtk.VBox() # add frame to this widget self.add(frame) # add layout manager to the frame frame.add(layout) layout.pack_start(self.label) layout.pack_start(self._fix_button) layout.pack_start(self.thumbnail) self._get_thumb_image()
def __init__(self, rthread): super(DStarEditor, self).__init__(rthread) self.loaded = False self.editor_ucall = self.editor_rcall = None vbox = gtk.VBox(False, 2) vbox.pack_start(self.make_callsigns(), 0, 0, 0) tmp = gtk.Label("") tmp.show() vbox.pack_start(tmp, 1, 1, 1) self.root = vbox
def make_image_ctl(self): self.w_imgframe = gtk.Frame("Image") vbox = gtk.VBox(False, 2) vbox.set_border_width(2) self.w_imginfo = gtk.Label("No image") self.w_imginfo.show() vbox.pack_start(self.w_imginfo, 0, , ) hbox = gtk.HBox(True, 2) hbox.set_border_width(2) self.w_dli = StdButton("Download") self.w_dli.connect("clicked", lambda x: self.fn_download()) self.tips.set_tip(self.w_dli, "Download image from radio") self.w_dli.show() hbox.pack_start(self.w_dli, 0, , ) self.w_uli = StdButton("Upload") self.w_uli.set_sensitive(False) self.w_uli.connect("clicked", lambda x: self.fn_upload()) self.tips.set_tip(self.w_uli, "Upload image to radio") self.w_uli.show() hbox.pack_start(self.w_uli, 0, , ) hbox.show() vbox.pack_start(hbox, 0, , ) vbox.show() self.w_imgframe.add(vbox) self.w_imgframe.show() self.w_imgframe.set_sensitive(False) return self.w_imgframe
def __init__(self, width, height): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) self.window.set_border_width(0) self.window.set_size_request(width, height + 30) self.window.set_app_paintable(True) self.screen = self.window.get_screen() self.rgba = self.screen.get_rgba_colormap() self.window.set_colormap(self.rgba) self.window.connect('expose-event', self.expose) self.vbox = gtk.VBox(False, 5) self.hbox = gtk.HBox(False, 3) self.bbox = gtk.HBox(True, 3) self.entry = gtk.Entry() self.entry.set_max_length(0) self.entry.set_size_request(int(width / 2), 25) self.entry.connect("activate", self.enter_callback, self.entry) self.spr = gtk.ToggleButton(label='spr') self.spr.connect("toggled", self.on_button_toggled, 'spr') self.ctrl = gtk.ToggleButton(label='ctrl') self.ctrl.connect("toggled", self.on_button_toggled, 'ctrl') self.alt = gtk.ToggleButton(label='alt') self.alt.connect("toggled", self.on_button_toggled, 'alt') self.enter = gtk.Button(label='Enter') self.enter.connect("clicked", self.on_enter_clicked) self.backspace = gtk.Button(label='Backspace') self.backspace.connect("clicked", self.on_backspace_clicked) self.shell = gtk.Button(label='R-Shell') self.shell.connect("clicked", self.on_shell_clicked, self.entry) self.hbox.add(self.entry) self.bbox.add(self.spr) self.bbox.add(self.ctrl) self.bbox.add(self.alt) self.bbox.add(self.enter) self.bbox.add(self.backspace) self.bbox.add(self.shell) self.hbox.add(self.bbox) self.halign = gtk.Alignment(1, 0, 1, 0) self.halign.add(self.hbox) self.allalign = gtk.Alignment(0, 0, 1, 1) self.clickbox = gtk.EventBox() self.clickbox.connect('button-press-event', self.on_click) self.clickbox.set_visible_window(False) self.allalign.add(self.clickbox) self.vbox.pack_start(self.allalign, True, True, 0) self.vbox.pack_end(self.halign, False, False, 0) self.window.add(self.vbox) self.window.show_all() self.window.move(100, 100)
def __init__(self, explorer, rootGroup, canvas): """Place a new Visage of an explorer in a canvas group. I also need a 'canvas' reference is for certain coordinate conversions, and pygnome doesn't give access to my GtkObject's .canvas attribute. :( """ # Ugh. PyGtk/GtkObject/GnomeCanvas interfacing grits. gnome.CanvasGroup.__init__(self, _obj = rootGroup.add('group')._o) self.propertyLabels = PairList() reflect.accumulateClassList(self.__class__, 'propertyLabels', self.propertyLabels) self.groupLabels = PairList() reflect.accumulateClassList(self.__class__, 'groupLabels', self.groupLabels) self.explorer = explorer self.identifier = explorer.identifier self.objectId = explorer.id self.canvas = canvas self.rootGroup = rootGroup self.ebox = gtk.EventBox() self.ebox.set_name("Visage") self.frame = gtk.Frame(self.identifier) self.container = gtk.VBox() self.ebox.add(self.frame) self.frame.add(self.container) self.canvasWidget = self.add('widget', widget=self.ebox, x=0, y=0, anchor=gtk.ANCHOR_NW, size_pixels=0) self.border = self.add('rect', x1=0, y1=0, x2=1, y2=1, fill_color=None, outline_color=self.color['border'], width_pixels=self.border_width) self.subtable = {} self._setup_table() # TODO: # Collapse me # Movable/resizeable me # Destroy me # Set my detail level self.frame.connect("size_allocate", self.signal_size_allocate, None) self.connect("destroy", self.signal_destroy, None) self.connect("event", self.signal_event) self.ebox.show_all() # Our creator will call our fill_ methods when she has the goods.
def __init__(self, parent, plugins): super(PluginConfigGUI, self).__init__() self.main_gui = parent #TODO: Add one for compression format self.value_type_create = { "text": self.create_text_hbox, "number": self.create_number_hbox, "checkbox": self.create_checkbox_hbox, "radio": self.create_radio_hbox, "option": self.create_option_hbox, "options": self.create_options_hbox, "time": self.create_time_hbox, "netiface": self.create_netiface_hbox, "netifaces": self.create_netifaces_hbox, "filepath": self.create_filepath_hbox, "path": self.create_path_hbox } self.set_title("Plugin Configurations") self.set_modal(True) self.set_transient_for(self.main_gui) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) #self.set_size_request(500, 700) self.set_border_width(6) self.set_resizable(False) self.plugins = plugins plugin_names = [plugin.name for plugin in self.plugins] vbox_main = gtk.VBox() hbox_plugins = gtk.HBox() frame_plugin_confs = gtk.Frame("Plugin Configurations:") self.vbox_plugin_main = None label_plugins = gtk.Label("Plugin") combobox_plugins = gtk.combo_box_new_text() for label in plugin_names: combobox_plugins.append_text(label) combobox_plugins.set_active(0) combobox_plugins.connect('changed', self.select_plugin, combobox_plugins, frame_plugin_confs) button_close = gtk.Button("Close") button_close.connect("clicked", self.close_plugin_config_dialog) hbox_plugins.pack_start(label_plugins) hbox_plugins.pack_start(combobox_plugins) vbox_main.pack_start(hbox_plugins) vbox_main.pack_start(frame_plugin_confs) vbox_main.pack_start(button_close) self.show_plugin_configs(combobox_plugins.get_active_text(), frame_plugin_confs) self.add(vbox_main) self.show_all()
def __init__(self, *args, **kwargs): self.window = gtk.Window() self.window.set_title("Create An Image") self.window.set_icon_from_file(os.path.join(WORKINGDIR, "data", "icon.png")) colour = gtk.gdk.color_parse(DARKCOL) self.window.modify_bg(gtk.STATE_NORMAL, colour) self.vvbox = gtk.VBox() self.table = gtk.Table(5, 5) self.table.set_border_width(2) self.table.set_row_spacings(2) self.table.set_col_spacings(2) self.buttons = {} for y in range(5): for x in range(5): eb = gtk.EventBox() i = gtk.Image() i.set_from_file(os.path.join(WORKINGDIR, "data", "selected.png")) i.show() eb.add(i) eb.hide() eb.modify_bg(gtk.STATE_NORMAL, colour) eb.connect_object("button-press-event", self.togglePart, (x, y)) eb2 = gtk.EventBox() i2 = gtk.Image() i2.set_from_file(os.path.join(WORKINGDIR, "data", "unselected.png")) i2.show() eb2.add(i2) eb2.show() eb2.modify_bg(gtk.STATE_NORMAL, colour) eb2.connect_object("button-press-event", self.togglePart, (x, y)) self.buttons[(x, y)] = (eb, eb2) self.table.attach(eb, x, x + 1, y, y + 1) self.table.attach(eb2, x, x + 1, y, y + 1) self.table.show() self.vvbox.pack_start(self.table) hbox = gtk.HBox() self.confirmButton = gtk.Button("Okay") self.confirmButton.show() self.confirmButton.connect("clicked", self.okay) hbox.pack_start(self.confirmButton, True, False) cancelButton = gtk.Button("Cancel") cancelButton.connect("clicked", self.destroy) cancelButton.show() hbox.pack_end(cancelButton, True, False) hbox.show() self.vvbox.pack_start(hbox) self.vvbox.show() self.window.add(self.vvbox) self.onOkay = None self.running = True self.destoryed = False
def __init__(self): gtk.Window.__init__(self) self.graph = Graph() window = self window.set_title('Dot Viewer') window.set_default_size(512, 512) vbox = gtk.VBox() window.add(vbox) self.widget = DotWidget() # Create a UIManager instance uimanager = self.uimanager = gtk.UIManager() # Add the accelerator group to the toplevel window accelgroup = uimanager.get_accel_group() window.add_accel_group(accelgroup) # Create an ActionGroup actiongroup = gtk.ActionGroup('Actions') self.actiongroup = actiongroup # Create actions actiongroup.add_actions(( ('Open', gtk.STOCK_OPEN, None, None, None, self.on_open), ('Reload', gtk.STOCK_REFRESH, None, None, None, self.on_reload), ('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None, self.widget.on_zoom_in), ('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None, self.widget.on_zoom_out), ('ZoomFit', gtk.STOCK_ZOOM_FIT, None, None, None, self.widget.on_zoom_fit), ('Zoom100', gtk.STOCK_ZOOM_100, None, None, None, self.widget.on_zoom_100), )) # Add the actiongroup to the uimanager uimanager.insert_action_group(actiongroup, 0) # Add a UI descrption uimanager.add_ui_from_string(self.ui) # Create a Toolbar toolbar = uimanager.get_widget('/ToolBar') vbox.pack_start(toolbar, False) vbox.pack_start(self.widget) self.set_focus(self.widget) self.show_all()
def show_splash_screen(self, height=None, width=None, progress_bar=False, image=None, message=None, now=False): def show(self): window = gtk.Window(gtk.WINDOW_TOPLEVEL) vbox = gtk.VBox(False, 1) if message: lbl = gtk.Label() lbl.set_markup(message or '') lbl.set_alignment(0.5, 0.5) vbox.pack_start(lbl, True, True) else: lbl = None if image: self._set_background_image(vbox, image) if progress_bar: pbar = gtk.ProgressBar() pbar.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT) vbox.pack_end(pbar, False, True) else: pbar = None window.set_title(self.config.get('app_name', 'gui-o-matic')) window.set_decorated(False) window.set_position(gtk.WIN_POS_CENTER) window.set_size_request(width or 240, height or 320) window.add(vbox) window.show_all() self.hide_splash_screen(now=True) self.splash = { 'window': window, 'vbox': vbox, 'message': lbl, 'progress': pbar} if now: show(self) else: gobject.idle_add(show, self)
def _setup_widgets(self): h_space = 4 # horizontal space # create the frames to contein the diferent settings. f_time = gtk.Frame(label="Time") f_oskin = gtk.Frame(label="Onion Skin") self.set_size_request(300,-1) self.vbox.pack_start(f_time,True,True,h_space) self.vbox.pack_start(f_oskin,True,True,h_space) # create the time settings. th = gtk.HBox() fps,fps_spin = Utils.spin_button("Framerate",'int',self.last_config[FRAMERATE],1,100) #conf fps th.pack_start(fps,True,True,h_space) f_time.add(th) # create onion skin settings ov = gtk.VBox() f_oskin.add(ov) # fist line oh1 = gtk.HBox() depth,depth_spin = Utils.spin_button("Depth",'int',self.last_config[OSKIN_DEPTH],1,4,1) #conf depth on_play = gtk.CheckButton("On Play") on_play.set_active(self.last_config[OSKIN_ONPLAY]) oh1.pack_start(depth,True,True,h_space) oh1.pack_start(on_play,True,True,h_space) ov.pack_start(oh1) # second line oh2 = gtk.HBox() forward = gtk.CheckButton("Forward") forward.set_active(self.last_config[OSKIN_FORWARD]) backward = gtk.CheckButton("Backward") backward.set_active(self.last_config[OSKIN_BACKWARD]) oh2.pack_start(forward,True,True,h_space) oh2.pack_start(backward,True,True,h_space) ov.pack_start(oh2) # last line # connect a callback to all fps_spin.connect("value_changed",self.update_config,FRAMERATE) depth_spin.connect("value_changed",self.update_config,OSKIN_DEPTH) on_play.connect("toggled",self.update_config,OSKIN_ONPLAY) forward.connect("toggled",self.update_config,OSKIN_FORWARD) backward.connect("toggled",self.update_config,OSKIN_BACKWARD) # show all self.show_all()
def _setup_widgets(self): """ create all the window staticaly placed widgets. """ #load the saved setting before start. self.set_settings(Utils.load_conffile("conf.json")) # basic window definitions self.connect("destroy",self.destroy) self.connect("focus_in_event",self.on_window_focus) self.connect("configure_event",self.on_window_resize) self.set_default_size(self.win_size[0],self.win_size[1]) self.set_keep_above(True) #self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.move(self.win_pos[0],self.win_pos[1]) # parse gimp theme gtkrc gtkrc_path = self._get_theme_gtkrc(gimp.personal_rc_file('themerc')) if os.name != 'nt':# try apply the theme by parse a gtkrc file if is not a windows system. gtk.rc_parse(gtkrc_path) else: # if error occur them parse the file in another way. gtk.rc_add_default_file(gtkrc_path) gtk.rc_reparse_all() # start creating basic layout base = gtk.VBox() # commands bar widgets cbar = gtk.HBox() cbar.pack_start(self._setup_playbackbar(),False,False,10) cbar.pack_start(self._setup_editbar(),False,False,10) cbar.pack_start(self._setup_onionskin(),False,False,10) cbar.pack_start(self._setup_config(),False,False,10) cbar.pack_start(self._setup_generalbar(),False,False,10) # frames bar widgets self.frame_bar = gtk.HBox() scroll_window = gtk.ScrolledWindow() scroll_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) scroll_window.add_with_viewport(self.frame_bar) scroll_window.set_size_request(-1,140) # mount the widgets together base.pack_start(cbar,False,False,0) base.pack_start(scroll_window,True,True,0) self.add(base) # catch all layers self._scan_image_layers() self.active = 0 self.on_goto(None,GIMP_ACTIVE) # finalize showing all widgets self.show_all()
def do_columns(self): eset = self.get_current_editorset() driver = directory.get_driver(eset.rthread.radio.__class__) radio_name = "%s %s %s" % (eset.rthread.radio.VENDOR, eset.rthread.radio.MODEL, eset.rthread.radio.VARIANT) d = gtk.Dialog(title=_("Select Columns"), parent=self, buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) vbox = gtk.VBox() vbox.show() sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) sw.add_with_viewport(vbox) sw.show() d.vbox.pack_start(sw, 1, 1, 1) d.set_size_request(-1, 300) d.set_resizable(False) labelstr = _("Visible columns for {radio}").format(radio=radio_name) label = gtk.Label(labelstr) label.show() vbox.pack_start(label) fields = [] memedit = eset.get_current_editor() # .editors["memedit"] unsupported = memedit.get_unsupported_columns() for colspec in memedit.cols: if colspec[0].startswith("_"): continue elif colspec[0] in unsupported: continue label = colspec[0] visible = memedit.get_column_visible(memedit.col(label)) widget = gtk.CheckButton(label) widget.set_active(visible) fields.append(widget) vbox.pack_start(widget, 1, 1, 1) widget.show() res = d.run() selected_columns = [] if res == gtk.RESPONSE_OK: for widget in fields: colnum = memedit.col(widget.get_label()) memedit.set_column_visible(colnum, widget.get_active()) if widget.get_active(): selected_columns.append(widget.get_label()) d.destroy() CONF.set(driver, ",".join(selected_columns), "memedit_columns")
def __init__(self, rthread): super(MemoryEditor, self).__init__(rthread) self.defaults = dict(self.defaults) self._config = config.get("memedit") self.bandplans = bandplans.BandPlans(config.get()) self.allowed_bands = [144, 440] self.count = 100 self.show_special = self._config.get_bool("show_special") self.show_empty = not self._config.get_bool("hide_empty") self.hide_unused = self._config.get_bool("hide_unused", default=True) self.read_only = False self.need_refresh = False self._in_editing = False self.lo_limit_adj = self.hi_limit_adj = None self.store = self.view = None self.__cache_columns() self._features = self.rthread.radio.get_features() (min, max) = self._features.memory_bounds self.choices[_("Mode")] = self._features["valid_modes"] self.choices[_("Tone Mode")] = self._features["valid_tmodes"] self.choices[_("Cross Mode")] = self._features["valid_cross_modes"] self.choices[_("Skip")] = self._features["valid_skips"] self.choices[_("Power")] = [str(x) for x in self._features["valid_power_levels"]] self.choices[_("DTCS Pol")] = self._features["valid_dtcs_pols"] self.choices[_("DTCS Code")] = self._features["valid_dtcs_codes"] self.choices[_("DTCS Rx Code")] = self._features["valid_dtcs_codes"] if self._features["valid_power_levels"]: self.defaults[_("Power")] = self._features["valid_power_levels"][0] self.choices[_("Duplex")] = list(self._features.valid_duplexes) if self.defaults[_("Mode")] not in self._features.valid_modes: self.defaults[_("Mode")] = self._features.valid_modes[0] vbox = gtk.VBox(False, 2) vbox.pack_start(self.make_controls(min, max), 0, 0, 0) vbox.pack_start(self.make_editor(), 1, 1, 1) vbox.show() self.prefill() self.root = vbox # Run low priority jobs to get the rest of the memories hi = int(self.hi_limit_adj.get_value()) for i in range(hi, max+1): job = common.RadioJob(None, "get_memory", i) job.set_desc(_("Getting memory {number}").format(number=i)) self.rthread.submit(job, 10)
def make_file_ctl(self): self.w_fileframe = gtk.Frame("File") vbox = gtk.VBox(False, 2) vbox.set_border_width(2) hbox = gtk.HBox(False, 2) hbox.set_border_width(2) l = gtk.Label("File") l.show() hbox.pack_start(l, 0, , ) self.w_filename = gtk.Entry() self.w_filename.connect("changed", self.file_changed) self.tips.set_tip(self.w_filename, "Path to CSV file") self.w_filename.show() hbox.pack_start(self.w_filename, 1, , ) bb = StdButton("Browse") bb.connect("clicked", self.pick_file) bb.show() hbox.pack_start(bb, 0, , ) hbox.show() vbox.pack_start(hbox, 0, , ) hbox = gtk.HBox(True, 2) hbox.set_border_width(2) def export_handler(x): return self.fn_eport(self.w_filename.get_text()) self.w_export = StdButton("Export") self.w_export.set_sensitive(False) self.w_export.connect("clicked", export_handler) self.tips.set_tip(self.w_export, "Export radio memories to CSV file") self.w_export.show() hbox.pack_start(self.w_export, 0, , ) def import_handler(x): return self.fn_iport(self.w_filename.get_text()) self.w_import = StdButton("Import") self.w_import.set_sensitive(False) self.w_import.connect("clicked", import_handler) self.tips.set_tip(self.w_import, "Import radio memories from CSV file") self.w_import.show() hbox.pack_start(self.w_import, 0, , ) hbox.show() vbox.pack_start(hbox, 0, , ) vbox.show() self.w_fileframe.add(vbox) self.w_fileframe.show() return self.w_fileframe