def __init__(self): gtk.Window.__init__(self) self.has_cursor = None self.set_position(gtk.WIN_POS_CENTER_ALWAYS) gtk.window_set_default_icon_from_file(ICON + "logo.png") self.set_title(_("Device Manager")) #window.set_resizable(False) self.set_decorated(False) self.set_size_request(DEFAULT_WIDTH, DEFAULT_HEIGHT) self.set_app_paintable(True) # receive all event masks self.set_events(gtk.gdk.ALL_EVENTS_MASK) self.connect("destroy", self.destroy) self.connect("expose_event", self.expose) self.connect("size-allocate", self.size_allocate_event) self.connect("motion-notify-event", self.motion_notify) self.connect("button-press-event", self.resize_window) # supports alpha channels screen = self.get_screen() colormap = screen.get_rgba_colormap() if colormap: gtk.widget_set_default_colormap(colormap) self.set_geometry_hints(None, 600, 400)
def __init__(self): # create gtk builder self.populating = True self.builder = gtk.Builder() # load interface if os.path.isfile(os.path.join("ui", "settings.glade")): self.builder.add_from_file(os.path.join("ui", "settings.glade")) elif os.path.isfile(os.path.join("..", "ui", "settings.glade")): self.builder.add_from_file(os.path.join("..", "ui", "settings.glade")) elif os.path.isfile("/usr/share/kabikaboo/ui/settings.glade"): self.builder.add_from_file("/usr/share/kabikaboo/ui/settings.glade") # find main window self.window = self.builder.get_object("window_settings") # pointers, must be set self.file = None self.kabikaboo = None self.document = None # application icon if os.path.isfile("kabikaboo.png"): gtk.window_set_default_icon_from_file("kabikaboo.png") elif os.path.isfile(os.path.join("..", "kabikaboo.png")): gtk.window_set_default_icon_from_file(os.path.join("..", "kabikaboo.png")) elif os.path.isfile("/usr/src/kabikaboo/kabikaboo.png"): gtk.window.set_default_icon_from_file("/usr/src/kabikaboo/kabikaboo.png") # connect gui callbacks self.connect_gui() self.populating = False
def __init__(self): gtk.Window.__init__(self) self.has_cursor = None self.set_position(gtk.WIN_POS_CENTER_ALWAYS) gtk.window_set_default_icon_from_file(ICON + "logo.png") self.set_title(_("Device Manager")) #window.set_resizable(False) self.set_decorated(False) self.set_size_request(DEFAULT_WIDTH, DEFAULT_HEIGHT) self.set_app_paintable(True) # receive all event masks self.set_events(gtk.gdk.ALL_EVENTS_MASK) self.connect("destroy", self.destroy) self.connect("expose_event", self.expose) self.connect("size-allocate", self.size_allocate_event) self.connect("motion-notify-event", self.motion_notify) self.connect("button-press-event", self.resize_window) # supports alpha channels screen = self.get_screen() colormap = screen.get_rgba_colormap() if colormap: gtk.widget_set_default_colormap(colormap) self.set_geometry_hints(None, 600, 400)
def init(): """Shared SCBdo program initialisation.""" print("\n\ SCBdo(" + VERSION + ") Copyright (C) 2010,2011 Nathan Fraser\n\ This program comes with ABSOLUTELY NO WARRANTY.\n\ This is free software, and you are welcome to redistribute it\n\ under certain conditions.\n\n") # prepare for type 1 threads gobject.threads_init() # fix the menubar accel mapping mset = gtk.settings_get_default() mset.set_string_property('gtk-menu-bar-accel', 'F24', 'override') # set the global default window icon try: gtk.window_set_default_icon_from_file(SCB_LOGOFILE) except: SCB_LOGOFILE = os.path.join(UI_PATH, 'scbdo_icon.png') gtk.window_set_default_icon_from_file(SCB_LOGOFILE) # Set global logging options logging._srcfile = None logging.logThreads = 0 logging.logProcesses = 0 # Check for data path and change working directory mk_data_path() os.chdir(DATA_PATH)
def init(): """Shared SCBdo program initialisation.""" print ("\n\ SCBdo(" + VERSION + ") Copyright (C) 2010,2011 Nathan Fraser\n\ This program comes with ABSOLUTELY NO WARRANTY.\n\ This is free software, and you are welcome to redistribute it\n\ under certain conditions.\n\n") # prepare for type 1 threads gobject.threads_init() # fix the menubar accel mapping mset = gtk.settings_get_default() mset.set_string_property('gtk-menu-bar-accel', 'F24', 'override') # set the global default window icon try: gtk.window_set_default_icon_from_file(SCB_LOGOFILE) except: SCB_LOGOFILE = os.path.join(UI_PATH, 'scbdo_icon.png') gtk.window_set_default_icon_from_file(SCB_LOGOFILE) # Set global logging options logging._srcfile = None logging.logThreads = 0 logging.logProcesses = 0 # Check for data path and change working directory mk_data_path() os.chdir(DATA_PATH)
def __init__(self): # create gtk builder self.builder = gtk.Builder() # load interface if os.path.isfile(os.path.join("ui", "statistics.glade")): self.builder.add_from_file(os.path.join("ui", "statistics.glade")) elif os.path.isfile(os.path.join("..", "ui", "statistics.glade")): self.builder.add_from_file(os.path.join("..", "ui", "statistics.glade")) elif os.path.isfile("/usr/share/kabikaboo/ui/statistics.glade"): self.builder.add_from_file("/usr/share/kabikaboo/ui/statistics.glade") # find main window self.window = self.builder.get_object("window_statistics") # pointers, must be set self.file = None self.kabikaboo = None self.document = None # application icon if os.path.isfile("kabikaboo.png"): gtk.window_set_default_icon_from_file("kabikaboo.png") elif os.path.isfile(os.path.join("..", "kabikaboo.png")): gtk.window_set_default_icon_from_file(os.path.join("..", "kabikaboo.png")) elif os.path.isfile("/usr/src/kabikaboo/kabikaboo.png"): gtk.window.set_default_icon_from_file("/usr/src/kabikaboo/kabikaboo.png") # data self.start_word_count = 0 self.session_word_count = 0 self.words_per_minute = 0 self.start_time = time.time() self.session_time = time.time() # connect gui callbacks self.connect_gui()
def __init__(self, session): self.mxit = session #Set default window icon gtk.window_set_default_icon_from_file(os.path.join('gui', 'images', 'desktop.ico')) SplashScreen() self.initGui()
def runFullGUI(): glade_xml = initGlade() gtk.window_set_default_icon_from_file(INSTALLDIR + '/pixmaps/lv_icon.png') app = glade_xml.get_widget('window1') app.set_icon_from_file(INSTALLDIR + '/pixmaps/lv_icon.png') blvm = baselvm(glade_xml, app) app.show() app.connect("destroy", lambda w: gtk.main_quit()) gtk.main()
def __init__(self, title): ChildTopWindow.__init__(self, title) """ get foobnix icon path""" try: self.set_icon_from_file(self.get_fobnix_logo()) gtk.window_set_default_icon_from_file(self.get_fobnix_logo()) except TypeError: pass
def __init__(self): try: from phonetooth import constants datadir = constants.datadir except: #fallback when running from repository datadir = 'ui' self.__waitingForQuit = False self.__widgetTree = gtk.glade.XML(os.path.join(datadir, 'phonetooth.glade')) self.__mainWindow = self.__widgetTree.get_widget('mainWindow') self.__sendButton = self.__widgetTree.get_widget('sendButton') self.__aboutDialog = self.__widgetTree.get_widget('aboutDialog') self.__statusBar = self.__widgetTree.get_widget('statusBar') self.__sendFileMenuItem = self.__widgetTree.get_widget('sendFileMenuitem') self.__sendMessageMenuitem = self.__widgetTree.get_widget('sendMessageMenuitem') self.__storeMessageCheck = self.__widgetTree.get_widget('storeMessageCheck') self.__notebook = self.__widgetTree.get_widget('mainNotebook') self.__aboutDialog.set_name('PhoneTooth') self.__sendButton.set_sensitive(False) self.__prefs = preferences.Preferences() self.__prefs.load() self.__preferencesDialog = preferencesdialog.PreferencesDialog(self.__widgetTree, self.__prefs, parent = self.__mainWindow) self.__contactsDialog = contactsdialog.ContactsDialog(self.__widgetTree, self.__prefs, parent = self.__mainWindow) self.__messageInput = messageinput.MessageInput(self.__widgetTree) self.__messageInput.setDataModel(self.__contactsDialog.contactlistStore) self.__messageInput.connect('sendpossible', self.__sendPossibleCb) self.__phoneBrowser = phonebrowserhandler.PhoneBrowserHandler(self.__widgetTree, parent = self.__mainWindow) self.__phoneBrowser.connect('disconnected', self.__phoneDisconnectedCb) self.__contactSelectionDialog = selectcontactsdialog.SelectContactsDialog(self.__widgetTree, self.__mainWindow) self.__sendMessageDialog = sendmessagedialog.SendMessageDialog(self.__widgetTree, self.__mainWindow) self.__checkSendFileButtonSensitivity() dic = {'onMainWindowDestroy' : self.__quit, 'onSendFile' : self.__sendFile, 'onManageContactsActivated' : self.__contactsDialog.run, 'onPreferencesActivated' : self.__preferencesDialog.run, 'onSendButtonClicked' : self.__sendSMS, 'onAboutButtonClicked' : self.__showAboutDialog, 'onPreferencesChanged' : self.__preferencesChanged, 'onSendToMultiple' : self.__sendToMultiple, 'onSwitchPage' : self.__switchPage, 'keyPressed' : self.__keyPressed } self.__widgetTree.signal_autoconnect(dic) gtk.window_set_default_icon_from_file(os.path.join(datadir, 'phonetooth-small.svg')) self.__mainWindow.show()
def _init_icons(self): gtk.window_set_default_icon_from_file(get_image('diglib.svg')) icon_factory = gtk.IconFactory() for stock_id in ('diglib-document-add', 'diglib-document-open', 'diglib-document-copy', 'diglib-document-delete', 'diglib-document-tag', 'diglib-directory-add'): icon_path = get_image('%s.svg' % stock_id) icon_set = gtk.IconSet(gtk.gdk.pixbuf_new_from_file(icon_path)) icon_factory.add(stock_id, icon_set) icon_factory.add_default()
def _get_icon_location(self): # we set the icon first (if available) so that it doesn't flash # on when the window is realized in Application.build_window() icopath = os.path.join(resources.app_root(), "Miro.ico") if app.config.get(prefs.THEME_NAME) and app.config.get(options.WINDOWS_ICON): themeIcoPath = resources.theme_path(app.config.get(prefs.THEME_NAME), app.config.get(options.WINDOWS_ICON)) if os.path.exists(themeIcoPath): icopath = themeIcoPath gtk.window_set_default_icon_from_file(icopath) return icopath
def __init__(self): """initialise common wahcade class""" #set default icon for windows gtk.window_set_default_icon_from_file( os.path.join(APP_PATH, 'pixmaps', 'wahcade.png')) ### LOGFILE self.log_filename = os.path.join(CONFIG_DIR, 'wahcade.log') f = open(self.log_filename, 'w') self.log_msg("//======================= NEW LOG RUN =======================//") f.close
def __init__(self): self._presets_store = core.PresetsStore(config.PRESETS_PATH) self._manage_presets_dialog = ui.ManagePresetsDialog(config.GLADE_PATH, self._presets_store.get_model(), lambda row_iter: utils.get_preset_display_text(self._presets_store, row_iter)) self._manage_presets_dialog.connect('clicked-add', self._on_mgr_clicked_add) self._manage_presets_dialog.connect('clicked-edit', self._on_mgr_clicked_edit) self._manage_presets_dialog.connect('clicked-remove', self._on_mgr_clicked_remove) gtk.window_set_default_icon_from_file(config.ICON_PATH)
def __init__(self): self._presets_store = core.PresetsStore(config.PRESETS_PATH) self._manage_presets_dialog = ui.ManagePresetsDialog(config.GLADE_PATH, self._presets_store.get_model(), lambda row_iter: utils.get_preset_display_text(self._presets_store, row_iter)) self._manage_presets_dialog.connect('clicked-add', self._on_mgr_clicked_add) self._manage_presets_dialog.connect('clicked-edit', self._on_mgr_clicked_edit) self._manage_presets_dialog.connect('clicked-remove', self._on_mgr_clicked_remove) gtk.window_set_default_icon_from_file(config.ICON_PATH)
def setup_icons(): from pigeonplanner.ui import utils # Register custom stock icons utils.create_stock_button([ ("icon_pedigree_detail.png", "pedigree-detail", _("Pedigree")), ("icon_email.png", "email", _("E-mail")), ("icon_send.png", "send", _("Send")), ("icon_report.png", "report", _("Report")), ("icon_columns.png", "columns", "columns"), ]) # Set default icon for all windows gtk.window_set_default_icon_from_file(os.path.join(const.IMAGEDIR, "icon_logo.png"))
def register_icons(): iconfile = os.path.join(configure.imagedir, 'flumotion.png') gtk.window_set_default_icon_from_file(iconfile) _register_stock_icons([ ('flumotion.admin.gtk', ['16x16/wizard.png', '24x24/wizard.png']), ('flumotion-mood-happy', ['mood-happy.png']), ('flumotion-mood-hungry', ['mood-hungry.png']), ('flumotion-mood-lost', ['mood-lost.png']), ('flumotion-mood-sad', ['mood-sad.png']), ('flumotion-mood-sleeping', ['mood-sleeping.png']), ('flumotion-mood-waking', ['mood-waking.png']), ])
def __init__(self): self.terminal = terminal = vte.Terminal() terminal.connect('child-exited', lambda *w: self.child_exited()) self.scrollwindow = scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) scroll.add_with_viewport(terminal) self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL) gtk.window_set_default_icon_from_file(D+'suyun_icons/default.png') window.set_title(_('Ailurus terminal')) window.set_position(gtk.WIN_POS_CENTER) window.add(scroll) window.connect('delete-event', lambda *w: True) window.show_all() window.realize()
def register_icons(): iconfile = os.path.join(configure.imagedir, 'flumotion.png') gtk.window_set_default_icon_from_file(iconfile) _register_stock_icons([ ('flumotion.admin.gtk', ['16x16/wizard.png', '24x24/wizard.png']), ('flumotion-mood-happy', ['mood-happy.png']), ('flumotion-mood-hungry', ['mood-hungry.png']), ('flumotion-mood-lost', ['mood-lost.png']), ('flumotion-mood-sad', ['mood-sad.png']), ('flumotion-mood-sleeping', ['mood-sleeping.png']), ('flumotion-mood-waking', ['mood-waking.png']), ])
def __init__(self): """initialise common wahcade class""" #set default icon for windows gtk.window_set_default_icon_from_file( os.path.join(APP_PATH, 'pixmaps', 'wahcade.png')) ### LOGFILE # Verifies there is a CONFIG_DIR directory, then creates a log file in it # and begins logging. if os.path.exists(CONFIG_DIR): self.log_filename = os.path.join(CONFIG_DIR, 'wahcade.log') f = open(self.log_filename, 'w') self.log_msg("//======================= NEW LOG RUN =======================//") f.close
def __init__(self): """initialise common wahcade class""" #set default icon for windows gtk.window_set_default_icon_from_file( os.path.join(APP_PATH, 'pixmaps', 'wahcade.png')) ### LOGFILE if os.path.exists(CONFIG_DIR): self.log_filename = os.path.join(CONFIG_DIR, 'wahcade.log') try: f = open(self.log_filename, 'w') self.log_msg("//======================= NEW LOG RUN =======================//") f.close except: print "ERROR opening LOG FILE, %s, check for orphaned processes" % self.log_filename
def __init__(self): """initialise common wahcade class""" #set default icon for windows gtk.window_set_default_icon_from_file( os.path.join(wc_constants.APP_PATH, 'pixmaps', 'wahcade.png')) ### LOGFILE if os.path.exists(wc_constants.CONFIG_DIR): self.log_filename = os.path.join(wc_constants.CONFIG_DIR, 'wahcade.log') f = open(self.log_filename, 'w') self.log_msg( "//======================= NEW LOG RUN =======================//" ) f.close
def __init__(self): self.can_exit = False # set True in self.child_exited() self.terminal = terminal = vte.Terminal() terminal.connect('child-exited', lambda *w: self.child_exited()) self.scrollwindow = scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) scroll.add_with_viewport(terminal) self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL) gtk.window_set_default_icon_from_file(D + 'suyun_icons/default.png') window.set_title(_('Ailurus terminal')) window.set_position(gtk.WIN_POS_CENTER) window.add(scroll) window.connect('delete-event', self.delete_event) window.show_all() window.realize()
def __init__(self): """initialise common wahcade class""" #set default icon for windows gtk.window_set_default_icon_from_file( os.path.join(APP_PATH, 'pixmaps', 'wahcade.png')) ### LOGFILE if os.path.exists(CONFIG_DIR): self.log_filename = os.path.join(CONFIG_DIR, 'wahcade.log') try: f = open(self.log_filename, 'w') self.log_msg( "//======================= NEW LOG RUN =======================//" ) f.close except: print "ERROR opening LOG FILE, %s, check for orphaned processes" % self.log_filename
def initMainWindow(self): '''Init main window.''' # Create main window. window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_decorated(False) # Init. window.set_title('深度Linux软件中心') window.set_position(gtk.WIN_POS_CENTER_ALWAYS) (width, height) = utils.getScreenSize(window) window.set_default_size(self.DEFAULT_WIDTH, self.DEFAULT_HEIGHT) # Set icon. gtk.window_set_default_icon_from_file("./icons/icon/icon.ico") return window
def __init__(self): gtk.Window.__init__(self) self.set_title(_("系统备份/还原")) gtk.window_set_default_icon_from_file("res/icon.png") self.set_position(gtk.WIN_POS_CENTER_ALWAYS) self.set_border_width(2) #self.set_decorated(False) self.set_resizable(False) #pixbuf = gtk.gdk.pixbuf_new_from_file("res/back.png") self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#8795a0")) self.set_size_request(800, 600) #self.connect("expose_event", self.expose, pixbuf) self.connect("destroy", self.destroy)
def __init__(self): gtk.Window.__init__(self) self.set_title(_("系统备份/还原")) gtk.window_set_default_icon_from_file("res/icon.png") self.set_position(gtk.WIN_POS_CENTER_ALWAYS) self.set_border_width(2) #self.set_decorated(False) self.set_resizable(False) #pixbuf = gtk.gdk.pixbuf_new_from_file("res/back.png") self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#8795a0")) self.set_size_request(800, 600) #self.connect("expose_event", self.expose, pixbuf) self.connect("destroy", self.destroy)
def _set_default_icon(self): # set the icon so that it doesn't flash when the window is # realized in Application.build_window(). # if this isn't a themed Miro, then we use the default icon set ico_path = resources.share_path("icons/hicolor/24x24/apps/miro.png") if app.config.get(prefs.THEME_NAME) != prefs.THEME_NAME.default and app.config.get(options.WINDOWS_ICON): theme_ico_path = resources.theme_path( app.config.get(prefs.THEME_NAME), app.config.get(options.WINDOWS_ICON) ) if os.path.exists(theme_ico_path): ico_path = theme_ico_path gtk.window_set_default_icon_from_file(ico_path) else: gtk.icon_theme_get_default().append_search_path(resources.share_path("icons")) gtk.window_set_default_icon_name("miro") return ico_path
def set_profile(self, newprofile, title_extra, iconpathname): assert self._profile is None self.hide() self._profile = newprofile self.highlight_profile(newprofile, scroll=True) self.set_title(self.get_title() + title_extra) NewProfileDialog.append_dialog_title(title_extra) self._title_extra = title_extra try: self.set_icon_from_file(iconpathname) except glib.GError: print "Profile icon image file not found:", iconpathname else: gtk.window_set_default_icon_from_file(iconpathname) self.cancel.set_label(gtk.STOCK_CLOSE) self.connect("delete-event", self._cb_delete_event) self.response(0)
def __init__(self): self.thread = None # GUI related self.builder = gtk.Builder() self.builder.add_from_file(ui_file) self.builder.connect_signals(self) self.mainwindow = self.builder.get_object('mainwindow') self.host = self.builder.get_object('host') self.user = self.builder.get_object('user') self.passwd = self.builder.get_object('passwd') self.boardlist = self.builder.get_object('boardlist') self.boardlist_button = self.builder.get_object('boardlist_button') self.limit = self.builder.get_object('limit') self.deleteheader = self.builder.get_object('deleteheader') self.title = self.builder.get_object('title') self.content = self.builder.get_object('content') self.content_button = self.builder.get_object('content_button') self.post_start_button = self.builder.get_object('post_start_button') self.post_stop_button = self.builder.get_object('post_stop_button') self.post_message = self.builder.get_object('post_message') self.xdscript = self.builder.get_object('xdscript') self.run_start_button = self.builder.get_object('run_start_button') self.run_stop_button = self.builder.get_object('run_stop_button') self.run_message = self.builder.get_object('run_message') self.helpview = self.builder.get_object('helpview') self.aboutdialog = self.builder.get_object('aboutdialog') helpbuffer = self.helpview.get_buffer() helpbuffer.set_text(HELPTEXT) self.post_message_buffer = self.post_message.get_buffer() self.limit.set_value(5) self.post_client = PttXPGuiTelnetClient(self.post_message) self.script_client = PttXPGuiTelnetClient(self.run_message) self.script_runner = PttXPScriptRunner(self.script_client, True) gtk.window_set_default_icon_from_file(program_logo) self.mainwindow.set_title('%s %s' % (program_name, program_version)) self.mainwindow.set_position(gtk.WIN_POS_CENTER) self.mainwindow.show_all() gtk.main()
def init(withgtk=True): """Shared metarace program initialisation.""" # Check for data path and change working directory mk_data_path() os.chdir(DATA_PATH) # Set global logging options logging._srcfile = None logging.logThreads = 0 logging.logProcesses = 0 # read in system configuration - errors here print to stderr, but # are not necessarily fatal. conffile = default_file(SYSCONF_FILE) try: if os.path.exists(conffile): with open(conffile, 'rb') as f: sysconf.read(f) except Exception as e: print(u'Error reading system config from ' + repr(conffile) + ': ' + repr(e)) # Do GTK init unless disabled if withgtk: # Initialise threading in glib try: glib.threads_init() except: gobject.threads_init() # Initialise threading in GDK gtk.gdk.threads_init() # Try some window methods, but don't worry if they fail try: # fix the gnome menubar accelerator mapping mset = gtk.settings_get_default() mset.set_string_property('gtk-menu-bar-accel', 'F24', 'override') gtk.window_set_default_icon_from_file(default_file(LOGO_FILE)) except: pass # but ignore errors
def __init__(self, left, top, width, height, device, flip): super(CamDesk, self).__init__() self.set_position(gtk.WIN_POS_CENTER) self.set_title("CamDesk") self.set_decorated(False) self.set_has_frame(False) self.set_size_request(width, height) self.set_resizable(False) self.set_keep_above(True) self.set_property('skip-taskbar-hint', True) gtk.window_set_default_icon_from_file('logo.png') self.connect("destroy", gtk.main_quit, "WM destroy") self.connect("key-press-event", self.closeme) self.connect("key-press-event", self.startme) self.connect("key-press-event", self.stopme) self.connect("key-press-event", self.properties) vbox = gtk.VBox(False, 0) self.add(vbox) self.movie_window = gtk.DrawingArea() vbox.add(self.movie_window) self.show_all() # Set up the gstreamer pipeline self.player = gst.parse_launch('v4l2src ' + ('' if device == '' else 'device=' + device) + ' ! videoflip method=' + flip + ' ! xvimagesink') bus = self.player.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() bus.connect("message", self.on_message) bus.connect("sync-message::element", self.on_sync_message) # Start with camera playing self.player.set_state(gst.STATE_PLAYING) # Set initial position self.move(left, top)
def __init__(self): ListenerMixin.ListenerMixin.__init__(self) #these are all the top-level windows that will ever be used. This Controller is responsible for all of them. self.loginWindow = None self.btWindow = None self.firefoxWindow = None self.bankApp = None self.torApp = None self.bbApp = None self.btApp = None self.ffApp = None self.updateDialog = None self.lowMoneyDialog = None self.povertyDialog = None self.settingsDialog = None #listen for the events that we need to know about self.catch_event("no_credits") self.catch_event("shutdown") self.catch_event("new_args") #necessary for GTK to function properly: gobject.threads_init() #set the default image for the window defaultImage = ClientUtil.get_image_file(u"bb_logo.png") gtk.window_set_default_icon_from_file(defaultImage) #: windows which have been (de)iconified by left clickingon the status icon self.previouslyToggledWindows = [] #sytem tray icon stuffs- handle when it is left clicked... statusIcon = ClientUtil.get_image_file("bb_favicon.ico") self.statusIcon = StatusIcon.StatusIcon(statusIcon) self.statusIcon.set_visible(False) self._start_listening_for_event("activated", self.statusIcon, self.on_status_icon_activated) self._start_listening_for_event("popup", self.statusIcon, self.on_status_icon_popup)
def __init__(self): super(CamDesk, self).__init__(gtk.WINDOW_TOPLEVEL) self.set_position(gtk.WIN_POS_CENTER) # display at bottom right self.set_gravity(gtk.gdk.GRAVITY_SOUTH_EAST) self.move(gtk.gdk.screen_width(), gtk.gdk.screen_height()) self.stick() self.set_title("CamDesk") self.set_decorated(False) self.set_has_frame(False) self.set_size_request(320, 240) self.set_resizable(False) self.set_keep_above(True) self.set_property('skip-taskbar-hint', True) gtk.window_set_default_icon_from_file('logo.png') self.connect("destroy", gtk.main_quit, "WM destroy") self.connect("key-press-event", self.closeme) self.connect("key-press-event", self.startme) self.connect("key-press-event", self.stopme) self.connect("key-press-event", self.properties) self.movie_window = gtk.DrawingArea() self.movie_window.set_double_buffered(False) self.add(self.movie_window) self.show_all() # Set up the gstreamer pipeline self.player = gst.parse_launch ("v4l2src ! videoflip method=horizontal-flip ! autovideosink") bus = self.player.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() bus.connect("message", self.on_message) bus.connect("sync-message::element", self.on_sync_message) self.player.set_state(gst.STATE_PLAYING)
def main(debug=False): localedir = localepath() gettext.bindtextdomain('jwsprocessor', localedir) gettext.textdomain('jwsprocessor') cfgFile = config_load_validate() # Load the icon for the window; here we just load one, default icon try: gtk.window_set_default_icon_from_file(imagepath("jwsprocessor.svg")) except glib.GError: gtk.window_set_default_icon_from_file(imagepath("jwsprocessor.png")) app_window = JwsAssistant() gtk.main() config_save(cfgFile) if debug: printConfigParser() ##debug
def __init__(self): ListenerMixin.ListenerMixin.__init__(self) #these are all the top-level windows that will ever be used. This Controller is responsible for all of them. self.loginWindow = None self.btWindow = None self.firefoxWindow = None self.bankApp = None self.torApp = None self.bbApp = None self.btApp = None self.ffApp = None self.updateDialog = None self.lowMoneyDialog = None self.povertyDialog = None self.settingsDialog = None #listen for the events that we need to know about self.catch_event("no_credits") self.catch_event("shutdown") self.catch_event("new_args") #necessary for GTK to function properly: gobject.threads_init() #set the default image for the window defaultImage = ClientUtil.get_image_file(u"bb_logo.png") gtk.window_set_default_icon_from_file(defaultImage) #: windows which have been (de)iconified by left clickingon the status icon self.previouslyToggledWindows = [] #sytem tray icon stuffs- handle when it is left clicked... statusIcon = ClientUtil.get_image_file("bb_favicon.ico") self.statusIcon = StatusIcon.StatusIcon(statusIcon) self.statusIcon.set_visible(False) self._start_listening_for_event("activated", self.statusIcon, self.on_status_icon_activated) self._start_listening_for_event("popup", self.statusIcon, self.on_status_icon_popup)
def main(debug=False): localedir = localepath() gettext.bindtextdomain('jwsprocessor', localedir) gettext.textdomain('jwsprocessor') cfgFile = config_load_validate() # Load the icon for the window; here we just load one, default icon try: gtk.window_set_default_icon_from_file( imagepath("jwsprocessor.svg") ) except glib.GError: gtk.window_set_default_icon_from_file( imagepath("jwsprocessor.png") ) app_window = JwsAssistant() gtk.main() config_save(cfgFile) if debug: printConfigParser() ##debug
def __init__(self,left,top,width,height,device): super(CamDesk, self).__init__() self.set_position(gtk.WIN_POS_CENTER) self.set_title("CamDesk") self.set_decorated(False) self.set_has_frame(False) self.set_size_request(width, height) self.set_resizable(False) self.set_keep_above(True) self.set_property('skip-taskbar-hint', True) gtk.window_set_default_icon_from_file('logo.png') self.connect("destroy", gtk.main_quit, "WM destroy") self.connect("key-press-event", self.closeme) self.connect("key-press-event", self.startme) self.connect("key-press-event", self.stopme) self.connect("key-press-event", self.properties) vbox = gtk.VBox(False, 0) self.add(vbox) self.movie_window = gtk.DrawingArea() vbox.add(self.movie_window) self.show_all() # Set up the gstreamer pipeline self.player = gst.parse_launch ('v4l2src '+('' if device=='' else 'device='+device)+' ! autovideosink') bus = self.player.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() bus.connect("message", self.on_message) bus.connect("sync-message::element", self.on_sync_message) # Start with camera playing self.player.set_state(gst.STATE_PLAYING) # Set initial position self.move(left,top)
import panel_extension import string # maybe someone can do this trick without string? from gettext import gettext as _, bindtextdomain, textdomain import blog_poster import aligned_window import blogger_prefs import gnome_blog_globals bindtextdomain('gnome-blog', gnome_blog_globals.localedir) textdomain('gnome-blog') icon_theme = gtk.icon_theme_get_default() icon_info = icon_theme.lookup_icon('gnome-blog', -1, 0) gtk.window_set_default_icon_from_file(icon_info.get_filename()) def return_extension(): return BloggerApplet() class BloggerApplet(panel_extension.PanelExtension): def __init__(self): self.__gobject_init__ panel_extension.PanelExtension.__init__(self) def __extension_init__(self): self.mybundle = self.get_bundle() menu_file = self.mybundle.open("GNOME_BlogApplet.xml")
if ext in IMAGE_FORMAT: self.path = filename break else: error_msg('Image format "%s" is not supported' % ext, parent=self) self.set_current_name(os.path.split(root)[1] + '.' + menu_ext) self.hide() return filename # set icon used when windows are minimized, it requires # gtk.pygtk_version >= (2,2,0) with a GDK pixbuf loader for SVG installed try: gtk.window_set_default_icon_from_file ( os.path.join (matplotlib.rcParams['datapath'], 'matplotlib.svg')) except: verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1]) def error_msg_gtk(msg, parent=None): if parent: # find the toplevel gtk.Window parent = parent.get_toplevel() if not parent.flags() & gtk.TOPLEVEL: parent = None if not is_string_like(msg): msg = ','.join(map(str,msg)) dialog = gtk.MessageDialog( parent = parent,
## You should have received a copy of the GNU General Public License along ## with this program. Or on Debian systems, from /usr/share/common-licenses/GPL ## If not, see <http://www.gnu.org/licenses/gpl.txt>. APP_DESC = 'StarCalendar' import os, shutil from os.path import dirname from os.path import join, isfile, isdir from scal2.paths import * from scal2.config_importer import importConfigFrom15, getOldVersion, langDir, langConfDir import gtk gtk.window_set_default_icon_from_file('%s/starcal2.png'%pixDir) langNameList = [] langCodeList = [] langDefaultCode = '' win = gtk.Dialog(title=APP_DESC+' - First Run', buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) langHbox = gtk.HBox() langHbox.pack_start(gtk.Label('Select Language:'), 0, 0) importCheckb = None oldVersion = getOldVersion() if oldVersion and '1.5.0' < oldVersion < '1.6.0':## FIXME importCheckb = gtk.CheckButton('Import configurations from %s %s'%(APP_DESC, oldVersion))
import os, time from os.path import * import gnomeapplet, gtk, gtk.gdk, gconf, gobject gobject.threads_init() from gettext import gettext as _ import gconf import invest, invest.about, invest.chart, invest.preferences, invest.defs from invest.quotes import QuoteUpdater from invest.widgets import * gtk.window_set_default_icon_from_file(join(invest.ART_DATA_DIR, "invest_neutral.svg")) class InvestApplet: def __init__(self, applet): self.applet = applet self.applet.setup_menu_from_file ( None, "Invest_Applet.xml", None, [("About", self.on_about), ("Prefs", self.on_preferences), ("Refresh", self.on_refresh) ]) evbox = gtk.HBox() self.applet_icon = gtk.Image() self.set_applet_icon(0) self.applet_icon.show() evbox.add(self.applet_icon) self.applet.add(evbox) self.applet.connect("button-press-event",self.button_clicked) self.applet.show_all()
def __init__(self, logfile=None): config = {'logmode': 'none', 'logfile': logfile} self.coherence = Coherence(config) self.controlpoint = ControlPoint(self.coherence, auto_client=[]) window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.connect("delete_event", lambda x, y: reactor.stop()) window.set_default_size(350, 700) window.set_title('UPnP Inspector') icon = resource_filename(__name__, os.path.join('icons', 'inspector-icon.png')) gtk.window_set_default_icon_from_file(icon) vbox = gtk.VBox(homogeneous=False, spacing=0) menu_bar = gtk.MenuBar() menu = gtk.Menu() refresh_item = gtk.MenuItem("Rediscover Devices") refresh_item.connect("activate", self.refresh_devices) menu.append(refresh_item) menu.append(gtk.SeparatorMenuItem()) quit_item = gtk.MenuItem("Quit") menu.append(quit_item) quit_item.connect("activate", lambda x: reactor.stop()) file_menu = gtk.MenuItem("File") file_menu.set_submenu(menu) menu_bar.append(file_menu) menu = gtk.Menu() self.show_details_item = gtk.CheckMenuItem("show details") menu.append(self.show_details_item) self.show_details_item.connect("activate", self.show_details_widget, "view.details") self.show_events_item = gtk.CheckMenuItem("show events") menu.append(self.show_events_item) self.show_events_item.connect("activate", self.show_events_widget, "view.events") self.show_log_item = gtk.CheckMenuItem("show global log") menu.append(self.show_log_item) self.show_log_item.connect("activate", self.show_log_widget, "view.log") #self.show_log_item.set_sensitive(False) view_menu = gtk.MenuItem("View") view_menu.set_submenu(menu) menu_bar.append(view_menu) test_menu = gtk.MenuItem("Test") test_menu.set_sensitive(False) #test_menu.set_submenu(menu) menu_bar.append(test_menu) menu = gtk.Menu() item = gtk.MenuItem("Info") menu.append(item) item.connect("activate", self.show_about_widget, "help.info") help_menu = gtk.MenuItem("Help") help_menu.set_submenu(menu) menu_bar.append(help_menu) vbox.pack_start(menu_bar, False, False, 2) self.device_tree = DevicesWidget(self.coherence) self.device_tree.cb_item_left_click = self.show_details vbox.pack_start(self.device_tree.window, True, True, 0) window.add(vbox) window.show_all() self.events_widget = EventsWidget(self.coherence) self.events_widget.window.connect('delete_event', self.hide_events_widget) self.details_widget = DetailsWidget(self.coherence) self.details_widget.window.connect('delete_event', self.hide_details_widget) self.log_widget = LogWidget(self.coherence) self.log_widget.window.connect('delete_event', self.hide_log_widget)
def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) Master.register(self) self.denormalized_virtual_hosts = {} self.plugin_manager = PluginManager() self.apache = Apache2() #gnome.init(APPNAME, APPVERSION) self.gladefile = Configuration.GLADEPATH + "/" + "main.glade" self.xml = gtk.glade.XML(self.gladefile) #Create our dictionary and connect it dic = { "new_button_clicked": self.new_button_clicked, "on_MainWindow_destroy": self.quit, "please_restart": self.restart_apache, "on_delete": self.delete_button_clicked, "edit_button_clicked": self.edit_button_clicked, "edit_module_button_clicked": self.edit_module_button_clicked, "browse_sites_available": self.browse_sites_available, "on_button_resolve_errors_clicked": self.fix_vhosts, "surf_this_button_clicked": self.surf_this, "browse_button_clicked": self.browse_this, "about_clicked": self.display_about, "open_doc_button_clicked": self.open_doc_button_clicked, "on_button_hide_warning_clicked": self.on_button_hide_warning_clicked, "quit": self.quit, "on_menuitem_stop_apache_activate": self.on_menuitem_stop_apache_activate, "on_button_open_log_clicked": self.on_button_open_log_clicked } gtk.window_set_default_icon_from_file( os.path.join(Configuration.GLADEPATH, 'icon_cadsoft_eagle_golden.svg')) self.xml.signal_autoconnect(dic) GuiUtils.change_button_label(self.xml.get_widget('restart_apache'), "Restart Apache") #GuiUtils.change_button_label ( self.xml.get_widget( 'fix_vhosts' ), "Fix Virtual Hosts" ) self.statusbar_server_status = self.xml.get_widget( 'statusbar_server_status') self.image_apache_status = self.xml.get_widget('image_apache_status') self.main_window = self.xml.get_widget("MainWindow") self.menuitem_stop_apache = self.xml.get_widget("menuitem_stop_apache") self.menuitem_start_apache = self.xml.get_widget( "menuitem_start_apache") self.menuitem_restart_apache = self.xml.get_widget( "menuitem_restart_apache") #hereby we create lists self.create_vhost_list() self.create_modules_list() self.create_errors_list() #hereby we fill them self.refresh_lists(False) GuiUtils.style_as_tooltip(self.xml.get_widget('restart_apache_notice')) #GuiUtils.style_as_tooltip( self.xml.get_widget( 'unnormalized_notice' ) ) #GuiUtils.style_as_tooltip( self.xml.get_widget( 'hbox_apache_config_error' ) ) # start status update self.statusbar_server_status_context_id = self.statusbar_server_status.get_context_id( "Apache Server Status") self.statusbar_server_status.push( self.statusbar_server_status_context_id, "Attempting to connect to server") self.update_server_status(True) self.menu_tools = self.xml.get_widget('menu_tools') for plugin in self.plugin_manager.plugins: try: if plugin.is_enabled(): menu_item = plugin.init_main_window(self) if menu_item != None: self.menu_tools.add(menu_item) menu_item.show() except Exception: traceback.print_exc(file=sys.stdout) # Add rich edit to log self.text_view_log = GuiUtils.new_apache_sourceview() self.xml.get_widget('scroll_window_log').add(self.text_view_log) self.text_view_log.show() combobox_log = self.xml.get_widget('combobox_log') files = Shell.command.listdir("/var/log/apache2") for file in files: if file.endswith(".log"): combobox_log.append_text(file) combobox_log.set_active(0)
# The maximum fraction of the screen's height and width the main window is # allowed to occupy. MAIN_WINDOW_MAX_SCREEN_FRACTION = 0.8 # The time between updates of the main window's status bar, in milliseconds. STATUS_BAR_UPDATE_INTERVAL = 250 ############################################################################### # SETUP # ############################################################################### gtk.gdk.threads_init() gtk.window_set_default_icon_from_file(ICON_PATH) ############################################################################### # MAIN WINDOW HANDLER # ############################################################################### # A list of all MainWindowHandlers whose start method has been called, but # whose destroy method has not yet been called. Used in case the progream # allows multiple main windows to coexist in the future. Also, makes sure # that there's always a reference to these handlers around so that they # don't get inadvertently garbage-collected if a client doesn't keep a # reference itself. MAIN_WINDOW_HANDLERS = []
def set_default_window_icon(): gtk.window_set_default_icon_from_file(D+'suyun_icons/default.png')