Esempio n. 1
0
    def __init__(self, config):
        super(self.__class__,self).__init__()
        self.config = config

        self.isDock = True
        self.defaultUrl = None

        rootBox = gtk.VBox()
        rootBox.set_border_width(2)
        
        toolbar = gtk.Toolbar()
        toolbar.set_style(gtk.TOOLBAR_ICONS)
        gtk.icon_size_register('doctasktoolbar', 16, 16)
        toolbar.set_icon_size(gtk.icon_size_from_name('doctasktoolbar'))

        html = Html()

        dockAction = gtk.Action("input", "input", "if you found you can not input in the web page, click here",
                                gtk.STOCK_INDENT)
        homeAction = gtk.Action("home", "home", "return the start page", gtk.STOCK_HOME)
        refreshAction = gtk.Action("refresh", "refresh", "refresh", gtk.STOCK_REFRESH)
        exitAction = gtk.Action("exit", "exit", "exit", gtk.STOCK_QUIT)
        trayAction = gtk.Action("tray", "tray", "minimize to tray", gtk.STOCK_GO_DOWN)
        newUrlAction = gtk.Action("newUrl", "newUrl", "open a new url", gtk.STOCK_JUMP_TO)
        

        toolbar.add(dockAction.create_tool_item())
        toolbar.add(homeAction.create_tool_item())
        urlListToolButton = gtk.MenuToolButton(gtk.STOCK_SELECT_ALL)
        urlListToolButton.set_menu(self._buildUrlMenu())
        toolbar.add(urlListToolButton)
        # toolbar.add(newUrlAction.create_tool_item())
        toolbar.add(refreshAction.create_tool_item())
        toolbar.add(trayAction.create_tool_item())
        toolbar.add(exitAction.create_tool_item())

        rootBox.pack_start(toolbar, False)

        layout = gtk.ScrolledWindow()
        layout.add(html)

        rootBox.pack_start(layout)
        rootBox.set_focus_child(layout)

        self.add(rootBox)
        self.set_default_size(200, 750)

        self.html = html
        self.statusIcon = StatusIcon(self)

        dockAction.connect("activate", self.onDockButtonClick)
        refreshAction.connect("activate", self.onRefresh)
        exitAction.connect("activate", self.onExit)
        homeAction.connect("activate", self.onHome)
        trayAction.connect("activate", self.onTray)
        newUrlAction.connect("activate", self.onNewUrl)
        self.connect("enter-notify-event", self.onEnterNotifyEvent)
        self.connect("show", self.onShow)
Esempio n. 2
0
	def execute(self):
		""""""

		# intialize thread support (hangs on winxp)
		#gtk.gdk.threads_init()

		# load Cillop-Midnite theme
		gtk.rc_add_default_file(resourcePath("themes/Cillop-Midnite/gtk-2.0/gtkrc"))
		settings = gtk.settings_get_default()
		settings.set_string_property("gtk-theme-name", "Cillop-Midnite", "")

		# load icon theme
		theme = gtk.icon_theme_get_default()
		theme.prepend_search_path(resourcePath('themes'))
		settings.set_string_property("gtk-icon-theme-name", "budabot-icon-theme", "")
		gtk.icon_size_register('status-icon-size', 24, 24)

		self.settingModel = SettingModel()
		self.botModel = BotModel(self.settingModel)
		self.botModel.connect('botRemoved', self.onBotRemoved)

		systrayController = SystrayController()

		controlPanelController = ControlPanelController(self.botModel, self.settingModel)
		controlPanelController.connect('action_triggered', self.onControlPanelAction)

		# open control panel when user select 'open' from systray's context menu
		systrayController.connect_object('open_requested', ControlPanelController.show, controlPanelController)
		# opens/closes control panel when user clicks systray icon
		systrayController.connect_object('toggle_requested', ControlPanelController.toggle, controlPanelController)

		# notify systray controller of control panel's visibility
		controlPanelController.connect('visibility_changed', systrayController.onControlPanelVisibilityChanged)

		# connect exit requests to quit()-method
		controlPanelController.connect_object('exit_requested', Application.quit, self)
		systrayController.connect_object('exit_requested', Application.quit, self)

		# show errors to user
		self.settingModel.connect('error', self.onError)

		self.settingModel.load()

		controlPanelController.show()
		# run Twisted + GTK event loop
		reactor.run()
		
		systrayController.hideIcon()
Esempio n. 3
0
 def __init__(self, view, attrs):
     super(Icon, self).__init__(view, attrs)
     self.height = int(attrs.get('height', 60))
     self.width = int(attrs.get('width', 60))
     size_name = str(self.width) + '_' + str(self.height)
     self.size = gtk.icon_size_from_name(size_name)
     if self.size.numerator == 0:
         self.size = gtk.icon_size_register(size_name, self.width,
             self.height)
     self.widget = gtk.Image()
     self.update_icon()
Esempio n. 4
0
 def __init__(self, view, attrs):
     super(Icon, self).__init__(view, attrs)
     self.height = int(attrs.get('height', 60))
     self.width = int(attrs.get('width', 60))
     size_name = str(self.width) + '_' + str(self.height)
     self.size = gtk.icon_size_from_name(size_name)
     if self.size.numerator == 0:
         self.size = gtk.icon_size_register(size_name, self.width,
                                            self.height)
     self.widget = gtk.Image()
     self.update_icon()
Esempio n. 5
0
def channels_to_model(channels):
    new_model=gtk.ListStore(str, str, str, gtk.gdk.Pixbuf, int, gtk.gdk.Pixbuf, str)
    
    for channel in channels:
        (count_available, count_downloaded, count_new, count_unplayed)=channel.get_episode_stats()
        
        new_iter=new_model.append()
        new_model.set(new_iter, 0, channel.url)
        new_model.set(new_iter, 1, channel.title)

        title_markup=saxutils.escape(channel.title)
        description_markup=saxutils.escape(util.get_first_line(channel.description))
        description='%s\n<small>%s</small>' % (title_markup, description_markup)
        if channel.parse_error is not None:
            description='<span foreground="#ff0000">%s</span>' % description
            new_model.set(new_iter, 6, channel.parse_error)
        else:
            new_model.set(new_iter, 6, '')
        
        new_model.set(new_iter, 2, description)

        if count_unplayed > 0 or count_downloaded > 0:
            new_model.set(new_iter, 3, draw.draw_pill_pixbuf(str(count_unplayed), str(count_downloaded)))

        if count_new > 0:
            new_model.set( new_iter, 4, pango.WEIGHT_BOLD)
        else:
            new_model.set( new_iter, 4, pango.WEIGHT_NORMAL)

        channel_cover_found=False
        if os.path.exists( channel.cover_file) and os.path.getsize(channel.cover_file) > 0:
            try:
                new_model.set( new_iter, 5, gtk.gdk.pixbuf_new_from_file_at_size( channel.cover_file, 32, 32))
                channel_cover_found=True
            except: 
                exctype, value=sys.exc_info()[:2]
                log( 'Could not convert icon file "%s", error was "%s"', channel.cover_file, value )
                util.delete_file(channel.cover_file)

        if not channel_cover_found:
            iconsize=gtk.icon_size_from_name('channel-icon')
            if not iconsize:
                iconsize=gtk.icon_size_register('channel-icon',32,32)
            icon_theme=gtk.icon_theme_get_default()
            globe_icon_name='applications-internet'
            try:
                new_model.set( new_iter, 5, icon_theme.load_icon(globe_icon_name, iconsize, 0))
            except:
                log( 'Cannot load "%s" icon (using an old or incomplete icon theme?)', globe_icon_name)
                new_model.set( new_iter, 5, None)
    
    return new_model
Esempio n. 6
0
    def __init__(self):
        iconsize = gtk.icon_size_register("64x64", 64, 64)

        self.window = gtk.Window()
        self.window.set_decorated(False)
        self.window.set_keep_above(True)

        self.frame1 = gtk.Frame()
        self.frame2 = gtk.Frame()
        self.frame3 = gtk.Frame()

        self.layoutBox = gtk.VBox(False, 5)
        self.layoutBox.set_border_width(5)
        self.buttonsBox1 = gtk.HBox(True, 5)
        self.buttonsBox2 = gtk.HBox(True, 5)
        self.buttonsBox3 = gtk.HBox(True, 5)
        self.buttonsBox1.set_border_width(5)
        self.buttonsBox2 = gtk.HBox(True, 5)
        self.buttonsBox2.set_border_width(5)
        self.buttonsBox3.set_border_width(5)
        self.cancelButtonAlignment = gtk.Alignment(1.0, 0.5)

        self.logoutButton = gtk.Button("Logout")
        ico = gtk.Image()
        ico.set_from_icon_name("gnome-logout", iconsize)
        self.logoutButton.set_image(ico)

        self.restartButton = gtk.Button("Restart")
        ico = gtk.Image()
        ico.set_from_icon_name("gnome-session-reboot", iconsize)
        self.restartButton.set_image(ico)

        self.haltButton = gtk.Button("Shutdown")
        ico = gtk.Image()
        ico.set_from_icon_name("gnome-shutdown", iconsize)
        self.haltButton.set_image(ico)

        self.suspendButton = gtk.Button("Suspend")
        ico = gtk.Image()
        ico.set_from_icon_name("gnome-session-suspend", iconsize)
        self.suspendButton.set_image(ico)

        self.hibernateButton = gtk.Button("Hibernate")
        ico = gtk.Image()
        ico.set_from_icon_name("gnome-session-hibernate", iconsize)
        self.hibernateButton.set_image(ico)

        self.cancelButton = gtk.Button(None, gtk.STOCK_CANCEL)

        self.buttonsBox1.pack_start(self.logoutButton)
        self.buttonsBox2.pack_start(self.restartButton)
        self.buttonsBox2.pack_start(self.haltButton)
        self.buttonsBox3.pack_start(self.suspendButton)
        self.buttonsBox3.pack_start(self.hibernateButton)
        self.cancelButtonAlignment.add(self.cancelButton)
        self.frame1.add(self.buttonsBox1)
        self.frame2.add(self.buttonsBox2)
        self.frame3.add(self.buttonsBox3)
        self.layoutBox.pack_start(self.frame1)
        self.layoutBox.pack_start(self.frame2)
        self.layoutBox.pack_start(self.frame3)
        self.layoutBox.pack_start(self.cancelButtonAlignment)

        self.window.add(self.layoutBox)

        self.window.show_all()

        self.window.set_gravity(gtk.gdk.GRAVITY_NORTH_WEST)
        w, h = self.window.get_size()
        self.window.move(gtk.gdk.screen_width() / 2 - w / 2, gtk.gdk.screen_height() / 2 - h / 2)

        self.window.connect("delete-event", self.terminate)
        self.cancelButton.connect("clicked", self.terminate)

        self.logoutButton.connect("clicked", self.logout)
        self.restartButton.connect("clicked", self.reboot)
        self.haltButton.connect("clicked", self.shutdown)
        self.suspendButton.connect("clicked", self.suspend)
        self.hibernateButton.connect("clicked", self.hibernate)
Esempio n. 7
0
File: icons.py Progetto: pbx/kupfer
from gobject import GError

from kupfer import config
from kupfer import datatools
from kupfer import pretty
from kupfer import scheduler

icon_cache = {}

# number of elements in icon lru cache (per icon size)
ICON_CACHE_SIZE = 15

LARGE_SZ = 128
SMALL_SZ = 24

gtk.icon_size_register("kupfer-large", LARGE_SZ, LARGE_SZ)
gtk.icon_size_register("kupfer-small", SMALL_SZ, SMALL_SZ)

## default fallbacks for our themable icons
kupfer_icon_fallbacks = {
    'kupfer-execute': 'gtk-execute',
    'kupfer-object': 'gtk-file',
    'kupfer-object-multiple': 'gtk-file',
    'kupfer-catalog': 'folder-saved-search',
}

kupfer_locally_installed_names = set()


def _icon_theme_changed(theme):
    pretty.print_info(__name__, "Icon theme changed, clearing cache")
Esempio n. 8
0
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program.  If not, see <http://www.gnu.org/licenses/>.

import os, gtk

PATH = os.path.dirname(os.path.abspath(__file__))
ICONS_PATH = os.path.join(PATH, 'icons')
GENERIC_ICONS_PATH = os.path.join(ICONS_PATH, 'generic')
ICONS16_PATH = os.path.join(ICONS_PATH, '16x16')
ICONS24_PATH = os.path.join(ICONS_PATH, '24x24')
ICONS32_PATH = os.path.join(ICONS_PATH, '32x32')

FIXED16 = gtk.icon_size_register('FIXED16', 16, 16)
FIXED22 = gtk.icon_size_register('FIXED22', 22, 22)
FIXED24 = gtk.icon_size_register('FIXED24', 24, 24)
FIXED32 = gtk.icon_size_register('FIXED32', 32, 32)
FIXED48 = gtk.icon_size_register('FIXED48', 48, 48)
FIXED64 = gtk.icon_size_register('FIXED64', 64, 64)
FIXED128 = gtk.icon_size_register('FIXED128', 128, 128)

STOCK_ZOOM_PAGE = 'gtk-zoom-page'
STOCK_DONT_SAVE = 'gtk-action-dont-save'

PROVIDERS = []

SYSCOLORS = {
		'bg':(),
		'selected-bg':(),
Esempio n. 9
0
from gobject import GError

from kupfer import config
from kupfer import datatools
from kupfer import pretty
from kupfer import scheduler

icon_cache = {}

# number of elements in icon lru cache (per icon size)
ICON_CACHE_SIZE = 15

LARGE_SZ = 128
SMALL_SZ = 24

gtk.icon_size_register("kupfer-large", LARGE_SZ, LARGE_SZ)
gtk.icon_size_register("kupfer-small", SMALL_SZ, SMALL_SZ)

## default fallbacks for our themable icons
kupfer_icon_fallbacks = {
    'kupfer-execute': 'gtk-execute',
    'kupfer-object': 'gtk-file',
    'kupfer-object-multiple': 'gtk-file',
    'kupfer-catalog': 'folder-saved-search',
}

kupfer_locally_installed_names = set()


def _icon_theme_changed(theme):
    pretty.print_info(__name__, "Icon theme changed, clearing cache")
Esempio n. 10
0
except:
    have_pynotify = False

try:
    import hildon
except:
    if platform.MAEMO:
        log = logging.getLogger('panucci.panucci')
        log.critical( 'Using GTK widgets, install "python2.5-hildon" '
            'for this to work properly.' )

if platform.FREMANTLE:
    # Workaround Maemo bug 6694 (Playback in Silent mode)
    gobject.set_application_name('FMRadio')

gtk.icon_size_register('panucci-button', 32, 32)

##################################################
# PanucciGUI
##################################################
class PanucciGUI(object):
    """ The object that holds the entire panucci gui """

    def __init__(self, settings, filename=None):
        self.__log = logging.getLogger('panucci.panucci.PanucciGUI')
        interface.register_gui(self)
        self.config = settings.config
        self.playlist = playlist.Playlist(self.config)

        # Build the base ui (window and menubar)
        if platform.MAEMO:
Esempio n. 11
0
except:
    have_pynotify = False

try:
    import hildon
except:
    if platform.MAEMO:
        log = logging.getLogger('panucci.panucci')
        log.critical('Using GTK widgets, install "python2.5-hildon" '
                     'for this to work properly.')

if platform.FREMANTLE:
    # Workaround Maemo bug 6694 (Playback in Silent mode)
    gobject.set_application_name('FMRadio')

gtk.icon_size_register('panucci-button', 32, 32)


##################################################
# PanucciGUI
##################################################
class PanucciGUI(object):
    """ The object that holds the entire panucci gui """
    def __init__(self, settings, filename=None):
        self.__log = logging.getLogger('panucci.panucci.PanucciGUI')
        interface.register_gui(self)
        self.config = settings.config
        self.playlist = playlist.Playlist(self.config)

        # Build the base ui (window and menubar)
        if platform.MAEMO:
Esempio n. 12
0
#

import gtk, gtk.gdk, notemeister

STOCK_APPLICATION 				= "notemeister-application"
STOCK_IMPORT 					= "notemeister-import"
STOCK_EXPORT 					= "notemeister-export"
STOCK_DATE 						= "notemeister-date"
STOCK_TIME 						= "notemeister-time"
STOCK_LINK 						= "notemeister-link"
STOCK_NOTE 						= "notemeister-note"
STOCK_FOLDER 					= "notemeister-folder"
STOCK_FOLDER_LINK 				= "notemeister-folder-link"
STOCK_WEB 		 				= "notemeister-web"

ICON_SIZE_POPUP 				= gtk.icon_size_register("notemeister-popup", 16, 16)

class IconFactory(gtk.IconFactory):

	def __init__(self, widget):
		gtk.IconFactory.__init__(self)
		self.add_default()

		icons = {
			STOCK_APPLICATION		: "notemeister.svg",
			STOCK_IMPORT 			: "import.svg",
			STOCK_EXPORT 			: "export.svg",
			STOCK_DATE 				: "calendar.svg",
			STOCK_TIME 				: "clock.svg",
			STOCK_LINK 				: "link.svg",
			STOCK_NOTE 				: "note.svg",
Esempio n. 13
0
 def register_icon_size(self):
     self._icon_size = gtk.icon_size_from_name("license-icon-size")
     if self._icon_size==0:
         self._icon_size = gtk.icon_size_register("license-icon-size", int(76*self.ICON_SCALE), int(21*self.ICON_SCALE))
     return self._icon_size
Esempio n. 14
0
    filename = abled + '-' + str(size) + '.png'
    source.set_filename(os.path.join(SamplerConfig.pixmapsdir, filename))

    return source


def __install(abled):
    icons = gtk.IconSet()

    source_48 = __source(abled, 48)
    source_48.set_size_wildcarded(False)
    source_48.set_size(gtk.ICON_SIZE_DIALOG)
    icons.add_source(source_48)

    source_96 = __source(abled, 96)
    #source_96.set_size_wildcarded(False)
    source_96.set_size(ICON_SIZE_EMBLEM)
    icons.add_source(source_96)

    factory = gtk.IconFactory()
    factory.add('sampler-' + abled, icons)
    factory.add_default()


ICON_SIZE_EMBLEM = gtk.icon_size_register('sampler-emblem', 96, 96)

__install('disabled')
__install('enabled')

stock = ['sampler-disabled', 'sampler-enabled']
Esempio n. 15
0
import gobject
import gio
import gtk

DEFAULT_SZ = 48
SZ_NAME = "dumb-dock"

gtk.icon_size_register(SZ_NAME, DEFAULT_SZ, DEFAULT_SZ)

class DockItem (gtk.Bin):
	__gtype_name__ = "DockItem"
	def __init__(self):
		gtk.Bin.__init__(self)
		self.dock_item_name = u"<noname>"
		self.event_box = gtk.EventBox()
		self.image = gtk.Image()
		self.event_box.add(self.image)
		self.__child = self.event_box
		#self.event_box.set_app_paintable(True)

		self.add(self.__child)
		self.show_all()
		self.connect("unrealize", self.on_unrealize)
		self.event_box.connect("button-press-event", self.on_button_press)
		self.event_box.connect("button-release-event", self.on_button_release)
		self.event_box.connect("enter-notify-event", self.on_mouse_enter)
		self.event_box.connect("leave-notify-event", self.on_mouse_leave)
		self.pop_win = None

	def on_mouse_enter(self, widget, event):
		self.event_box.set_state(gtk.STATE_ACTIVE)
Esempio n. 16
0
    window.move(int(pos[0]), int(pos[1]))
else:
    window.move(
        window.get_position()[0], 0
    )  # Move the window to the x value of Center, and 0.. So Top, Center.. ( I couldnt find a gtk constant for top-center)

window.drag_event = False  # Specify the initial value of the drag_event
window.connect("destroy", gtk.main_quit)  # Connect the destory event to killing of the gtk main loop

if orientation == "vertical":
    vbox = gtk.VBox(False, 0)  # An horizontal box to add our widgets too.

    window.add(vbox)  # Add hbox to window

    close_image = gtk.Image()  # Image to be assigned to close_button
    gtk.icon_size_register("VOL_BUTTONS", 12, 12)  # Register a special size for usage with gtk.STOCK_* items
    close_image.set_from_stock(gtk.STOCK_CLOSE, gtk.icon_size_from_name("VOL_BUTTONS"))  # Assign the STOCK_CLOSE icon
    close_button = gtk.Button()  # Create the button
    close_button.set_image(close_image)  # Set the button image to the value of close_image
    close_button.connect("clicked", gtk.main_quit)  # Connect the clicked event to the killing of the gtk main loop
    vbox.add(close_button)  # Add the widget to the hbox

    vol_adj = gtk.VScale(
        gtk.Adjustment(value=vol, lower=0, upper=100, step_incr=1, page_incr=6)
    )  # Create a scale for volume adjustment/display
    vol_adj.set_inverted(True)
    vol_adj.set_size_request(20, 100)  # Request the size of the widget to be 100 wide and 20 tall
    vol_adj.changed_event_connection_id = vol_adj.connect(
        "value_changed", change_volume
    )  # Connect the change event to the change_volume function (I am assigning it to the variable vol_adh.changed_event_connection_id because I need the returned ID to later block the event, since the value of the control will be changed progromatically later
    vol_adj.set_draw_value(False)  # Tell the scale not to draw the decimal value of the scales current position