def finish_initializing(self, builder): """Called while initializing this instance in __new__ finish_initializing should be called after parsing the UI definition and creating a SimplePlayerWindow object with it in order to finish initializing the start of the new SimplePlayerWindow instance. """ # Get a reference to the builder and set up the signals. self.builder = builder self.ui = BuilderGlue.BuilderGlue(builder, self) self.preferences_dialog = None # Optional Launchpad integration # This shouldn't crash if not found as it is simply used for bug reporting. # See https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding # for more information about Launchpad integration. try: import LaunchpadIntegration LaunchpadIntegration.add_items(self.ui.helpMenu, 1, False, True) LaunchpadIntegration.set_sourcepackagename('simple-player') except: pass # Optional application indicator support # Run 'quickly add indicator' to get started. # More information: # http://owaislone.org/quickly-add-indicator/ # https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators try: from simple_player import indicator # self is passed so methods of this class can be called from indicator.py # Comment this next line out to disable appindicator self.indicator = indicator.new_application_indicator(self) except: pass
def finish_initializing(self, builder, cmdopts): """finish_initalizing should be called after parsing the ui definition and creating a PithosWindow object with it in order to finish initializing the start of the new PithosWindow instance. """ self.cmdopts = cmdopts #get a reference to the builder and set up the signals self.builder = builder self.builder.connect_signals(self) global launchpad_available if False and launchpad_available: # Disable this # see https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding for more information # about LaunchpadIntegration helpmenu = self.builder.get_object('menu_options') if helpmenu: LaunchpadIntegration.set_sourcepackagename('pithos') LaunchpadIntegration.add_items(helpmenu, 0, False, True) else: launchpad_available = False self.prefs_dlg = PreferencesPithosDialog.NewPreferencesPithosDialog() self.preferences = self.prefs_dlg.get_preferences() if self.prefs_dlg.fix_perms(): # Changes were made, save new config variable self.prefs_dlg.save() self.init_core() self.init_ui() self.plugins = {} load_plugins(self) self.dbus_service = PithosDBusProxy(self) self.sound_menu = PithosSoundMenu(self) if not self.preferences['username']: self.show_preferences(is_startup=True) self.pandora = make_pandora(self.cmdopts.test) self.set_proxy() self.set_audio_quality() self.pandora_connect()
def __init__(self, on_destroy=NO_OP): """Init.""" super(MagicicadaUI, self).__init__() self.sd = syncdaemon.SyncDaemon() if LAUNCHPAD_AVAILABLE: # for more information about LaunchpadIntegration: # wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding helpmenu = self.builder.get_object('helpMenu') if helpmenu: LaunchpadIntegration.set_sourcepackagename('magicicada') LaunchpadIntegration.add_items(helpmenu, 0, False, True) self._on_destroy = on_destroy active_filename = get_data_file('media', 'active-016.png') self.active_indicator = GdkPixbuf.Pixbuf.new_from_file(active_filename) self.status = Status(syncdaemon_instance=self.sd, xscale=1, yscale=1) self.main_box.pack_start(self.status, expand=False, fill=True, padding=6) self._icons = {} for size in (16, 32, 48, 64, 128): icon_filename = get_data_file('media', 'logo-%.3i.png' % size) self._icons[size] = GdkPixbuf.Pixbuf.new_from_file(icon_filename) self.main_window.set_default_icon_list(self._icons.values()) self.main_window.set_icon_list(self._icons.values()) self.indicator = Indicator(self) about_fname = get_data_file('media', 'logo-128.png') self.about_dialog.set_logo(GdkPixbuf.Pixbuf.new_from_file(about_fname)) self.operations = Operations(syncdaemon_instance=self.sd) self.main_box.pack_start(self.operations, expand=True, fill=True, padding=0) self.sd.status_changed_callback = self.on_status_changed self.sd.on_initial_data_ready_callback = self.on_initial_data_ready self.sd.on_initial_online_data_ready_callback = \ self.on_initial_online_data_ready
def finish_initializing(self, builder): """Called while initializing this instance in __new__ finish_initializing should be called after parsing the UI definition and creating a StopwatchWindow object with it in order to finish initializing the start of the new StopwatchWindow instance. """ # Get a reference to the builder and set up the signals. self.builder = builder self.ui = builder.get_ui(self, True) self.PreferencesDialog = None # class self.preferences_dialog = None # instance self.AboutDialog = None # class preferences.connect("changed", self.on_preferences_changed) # Optional Launchpad integration # This shouldn't crash if not found as it is simply used for bug reporting. # See https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding # for more information about Launchpad integration. try: import LaunchpadIntegration LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) LaunchpadIntegration.set_sourcepackagename("stopwatch") except ImportError: pass # Optional application indicator support # Run 'quickly add indicator' to get started. # More information: # http://owaislone.org/quickly-add-indicator/ # https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators try: from stopwatch import indicator # self is passed so methods of this class can be called from indicator.py # Comment this next line out to disable appindicator self.indicator = indicator.new_application_indicator(self) except ImportError: pass
def __init__(self): self.parse_options() #build GUI self.gladefile = "data/gtkvncviewer.glade" self.wTree = gtk.glade.XML(self.gladefile) self.dialog = self.wTree.get_widget("connectDialog") self.about = self.wTree.get_widget("aboutDialog") self.about.set_version(version) self.window = self.wTree.get_widget("window") self.window_label = self.wTree.get_widget("window_label") self.window_toolbar_note = self.wTree.get_widget("toolbar_note") self.window_toolbar = self.wTree.get_widget("toolbar") self.layout = self.wTree.get_widget("viewport1") self.scrolledwindow = self.wTree.get_widget("scrolledwindow1") self.fullscreenButton = self.wTree.get_widget("fullscreenButton") self.fullscreenButton.set_active(False) self.iconview = self.wTree.get_widget("iconview1") self.keysButton = self.wTree.get_widget("keysButton") self.keysMenu = self.wTree.get_widget("keysMenu") self.keysMenu.attach_to_widget(self.keysButton, None) self.vnc=gtkvnc.Display() self.model = gtk.ListStore (str,str,str,gtk.gdk.Pixbuf) self.iconview.set_model(self.model) self.iconview.set_text_column(0) self.iconview.set_pixbuf_column(3) self.helpMenu = self.wTree.get_widget("helpMenu") self.helpButton = self.wTree.get_widget("helpButton") self.helpMenu.attach_to_widget(self.helpButton, None) if (launchpad): LaunchpadIntegration.set_sourcepackagename("gtkvncviewer") LaunchpadIntegration.add_items(self.helpMenu,0,False,False) else: self.helpButton.set_sensitive(False) if (self.dialog): self.window.connect("destroy", gtk.main_quit) #Create our dictionay and connect it dic = { "on_quitButton_clicked" : gtk.main_quit, "on_aboutButton_clicked" : self.show_about_dialog, "on_aboutDialog_response" : self.handle_about_dialog_answer, "on_aboutDialog_delete_event" : self.hide_about_dialog, "on_connectButton_clicked" : self.vncconnect, "on_window_delete_event" : self.close_window, "on_disconnectButton_clicked" : self.disconnect, "on_addButton_clicked" : self.add_server, "on_iconview1_selection_changed" : self.selected, "on_iconview1_item_activated" : self.activated, "on_delButton_clicked" : self.delete_clicked, "on_screenshotButton_clicked" : self.screenshot, "on_helpButton_clicked" : self.helpMenuPop, "on_togglebutton1_toggled" : self.fullscreen, "on_toolbar_note_entered" : self.show_hide_toolbar, "on_window_motion_notify_event" : self.mouse_moved_in_window, "on_desktopIconButton_clicked" : self.icon_on_desktop, "on_CtrlAltDelmenuitem_activate": self.send_cad, "on_CtrlAltBackmenuitem_activate": self.send_cab, "on_CtrlEscmenuitem_activate": self.send_ce, "on_CtrlAltF1menuitem_activate": self.send_caf1, "on_CtrlAltF2menuitem_activate": self.send_caf2, "on_CtrlAltF3menuitem_activate": self.send_caf3, "on_CtrlAltF4menuitem_activate": self.send_caf4, "on_CtrlAltF5menuitem_activate": self.send_caf5, "on_CtrlAltF6menuitem_activate": self.send_caf6, "on_CtrlAltF7menuitem_activate": self.send_caf7, "on_CtrlAltF8menuitem_activate": self.send_caf8, "on_CtrlAltF9menuitem_activate": self.send_caf9, "on_CtrlAltF10menuitem_activate": self.send_caf10, "on_CtrlAltF11menuitem_activate": self.send_caf11, "on_CtrlAltF12menuitem_activate": self.send_caf12, "on_AltRlessitem_activate": self.send_arless, "on_AltRqitem_activate": self.send_arq, "on_AltRszligitem_activate": self.send_arszlig, "on_AltRplusitem_activate": self.send_arplus, "on_AltR7item_activate": self.send_ar7, "on_AltR8item_activate": self.send_ar8, "on_AltR9item_activate": self.send_ar9, "on_AltR0item_activate": self.send_ar0, "on_keysButton_clicked" : self.keysMenuPop} self.wTree.signal_autoconnect(dic) self.dialog.show() #read stored credentials GCONF_AUTH_KEY = "/apps/gtkvncviewer" keyring = gnomekeyring.get_default_keyring_sync() gconfclient = gconf.client_get_default() gconfclient.add_dir (GCONF_AUTH_KEY, gconf.CLIENT_PRELOAD_RECURSIVE) entries = gconfclient.all_entries(GCONF_AUTH_KEY) if len(entries) == 0: return #found nothing for i in range(len(entries)): server = entries[i].get_key() server = server.replace (GCONF_AUTH_KEY+"/", "") auth_token = entries[i].get_value().get_int() if auth_token > 0: try: secret = gnomekeyring.item_get_info_sync(keyring, auth_token).get_secret() except gnomekeyring.DeniedError: username = None password = None auth_token = 0 print _("gnome-keyring access denied") else: username, password = secret.split('\n') else: username = None password = None pixbuf = self.iconview.render_icon(gtk.STOCK_NETWORK, gtk.ICON_SIZE_BUTTON) self.model.append([server, username, password, pixbuf]) #if a server was specified at startup, connect to it if self.startup_options.server: res = self.find_server(self.startup_options.server) if (res): #found, connect iter = res[3] self.iconview.select_path(iter) wait() self.vncconnect(self.window) else: #not found, just fill the server name in the dialog server_textbox = self.wTree.get_widget("serverEntry") user_textbox = self.wTree.get_widget("usernameEntry") server_textbox.set_text(self.startup_options.server) user_textbox.grab_focus()
def __init__(self, feedback): """Constructor for a GTK+ glChess GUI""" self.feedback = feedback self._watches = {} self.__networkGames = {} self.newGameDialog = None self.loadGameDialog = None self.__aboutDialog = None self.__saveGameDialogs = {} self.__joinGameDialogs = [] # The time stored for animation self.__lastTime = None self.__animationTimer = None self.__renderGL = False self.openGLInfoPrinted = False self.__attentionCounter = 0 self.whiteTimeString = '∞' self.blackTimeString = '∞' # Theo window width and height when unmaximised and not fullscreen self.width = None self.height = None self.isFullscreen = False self.isMaximised = False self.view = None # Set the message panel to the tooltip style # (copied from Gedit) # In Gtk+ 2.11+ (I think) tip_window is now private so skip if it's not there (bug #459740) w = gtk.Window(gtk.WINDOW_POPUP) w.set_name('gtk-tooltip') w.ensure_style() self._tooltipStyle = w.get_style() self._tooltipWidgetsDrawn = {} self._gui = loadUIFile('glchess.ui') self._gui.connect_signals(self) self.mainWindow = self._gui.get_object('glchess_app') # Create the model for the player types self.__playerModel = gtk.ListStore(str, str, str) iter = self.__playerModel.append() # Translators: Player Type Combo: Player is human controlled self.__playerModel.set(iter, 0, '', 1, 'stock_person', 2, _('Human')) self.__logWindow = log.LogWindow(self._gui.get_object('log_notebook')) # Make preferences dialog self.preferences = dialogs.GtkPreferencesDialog(self) # Balance space on each side of the history combo group = gtk.SizeGroup(gtk.SIZE_GROUP_BOTH) group.add_widget(self.__getWidget('left_nav_box')) group.add_widget(self.__getWidget('right_nav_box')) # History combo displays text data combo = self.__getWidget('history_combo') cell = gtk.CellRendererText() combo.pack_start(cell, False) combo.add_attribute(cell, 'text', 2) # Add launchpad integration widget = self._gui.get_object('help2_menu') LaunchpadIntegration.set_sourcepackagename('glchess') LaunchpadIntegration.add_items(widget,1,True,False) self._updateViewButtons() # Watch for config changes for key in ['show_toolbar', 'show_history', 'fullscreen', 'show_3d', 'show_3d_smooth', 'show_comments', 'show_numbering', 'show_move_hints', 'width', 'height', 'move_format', 'promotion_type', 'board_view', 'enable_networking']: glchess.config.watch(key, self.__applyConfig)
def __init__(self, feedback): """Constructor for a GTK+ glChess GUI""" self.feedback = feedback self._watches = {} self.__networkGames = {} self.newGameDialog = None self.loadGameDialog = None self.__aboutDialog = None self.__saveGameDialogs = {} self.__joinGameDialogs = [] # The time stored for animation self.__lastTime = None self.__animationTimer = None self.__renderGL = False self.openGLInfoPrinted = False self.__attentionCounter = 0 self.whiteTimeString = '∞' self.blackTimeString = '∞' # Theo window width and height when unmaximised and not fullscreen self.width = None self.height = None self.isFullscreen = False self.isMaximised = False self.view = None # Set the message panel to the tooltip style # (copied from Gedit) # In Gtk+ 2.11+ (I think) tip_window is now private so skip if it's not there (bug #459740) w = gtk.Window(gtk.WINDOW_POPUP) w.set_name('gtk-tooltip') w.ensure_style() self._tooltipStyle = w.get_style() self._tooltipWidgetsDrawn = {} self._gui = loadUIFile('glchess.ui') self._gui.connect_signals(self) self.mainWindow = self._gui.get_object('glchess_app') # Create the model for the player types self.__playerModel = gtk.ListStore(str, str, str) iter = self.__playerModel.append() # Translators: Player Type Combo: Player is human controlled self.__playerModel.set(iter, 0, '', 1, 'stock_person', 2, _('Human')) self.__logWindow = log.LogWindow(self._gui.get_object('log_notebook')) # Make preferences dialog self.preferences = dialogs.GtkPreferencesDialog(self) # Balance space on each side of the history combo group = gtk.SizeGroup(gtk.SIZE_GROUP_BOTH) group.add_widget(self.__getWidget('left_nav_box')) group.add_widget(self.__getWidget('right_nav_box')) # History combo displays text data combo = self.__getWidget('history_combo') cell = gtk.CellRendererText() combo.pack_start(cell, False) combo.add_attribute(cell, 'text', 2) # Add launchpad integration widget = self._gui.get_object('help2_menu') LaunchpadIntegration.set_sourcepackagename('glchess') LaunchpadIntegration.add_items(widget, 1, True, False) self._updateViewButtons() # Watch for config changes for key in [ 'show_toolbar', 'show_history', 'fullscreen', 'show_3d', 'show_3d_smooth', 'show_comments', 'show_numbering', 'show_move_hints', 'width', 'height', 'move_format', 'promotion_type', 'board_view', 'enable_networking' ]: glchess.config.watch(key, self.__applyConfig)
def finish_initializing(self, builder): """Called while initializing this instance in __new__ finish_initalizing should be called after parsing the UI definition and creating a SimplePlayer1Window object with it in order to finish initializing the start of the new SimplePlayer1Window instance. Put your initilization code in here and leave __init__ undefined. """ # Get a reference to the builder and set up the signals. self.builder = builder self.builder.connect_signals(self) self.supported_album_art_formats = [".png"] self.supported_video_formats = [".avi",".ogv",] self.supported_audio_formats = [".mp3",".ogg",] #open button open_button = gtk.ToolButton() open_button.set_stock_id(gtk.STOCK_OPEN) open_button.show() open_button.connect("clicked", self.openbutton) #player controls self.player = MediaPlayerBox(True) self.player.remove(self.player.controls) #insert open button self.player.controls.insert(open_button, 0) hbox = self.builder.get_object('hbox1') hbox.pack_start(self.player.controls, True) self.player.connect("end-of-file", self.play_next_file) self.player.show() hpaned = self.builder.get_object('hpaned1') hpaned.add2(self.player) #create album art canvas self.goocanvas = goocanvas.Canvas() self.goocanvas.show() #icon app_icon = get_media_file("icon1.png") self.set_icon_from_file(app_icon) #create volume button #self.volumebutton = VolumeButton() #self.volumebutton.set_value(0.5) #self.volumebutton.show() #hbox.pack_start(self.volumebutton, fill=False) #hbox.pack_end(open_button, 1) #get and set background image for canvas #logo_file = get_media_file("background.png") #logo_file = get_media_file(self.image_url) #logo_pb = gtk.gdk.pixbuf_new_from_file(logo_file) #self.image = goocanvas.Image(parent=root_item, pixbuf=logo_pb, x=20, y=40) self.image = goocanvas.Image() logo_file1 = get_media_file("black.png") logo_pb1 = gtk.gdk.pixbuf_new_from_file(logo_file1) root_item = self.goocanvas.get_root_item() self.image = goocanvas.Image(parent=root_item, pixbuf=logo_pb1, x=0, y=0) #set up to paint text on the canvas on play_next_song self.song_text = goocanvas.Text(parent=root_item,text="", x=5, y=5, fill_color="white") self.song_text.set_property("font","Ubuntu") self.song_text.scale(1,1) #sound menu self.sound_menu = SoundMenuControls('simple-player1') self.sound_menu._sound_menu_next = self._sound_menu_next self.sound_menu._sound_menu_previous = self._sound_menu_previous self.sound_menu._sound_menu_is_playing = self._sound_menu_is_playing self.sound_menu._sound_menu_play = self._sound_menu_play self.sound_menu._sound_menu_pause = self._sound_menu_pause self.sound_menu._sound_menu_raise = self._sound_menu_raise self.player.play_button.connect("toggled",self.play_button_toggled) global launchpad_available if launchpad_available: # see https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding for more information # about LaunchpadIntegration helpmenu = self.builder.get_object('helpMenu') if helpmenu: LaunchpadIntegration.set_sourcepackagename('simple-player1') LaunchpadIntegration.add_items(helpmenu, 0, False, True) else: launchpad_available = False #AppIndicator support #see http://owaislone.org/quickly-add-indicator/ # use 'quickly add indicator' to get started # self is passed so methods of this class can be called from indicator.py # Comment to disable appindicator if indicator: self.indicator = indicator.new_application_indicator(self)