code
stringlengths
1
1.72M
language
stringclasses
1 value
''' Created on Mar 14, 2010 @author: ivan ''' from foobnix.window.window_controller import WindowController from foobnix.player.player_controller import PlayerController from foobnix.playlist.playlist_controller import PlaylistCntr from foobnix.player.player_widgets_cntr import PlayerWidgetsCntl from foobnix.directory...
Python
''' Created on Mar 14, 2010 @author: ivan ''' import gtk.glade import gettext class AppView(): gladeMain = "foobnix/glade/foobnix.glade" gladePref = "foobnix/glade/preferences.glade" def __init__(self): self.gxMain = self.glade_XML(self.gladeMain, "foobnixWindow") self....
Python
''' Created on Mar 14, 2010 @author: ivan ''' from foobnix.util.confguration import FConfiguration class AppConfigurationCntrl(): def __init__(self, gxMain, directoryCntr): self.directoryCntr = directoryCntr self.folderChoser = gxMain.get_widget("music_dir_filechooserbutton") self.folderCho...
Python
''' Created on Mar 14, 2010 @author: ivan ''' from foobnix.util.confguration import FConfiguration class OnLoadExitAppCntr(): def __init__(self, playlistCntr, playerWidgets, playerCntr, directoryCntr, appConfCntr, radioListCntr, virtualListCntr): self.directoryCntr = directoryCntr self.playlistCntr...
Python
''' Created on Mar 13, 2010 @author: ivan ''' import gtk import os.path class TrayIcon: def __init__(self, gxTryIcon, windowController, playerController, playerWidgets): self.windowController = windowController self.playerController = playerController self.playerWidgets = playerWidgets ...
Python
''' Created on Mar 13, 2010 @author: ivan ''' import gtk from foobnix.util.confguration import VERSION class WindowController(): def __init__(self, gxMain, gxAbout, prefCntr): self.decorate(gxMain) self.prefCntr = prefCntr self.window = gxMain.get_widget("foob...
Python
#!/usr/bin/env python import os, glob, shutil from distutils.core import setup, Extension from foobnix.util.confguration import VERSION def capture(cmd): return os.popen(cmd).read().strip() def removeall(path): if not os.path.isdir(path): return files = os.listdir(path) for x in files: ...
Python
#!/usr/bin/env python ''' Created on Mar 10, 2010 @author: ivan ''' import os import gtk import gettext from foobnix.application.app_view import AppView from foobnix.application.app_controller import AppController class App(): def __init__(self): v = AppView() AppController(v) if __name...
Python
# -*- coding: utf-8 -*- # lyricwiki.py # # Copyright 2009 Amr Hassan <amr.hassan@gmail.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either v...
Python
''' Created on Mar 21, 2010 @author: ivan ''' import time import thread class DemoThread: def __init__(self): self.result = 0 self.playerThreadId = thread.start_new_thread(self.calc, (10,)) print "RESULT", self.result time.sleep(3) print "RESULT", self.res...
Python
#!/usr/bin/env python import sys, os, glob, shutil from distutils.core import setup from foobnix.util.configuration import VERSION, FOOBNIX_TMP, FOOBNIX_TMP_RADIO root_dir = '' for a in sys.argv[1:]: if a.find('--root') == 0: root_dir = a[7:] print "RADIO", FOOBNIX_TMP, FOOBNIX_TMP_RADIO if not os.p...
Python
#!/usr/bin/env python ''' Created on Mar 10, 2010 @author: ivan ''' import gobject import gtk from foobnix.util.dbus_utils import DBusManager, getFoobnixDBusInterface import sys import time import os import thread class Foobnix(): def __init__(self): from foobnix.application.app_view import AppView ...
Python
''' Created on 7 2010 @author: ivan ''' from __future__ import with_statement from foobnix.model.entity import CommonBean import os from foobnix.util.time_utils import normilize_time from foobnix.util import LOG, file_utils import chardet import re from foobnix.util.image_util import get_image_by_path ''' Created on ...
Python
''' Created on Aug 26, 2010 @author: ivan ''' import gtk class Popup(): def __init__(self): self.menu = gtk.Menu() def get_menu(self): return self.menu def add_item(self, text, gtk_stock, func, arg=None): item = gtk.ImageMenuItem(text) ...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' import gtk def responseToDialog(entry, dialog, response): dialog.response(response) def one_line_dialog(dialog_title, text=None): dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PA...
Python
''' Created on Sep 28, 2010 @author: ivan ''' import gtk import urllib from foobnix.util import LOG class CoverImage(gtk.Image): def __init__(self): gtk.Image.__init__(self) self.size = 150; self.set_no_image() def set_no_image(self): image_name = "blank-disc-cut.jpg" ...
Python
''' Created on Sep 27, 2010 @author: ivan ''' import gtk from foobnix.util import LOG class MyToolbar(gtk.Toolbar): def __init__(self): gtk.Toolbar.__init__(self) self.show() self.set_style(gtk.TOOLBAR_ICONS) self.set_show_arrow(False) self.set_icon_size(gtk.ICON...
Python
#-*- coding: utf-8 -*- ''' Created on 30 авг. 2010 @author: ivan ''' import gtk def tab_close_button(func=None, arg=None): """button""" button = gtk.Button() button.set_relief(gtk.RELIEF_NONE) img = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) button.set_image(img) if func: ...
Python
''' Created on Sep 23, 2010 @author: ivan ''' class OneActiveToggledButton(): def __init__(self, buttons): for button in buttons: button.connect("toggled", self.one_button_selected, buttons) def one_button_selected(self, clicked_button, buttons): # so, the button becomes check...
Python
''' Created on Sep 23, 2010 @author: ivan ''' import gtk class ScrolledTreeView(gtk.TreeView): def __init__(self, policy_horizontal, policy_vertical): gtk.TreeView.__init__(self) scrool = gtk.ScrolledWindow() scrool.set_policy(policy_horizontal, policy_vertical) scrool.add_w...
Python
''' Created on Mar 16, 2010 @author: ivan ''' from foobnix.util import LOG ''' Created on Mar 11, 2010 @author: ivan ''' import gtk from foobnix.model.entity import CommonBean class RadioListModel: POS_ICON = 0 POS_TRACK_NUMBER = 1 POS_NAME = 2 POS_PATH = 3 POS_COLOR = 4 POS_INDEX = 5 ...
Python
''' Created on 15 2010 @author: ivan ''' from __future__ import with_statement import os from foobnix.util import LOG from foobnix.util.configuration import FOOBNIX_TMP_RADIO FOOBNIX_DIR = (os.getenv("HOME") or os.getenv('USERPROFILE')) + "/.foobnix" FOOBNIX_DIR_RADIO = FOOBNIX_TMP_RADIO EXTENSION = ".fpl" class...
Python
''' Created on Jul 16, 2010 @author: ivan ''' import urllib2 site = "http://www.screamer-radio.com/" site_full = site + "directory/browsegenre/51/" def load_urls_name_page(): connect = urllib2.urlopen(site_full) data = connect.read() file = open("SKY.FM.fpl", "w") for line in data.split("\n"): ...
Python
''' Created on Sep 10, 2010 @author: ivan ''' import urllib2 from foobnix.util.plsparser import get_radio_source def load_urls_name_page(): file = open("XIPH_ORG.fpl", "w") for i in xrange(7): print "begin" connect = urllib2.urlopen("http://dir.xiph.org/by_format/MP3?search=mp3&page=" +...
Python
# -*- coding: utf-8 -*- ''' Created on Jul 16, 2010 @author: ivan ''' import urllib2 import re site = "http://guzei.com/online_radio/?search=france" def load_urls_name_page(): file = open("GUZEI.COM.fpl", "w") for j in xrange(33): j = j + 1; site ="http://guzei.com/online_rad...
Python
''' Created on Jul 16, 2010 @author: ivan '''
Python
''' Created on 16 2010 @author: ivan ''' import urllib2 site = "http://di.fm" def load_urls_name_page(): connect = urllib2.urlopen(site) data = connect.read() result = {} file = open("DI_FM.fpl", "w") for line in data.split("\n"): pre = '<td><a href="http://listen.di.fm/public3/' ...
Python
''' Created on 16 2010 @author: ivan ''' import urllib2 site = "http://myradio.ua/" def load_urls_name_page(): connect = urllib2.urlopen(site) data = connect.read() result = {} file = open("MYRADIO_UA.fpl", "w") for line in data.split("\n"): line = line.decode("cp1251") pre =...
Python
''' Created on Mar 16, 2010 @author: ivan ''' from foobnix.radio.radio_model import RadioListModel from foobnix.util.plsparser import getStationPath, getPlsName, get_content from foobnix.model.entity import CommonBean from foobnix.util.mouse_utils import is_double_click import urllib2 from foobnix.util import LOG ...
Python
#!/usr/bin/env python # example packbox.py import gtk from foobnix.preferences.configs.music_library import MusicLibraryConfig from foobnix.util.configuration import FConfiguration, get_version from foobnix.preferences.configs.save_online import SaveOnlineConfig from foobnix.preferences.configs.last_fm import LastFmCo...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' import gtk from foobnix.preferences.config_plugin import ConfigPlugin from foobnix.util.configuration import FConfiguration class LastFmConfig(ConfigPlugin): name = _("Last FM") def __init__(self, controls): print "Create t...
Python
#-*- coding: utf-8 -*- ''' Created on 3 сент. 2010 @author: ivan ''' from foobnix.preferences.config_plugin import ConfigPlugin import gtk from foobnix.util.configuration import FConfiguration class NotificationConfig(ConfigPlugin): name = _("Notifications") def __init__(self,controls): print...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' from foobnix.util.configuration import FConfiguration from foobnix.preferences.configs.last_fm import LastFmConfig class VkontakteConfig(LastFmConfig): name = _("Vkontakte") def __init__(self, controls): LastFmConfig.__init...
Python
#-*- coding: utf-8 -*- ''' Created on 1 сент. 2010 @author: ivan ''' from foobnix.preferences.config_plugin import ConfigPlugin import gtk from foobnix.util.configuration import FConfiguration from foobnix.util.proxy_connect import set_proxy_settings import time import urllib2 from foobnix.util import LOG class Networ...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' import gtk from foobnix.preferences.config_plugin import ConfigPlugin class CategoryInfoConfig(ConfigPlugin): name = "Category Info" def __init__(self): print "Craete Category info conf" box = gtk.VBox(False, 0) box.hi...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' from foobnix.preferences.config_plugin import ConfigPlugin import gtk from foobnix.base.base_list_controller import BaseListController from foobnix.helpers.dialog_entry import show_entry_dialog import foobnix.util.localization from foobnix.util impo...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' from foobnix.preferences.config_plugin import ConfigPlugin import gtk from foobnix.util.configuration import FConfiguration from foobnix.helpers.my_widgets import tab_close_label, tab_close_button class TabsConfig(ConfigPlugin): name = _("Ta...
Python
''' Created on Sep 7, 2010 @author: ivan ''' from foobnix.preferences.config_plugin import ConfigPlugin import gtk from foobnix.helpers.menu import Popup from foobnix.util.configuration import FConfiguration import keybinder import os from foobnix.util import LOG import thread from foobnix.util.mouse_utils import is_d...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' import gtk from foobnix.preferences.config_plugin import ConfigPlugin from foobnix.util.configuration import FConfiguration from foobnix.util import LOG class SaveOnlineConfig(ConfigPlugin): name = _("Online Music") def __init__(se...
Python
#-*- coding: utf-8 -*- ''' Created on 29 авг. 2010 @author: ivan ''' from foobnix.preferences.config_plugin import ConfigPlugin import gtk from foobnix.util.configuration import FConfiguration class InfoPagenConfig(ConfigPlugin): name = _("Info panel") def __init__(self, controls): print "Cre...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' import gtk from foobnix.preferences.config_plugin import ConfigPlugin from foobnix.util import const from foobnix.util.configuration import FConfiguration class TrayIconConfig(ConfigPlugin): name = _("Tray Icon") def __init__(self,...
Python
#-*- coding: utf-8 -*- ''' Created on 24 авг. 2010 @author: ivan ''' class ConfigPlugin(): name = 'undefined' widget = None enable = False def show(self): self.widget.show() def hide(self): self.widget.hide() def on_load(self): pass def on_save(se...
Python
#!/usr/bin/env python # example packbox.py import gtk from foobnix.preferences.configs.music_library import MusicLibraryConfig from foobnix.util.configuration import FConfiguration, get_version from foobnix.preferences.configs.save_online import SaveOnlineConfig from foobnix.preferences.configs.last_fm import LastFmCo...
Python
''' Created on 01.06.2010 @author: ivan ''' from foobnix.online.google.search import GoogleSearch import time from foobnix.util import LOG def googleHelp(query): LOG.info("Not Found, wait for results from google ...") results = [] ask = query.encode('utf-8') LOG.info(ask) gs = GoogleSearch(ask, Tr...
Python
''' Created on Jun 10, 2010 @author: ivan ''' from foobnix.util.configuration import FConfiguration from foobnix.util import LOG import os import urllib import thread from foobnix.online.song_resource import update_song_path from mutagen.id3 import ID3NoHeaderError, ID3, TIT2, COMM, TPE1, TENC, TDRC, \ TALB def d...
Python
# -*- coding: utf-8 -*- #TODO: This file is under heavy refactoring, don't touch anything you think is wrong ''' Created on Mar 16, 2010 @author: ivan ''' import os import gtk from gobject import GObject #@UnresolvedImport from foobnix.directory.directory_controller import DirectoryCntr from foobnix.model.entity impo...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-sponsored-links-search/ # # Code is licensed under MIT license. # import re import urllib import random from htmlentitydefs imp...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-search/ # # Code is licensed under MIT license. # import re import urllib from htmlentitydefs import name2codepoint from BeautifulSoup impor...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-sponsored-links-search/ # # Code is licensed under MIT license. # import re import urllib import random from htmlentitydefs imp...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-search/ # # Code is licensed under MIT license. # import re import urllib from htmlentitydefs import name2codepoint from BeautifulSoup impor...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-search/ # # Code is licensed under MIT license. # import random import socket import urllib import urllib2 import httplib B...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-sets/ # # Code is licensed under MIT license. # import re import urllib import random from htmlentitydefs import name2codepoint...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # A Google Python library: # http://www.catonmat.net/blog/python-library-for-google-search/ # # Distributed under MIT license: # # Copyright (c) 2009 Peteris Krumins # # Permission is hereby granted...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-search/ # # Code is licensed under MIT license. # import random import socket import urllib import urllib2 import httplib B...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # A Google Python library: # http://www.catonmat.net/blog/python-library-for-google-search/ # # Distributed under MIT license: # # Copyright (c) 2009 Peteris Krumins # # Permission is hereby granted...
Python
''' Created on 24 Apr 2010 @author: Matik ''' from foobnix.model.entity import CommonBean from foobnix.thirdparty import pylast from foobnix.thirdparty.pylast import WSError from foobnix.util import LOG from foobnix.util.configuration import FConfiguration from foobnix.online.google.translate import transl...
Python
"""Beautiful Soup Elixir and Tonic "The Screen-Scraper's Friend" http://www.crummy.com/software/BeautifulSoup/ Beautiful Soup parses a (possibly invalid) XML or HTML document into a tree representation. It provides methods and Pythonic idioms that make it easy to navigate, search, and modify the tree. A well-formed X...
Python
import urllib import simplejson baseUrl = "http://ajax.googleapis.com/ajax/services/language/translate" def getSplits(text, splitLength=4500): ''' Translate Api has a limit on length of text(4500 characters) that can be translated at once, ''' return (text[index:index + splitLength] for inde...
Python
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-sets/ # # Code is licensed under MIT license. # import re import urllib import random from htmlentitydefs import name2codepoint...
Python
# -*- coding: utf-8 -*- ''' Created on Mar 17, 2010 @author: ivan ''' import urllib2 import urllib import re import time from string import replace from foobnix.util import LOG from foobnix.util.configuration import FConfiguration from foobnix.model.entity import CommonBean from xml.sax.saxutils import unescape fro...
Python
''' Created on 24 Apr 2010 @author: Matik ''' from foobnix.model.entity import CommonBean from foobnix.thirdparty import pylast from foobnix.thirdparty.pylast import WSError from foobnix.util import LOG from foobnix.util.configuration import FConfiguration from foobnix.online.google.translate import transl...
Python
''' Created on 20.04.2010 @author: ivan ''' from foobnix.model.entity import CommonBean import os from foobnix.util import LOG from foobnix.online.vk import Vkontakte from foobnix.util.configuration import FConfiguration try: vk = Vkontakte(FConfiguration().vk_login, FConfiguration().vk_password) except Exceptio...
Python
''' Created on 18.04.2010 @author: ivan ''' from foobnix.util import LOG from foobnix.thirdparty import pylast import urllib import gtk import thread from foobnix.model.entity import CommonBean from foobnix.base.base_list_controller import BaseListController from foobnix.util.configuration import FConfiguration from f...
Python
''' Created on Jun 10, 2010 @author: ivan ''' from foobnix.online.google.search import GoogleSearch from foobnix.util import LOG """Get search result titles from google""" def google_search_resutls(query, results_count=10): results = [] try: LOG.debug("Start google search", query) ask = query.e...
Python
''' Created on Mar 16, 2010 @author: ivan ''' from random import randint from foobnix.util import LOG import random ''' Created on Mar 11, 2010 @author: ivan ''' import gtk from foobnix.model.entity import CommonBean class OnlineListModel: POS_ICON = 0 POS_TRACK_NUMBER = 1 POS_NAME = 2 POS_PATH = 3 ...
Python
''' Created on 25 Apr 2010 @author: Matik ''' from __future__ import with_statement import gtk from gobject import TYPE_NONE, TYPE_PYOBJECT, TYPE_STRING #@UnresolvedImport from foobnix.util import LOG from foobnix.base import BaseController, SIGNAL_RUN_FIRST from threading import Thread from foobnix.onlin...
Python
# -*- coding: utf-8 -*- ''' Created on Mar 18, 2010 @author: ivan ''' import urllib2 import re from string import replace def _engine_search(value): value = replace(value, " ", "+") host = "http://en.vpleer.ru/?q=" + value LOG.info(host) data = urllib2.urlopen(host) return data.read() def get_s...
Python
# -*- coding: utf-8 -*- # lyricwiki.py # # Copyright 2009 Amr Hassan <amr.hassan@gmail.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either v...
Python
#-*- coding: utf-8 -*- ''' Created on Oct 3, 2010 @author: anton.komolov ''' import gtk from foobnix.regui.model.signal import FControl from foobnix.regui.state import LoadSave from foobnix.util.fc import FC from foobnix.regui.model import FModel from foobnix.dm.dm_bean import DMBean class DownloadManager(gtk.Window,...
Python
#-*- coding: utf-8 -*- ''' Created on Oct 4, 2010 @author: anton.komolov ''' import gtk import random import thread import time class DMBean(gtk.HBox): STATE_READY = 0 STATE_DOWNLOAD = 1 STATE_COMPLITE = 2 STATE_STOP_THREAD = 3 def __init__(self, bean, on_clear): gtk.HBox.__init__(self, Fa...
Python
# -*- coding: utf-8 -*- ''' Created on Mar 30, 2010 @author: ivan ''' import gtk from foobnix.util import LOG class PrefListModel(): POS_NAME = 0 def __init__(self, widget, prefListMap): self.widget = widget self.prefListMap = prefListMap self.current_list_model = gtk.ListStore(str) ...
Python
''' Created on Mar 11, 2010 @author: ivan ''' from foobnix.model.entity import CommonBean from foobnix.util import LOG class VirturalLIstCntr(): def __init__(self): self.items = [] def get_items(self): return self.items def get_item_by_index(self, index): ...
Python
''' Created on Mar 11, 2010 @author: ivan ''' import gtk import gobject from foobnix.model.entity import CommonBean from foobnix.util import LOG class DirectoryModel(): POS_NAME = 0 POS_PATH = 1 POS_FONT = 2 POS_VISIBLE = 3 POS_TYPE = 4 POS_INDEX = 5 POS_PARENT = 6 POS_FILTER_CHILD_COU...
Python
# -*- coding: utf-8 -*- ''' Created on Mar 11, 2010 @author: ivan ''' import os from foobnix.util import LOG from foobnix.directory.directory_model import DirectoryModel from foobnix.model.entity import CommonBean from foobnix.util.configuration import FConfiguration from foobnix.util.file_utils import isDirectory...
Python
# ~*~ coding:utf-8 ~*~ # ''' Created on Feb 26, 2010 @author: ivan ''' from mutagen.easyid3 import EasyID3 from mutagen.mp3 import MP3 import os import gtk from foobnix.util.configuration import FConfiguration from mutagen.flac import FLAC from mutagen.apev2 import APEv2 from foobnix.util import LOG import mutagen.mp3...
Python
#-*- coding: utf-8 -*- ''' Created on 11 сент. 2010 @author: ivan ''' import os def get_image_by_path(path): dir = os.path.dirname(path) files = os.listdir(dir) for file in files: if file.lower().endswith(".jpg"): original = file file = file.lower() if file.find(...
Python
import gtk def is_double_click(event): if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS: #@UndefinedVariable return True else: return False def is_double_left_click(event): if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS: #@UndefinedVariable return True ...
Python
#-*- coding: utf-8 -*- ''' Created on 30 авг. 2010 @author: ivan ''' ORDER_LINEAR = "ORDER_LINEAR" ORDER_SHUFFLE = "ORDER_SHUFFLE" ORDER_RANDOM = "ORDER_RANDOM" LOPPING_LOOP_ALL = "LOPPING_LOOP_ALL" LOPPING_SINGLE = "LOPPING_SINGLE" LOPPING_DONT_LOOP = "LOPPING_DONT_LOOP" ON_CLOSE_CLOSE = "ON_CLOSE_CLOSE" ON_CLOSE_...
Python
import commands import os import sys class SingleInstance(): ''' SingleInstance - based on Windows version by Dragan Jovelic this is a Linux version that accomplishes the same task: make sure that only a single instance of an application is running. ''' ...
Python
#-*- coding: utf-8 -*- ''' Created on 23 сент. 2010 @author: ivan ''' import ConfigParser class GlobalConfig(): def __init__(self): config = ConfigParser.RawConfigParser() config.read('foobnix.cfg')
Python
''' Created on Feb 26, 2010 @author: ivan ''' import sys import platform import logging def init(): return None LOG_FILENAME = '/tmp/foobnix.log' LEVELS = {'debug': logging.DEBUG, 'info': logging.INFO, 'warning': logging.WARNING, 'error': logging.ERROR, 'critical'...
Python
''' Created on Jul 27, 2010 @author: ivan ''' import os import ConfigParser from foobnix.util import LOG from foobnix.util.singleton import Singleton class Config: __metaclass__ = Singleton FOOBNIX = "foobnix" SUPPORTED_AUDIO_FORMATS = 'supported_audio_formats' USER_DIR = os.getenv("HOME...
Python
#-*- coding: utf-8 -*- ''' Created on 1 сент. 2010 @author: ivan ''' import urllib2 from foobnix.util.configuration import FConfiguration from foobnix.util import LOG class ProxyPasswordMgr: def __init__(self): self.user = self.passwd = None def add_password(self, realm, uri, user, passwd): sel...
Python
''' Created on Feb 26, 2010 @author: ivan ''' import os def isDirectory(path): return os.path.isdir(path) def get_file_extenstion(fileName): return os.path.splitext(fileName)[1].lower() def file_extenstion(file_name): return os.path.splitext(file_name)[1].lower()
Python
#-*- coding: utf-8 -*- ''' Created on 27 сент. 2010 @author: ivan ''' import thread from threading import Lock from foobnix.util import LOG import time class SingreThread(): def __init__(self, progressbar): self.lock = Lock() self.progressbar = progressbar def run(self, method, args=None)...
Python
''' Created on Feb 26, 2010 @author: ivan ''' def convert_ns(time_int): time_int = time_int / 1000000000 time_str = "" if time_int >= 3600: _hours = time_int / 3600 time_int = time_int - (_hours * 3600) time_str = str(_hours) + ":" if time_int >= 600: _mins = time_in...
Python
#-*- coding: utf-8 -*- ''' Created on 23 сент. 2010 @author: ivan ''' import pickle from foobnix.util import LOG, const import os from foobnix.util.singleton import Singleton """Foobnix configuration""" class FC: __metaclass__ = Singleton API_KEY = "bca6866edc9bdcec8d5e8c32f709bea1" API_SECRET = "800adaf...
Python
''' Created on Jul 27, 2010 @author: ivan ''' class Singleton(type): def __call__(self, *args, **kw): if self.instance is None: self.instance = super(Singleton, self).__call__(*args, **kw) return self.instance def __init__(self, name, bases, dict): super(Singleton, self...
Python
#-*- coding: utf-8 -*- ''' Created on 28 сент. 2010 @author: anton.komolov ''' import dbus.service from dbus.mainloop.glib import DBusGMainLoop from foobnix.util.configuration import get_version DBusGMainLoop(set_as_default=True) DBUS_NAME = "org.mpris.foobnix" DBUS_OBJECT_PATH = "/FoobnixObject" MPRIS_ROOT_PATH = "...
Python
''' Created on Mar 3, 2010 @author: ivan ''' import urllib2 from foobnix.util import LOG "Get content of the url" def get_content(url): if not url: return None try: connect = urllib2.urlopen(url) data = connect.read() return data except: LOG.error("INCORREC...
Python
#-*- coding: utf-8 -*- ''' Created on 24 2010 @author: ivan ''' import gettext APP_NAME = "foobnix" gettext.install(APP_NAME, unicode=True) gettext.textdomain(APP_NAME)
Python
# -*- coding: utf-8 -*- ''' Created on Feb 27, 2010 @author: ivan ''' from __future__ import with_statement import os from foobnix.util.singleton import Singleton import tempfile from foobnix.util import const, LOG import gtk import pickle import uuid import random FOOBNIX_TMP = "/usr/share/foobnix" FOOBNIX_TMP_RADIO...
Python
#-*- coding: utf-8 -*- ''' Created on Sep 8, 2010 @author: ivan ''' import gtk from foobnix.regui.model.signal import FControl def label(): label = gtk.Label("–") label.show() return label def empty(): label = gtk.Label(" ") label.show() return label def text(text): label = gtk.Label(...
Python
''' Created on Apr 19, 2010 @author: matik ''' from gobject import GObject, type_register, signal_new #@UnresolvedImport import gobject SIGNAL_RUN_FIRST = gobject.SIGNAL_RUN_FIRST #@UndefinedVariable TYPE_NONE = gobject.TYPE_NONE TYPE_PYOBJECT = gobject.TYPE_PYOBJECT class BaseController(GObje...
Python
''' Created on 20.04.2010 @author: ivan ''' import gtk """Base list controller for similar functional on any listview or treeview""" class BaseListController(): POSITION_NAME = 0 def __init__(self, widget): self.widget = widget self.model = gtk.ListStore(str) self.title = None...
Python
# -*- coding: utf-8 -*- ''' Created on Mar 11, 2010 @author: ivan ''' from foobnix.lyric.lyr import get_lyrics from foobnix.util import LOG, const from foobnix.util.configuration import FConfiguration from foobnix.online.google.translate import translate from foobnix.util.mouse_utils import is_double_click import time...
Python
''' Created on Mar 11, 2010 @author: ivan ''' import os import gst import gtk import time import urllib import thread from foobnix.util.time_utils import convert_ns from foobnix.model.entity import CommonBean from foobnix.util import LOG from foobnix.base import BaseController from foobnix.base import SIGNAL_RUN_FIRS...
Python
''' Created on Mar 11, 2010 @author: ivan ''' import gtk from foobnix.model.entity import CommonBean from foobnix.util import LOG class PlaylistModel: POS_ICON = 0 POS_TRACK_NUMBER = 1 POS_NAME = 2 POS_PATH = 3 POS_COLOR = 4 POS_INDEX = 5 POS_TYPE = 6 def __init__(self, widget): ...
Python
''' Created on Mar 11, 2010 @author: ivan ''' from foobnix.playlist.playlist_model import PlaylistModel from foobnix.model.entity import CommonBean from foobnix.util.mouse_utils import is_double_click from foobnix.player.player_controller import PlayerController from random import randint from foobnix.util.configura...
Python
''' Created on Sep 22, 2010 @author: ivan ''' import gtk from foobnix.util import LOG, const import sys from foobnix.util.fc import FC from foobnix.regui.model.signal import FControl from foobnix.regui.about import about class MenuWidget(FControl): def __init__(self, controls): FControl.__init__(self, con...
Python