Пример #1
0
def initWidget(widget):
	global itempointer, diff, clickScrollUp, clickScrollDown, update, browserCommand
	
	getHeise(heise_url[urlpointer])
	createMenu(widget)

	y_pos = 23
	z = 0 
	while z < lines:
   		itempointer.insert(z ,karamba.createText(widget, 14, y_pos, theme_width-18, line_height, ""))
		setStyle(widget, itempointer[z], 1, 17)
		karamba.changeTextColor(widget, itempointer[z], r,g,b)
		y_pos = y_pos + 15
		z = z + 1
	
	karamba.changeTextColor(widget, fill[0], 54,227,123)
#	karamba.changeTextColor(widget, fill[0], 255,255,255)
	# Menuoption "browser"
	karamba.addMenuConfigOption(widget, "browser", "Change your browser")
	browserCommand = karamba.readConfigEntry(widget, "browser") or "konqueror"
	# Up
	clickScrollUp = karamba.createImage(widget, 0, 0, "up.png")
	karamba.moveImage(widget, clickScrollUp, 50, 2)
	karamba.attachClickArea(widget, clickScrollUp, "")

	#Down
	clickScrollDown = karamba.createImage(widget, 0, 0, "down.png")
	karamba.moveImage(widget, clickScrollDown, 22, 3)
	karamba.attachClickArea(widget, clickScrollDown, "")
	
	fillContent(widget, "refresh")
	update = 0
	widgetUpdated(widget)
Пример #2
0
def createConfigMenus(widget):
    karamba.addMenuConfigOption(widget, "theme", "Choose theme")
    karamba.setMenuConfigOption(widget, "theme", 0)

    karamba.addMenuConfigOption(widget, "showZero", "Show processes where the CPU usage is 0")

    karamba.addMenuConfigOption(widget, "setCmdJustification", "Set the alignment for the command text")
    karamba.setMenuConfigOption(widget, "setCmdJustification", 0)

    karamba.addMenuConfigOption(widget, "setProcOutformat", "Set the column order for the output")
    karamba.setMenuConfigOption(widget, "setProcOutformat", 0)

    karamba.addMenuConfigOption(widget, "disableThreading", "Disable Threading")
Пример #3
0
def createConfigMenus(widget):
    karamba.addMenuConfigOption(widget, "theme", "Choose theme")
    karamba.setMenuConfigOption(widget, "theme", 0)

    karamba.addMenuConfigOption(widget, "showZero",
                                "Show processes where the CPU usage is 0")

    karamba.addMenuConfigOption(widget, "setCmdJustification",
                                "Set the alignment for the command text")
    karamba.setMenuConfigOption(widget, "setCmdJustification", 0)

    karamba.addMenuConfigOption(widget, "setProcOutformat",
                                "Set the column order for the output")
    karamba.setMenuConfigOption(widget, "setProcOutformat", 0)

    karamba.addMenuConfigOption(widget, "disableThreading",
                                "Disable Threading")
Пример #4
0
def initWidget(widget):
	
	
	# add a menu entry to select language
	karamba.addMenuConfigOption(widget, "ac_locale", "Select your country")
	karamba.setMenuConfigOption(widget, "ac_locale", 0)
	
	# set the language
	locale.setlocale(locale.LC_ALL, getLocale(widget))
	
	
	# Generate calendar
	calendar.printTop(widget, 0)
#	calendar.showWeekImage(widget, 0)
	calendar.showDayMarker(widget, 0)
	calendar.printDayCaptions(widget, 0)
	calendar.printCalendar(widget, 0)
	calendar.colorizeDay(widget, calendar.thisDay, 255, 255, 255)
Пример #5
0
def initWidget(widget):
    global g_nextCacheRefresh, g_showList, g_showIds, g_cacheExpiration, g_pastDays, g_linesMin, g_linesMax

    # Pass the widget reference
    Applet.widget = widget

    # Init splash
    splash = Applet().Splash()
    splash.show()

    # Create dir structure
    splash.setText("Checking config dirs...")
    createConfigDirs()

    # Read config
    splash.setText("Reading config...")
    config = Config()

    # Check whether we want DEBUG messages enabled or not
    if config.getboolean("main", "debug") == False:
        tools.msgDebug("Disabling debug messages !", __name__)
        Globals.DEBUG = False

    # Copy GUI files (if necessary)
    if Globals().versions['nextShows'] != config.get("main", "version") \
    or not "launchGUI" in os.listdir( Globals().nsCGuiBaseDir ):
        # Init dir structures and copy files
        splash.setText("Setup GUI...")
        copyThemeFilesToConfigDir(widget)
        config.set("main", "version", Globals().versions['nextShows'])

    # Get other useful infos from config
    splash.setText("Reading config...")
    displayType = config.get("display", "type")
    if displayType == "Fixed":
        g_linesMax = config.getint("display", "lines_fixed")
        g_linesMin = g_linesMax
    else:
        g_linesMin = config.getint("display", "lines_min")
        g_linesMax = config.getint("display", "lines_max")
    g_cacheExpiration          = config.getint("misc",    "cache_expiration")
    g_pastDays                 = config.getint("display", "past_days")
    applet.colorList           = config.getColors()
    applet.episodeFormatString = config.get(   "display", "format")
    applet.browser             = config.get(   "misc",    "browser")
    applet.dateFormat          = config.get(   "display", "date_format")
    applet.whenFormat          = config.getint("misc",    "when_format")

    # Getting the show list
    splash.setText("Getting show list....")
    g_showList = config.getShows()

    # Extract IDs
    g_showIds = [ show['id'] for show in g_showList ]

    # Init cache
    cache.setExpiration( g_cacheExpiration )
    cache.showIds = g_showIds

    # Refresh cache if necessary
    staledList = cache.getStaledCacheFiles()
    for id in staledList:
        for show in g_showList:
            if show['id'] == id:
                showName = show['name']
        splash.setText("Updating cache: '%s'..." % showName)
        cache.cacheEpisodeList( id )

    # Fetch data to display
    splash.setText("Filtering episodes...")
    data = Data()
    episodeList  = data.getEpisodeList( g_showIds, g_pastDays, g_linesMax )
    applet.episodeList = episodeList

    # Close the splash
    splash.setText("Done!")
    splash.hide()

    # Init widget
    # Fallback (for compatibility reasons)
    # "[display] theme=" was moved to "[misc] theme="
    try:
        applet.themeName = config.get("misc", "theme")
    except:
        applet.themeName = Globals().defaultThemeName
    numReturnedEpisode = len( episodeList )
    if numReturnedEpisode < g_linesMin:
        themeLines = g_linesMin
    elif numReturnedEpisode > g_linesMax:
        themeLines = g_linesMax
    else:
        themeLines = numReturnedEpisode
    applet.themeLines = themeLines
    applet.drawBackground()
    applet.printEpisodeList()

    # Store next cache refresh
    g_nextCacheRefresh = cache.getNextRefreshTS()

    # Setup menu entry for config GUI
    karamba.addMenuConfigOption(widget, "config_gui", "Configure...")
    karamba.setMenuConfigOption(widget, "config_gui", 0)
Пример #6
0
def initWidget(widget):
    global g_nextCacheRefresh, g_showList, g_showIds, g_cacheExpiration, g_pastDays, g_linesMin, g_linesMax

    # Pass the widget reference
    Applet.widget = widget

    # Init splash
    splash = Applet().Splash()
    splash.show()

    # Create dir structure
    splash.setText("Checking config dirs...")
    createConfigDirs()

    # Read config
    splash.setText("Reading config...")
    config = Config()

    # Check whether we want DEBUG messages enabled or not
    if config.getboolean("main", "debug") == False:
        tools.msgDebug("Disabling debug messages !", __name__)
        Globals.DEBUG = False

    # Copy GUI files (if necessary)
    if Globals().versions['nextShows'] != config.get("main", "version") \
    or not "launchGUI" in os.listdir( Globals().nsCGuiBaseDir ):
        # Init dir structures and copy files
        splash.setText("Setup GUI...")
        copyThemeFilesToConfigDir(widget)
        config.set("main", "version", Globals().versions['nextShows'])

    # Get other useful infos from config
    splash.setText("Reading config...")
    displayType = config.get("display", "type")
    if displayType == "Fixed":
        g_linesMax = config.getint("display", "lines_fixed")
        g_linesMin = g_linesMax
    else:
        g_linesMin = config.getint("display", "lines_min")
        g_linesMax = config.getint("display", "lines_max")
    g_cacheExpiration = config.getint("misc", "cache_expiration")
    g_pastDays = config.getint("display", "past_days")
    applet.colorList = config.getColors()
    applet.episodeFormatString = config.get("display", "format")
    applet.browser = config.get("misc", "browser")
    applet.dateFormat = config.get("display", "date_format")
    applet.whenFormat = config.getint("misc", "when_format")

    # Getting the show list
    splash.setText("Getting show list....")
    g_showList = config.getShows()

    # Extract IDs
    g_showIds = [show['id'] for show in g_showList]

    # Init cache
    cache.setExpiration(g_cacheExpiration)
    cache.showIds = g_showIds

    # Refresh cache if necessary
    staledList = cache.getStaledCacheFiles()
    for id in staledList:
        for show in g_showList:
            if show['id'] == id:
                showName = show['name']
        splash.setText("Updating cache: '%s'..." % showName)
        cache.cacheEpisodeList(id)

    # Fetch data to display
    splash.setText("Filtering episodes...")
    data = Data()
    episodeList = data.getEpisodeList(g_showIds, g_pastDays, g_linesMax)
    applet.episodeList = episodeList

    # Close the splash
    splash.setText("Done!")
    splash.hide()

    # Init widget
    # Fallback (for compatibility reasons)
    # "[display] theme=" was moved to "[misc] theme="
    try:
        applet.themeName = config.get("misc", "theme")
    except:
        applet.themeName = Globals().defaultThemeName
    numReturnedEpisode = len(episodeList)
    if numReturnedEpisode < g_linesMin:
        themeLines = g_linesMin
    elif numReturnedEpisode > g_linesMax:
        themeLines = g_linesMax
    else:
        themeLines = numReturnedEpisode
    applet.themeLines = themeLines
    applet.drawBackground()
    applet.printEpisodeList()

    # Store next cache refresh
    g_nextCacheRefresh = cache.getNextRefreshTS()

    # Setup menu entry for config GUI
    karamba.addMenuConfigOption(widget, "config_gui", "Configure...")
    karamba.setMenuConfigOption(widget, "config_gui", 0)