import string import hashlib import time import gtk import cPickle import threading import Queue import socket socket.setdefaulttimeout(30) from xml.etree import ElementTree as ET from settings import Settings from misc import new_logger from libs import facebook log = new_logger("libpms.py") class ThreadedAppEngineRequest(threading.Thread): """ Creates a new thread for a request to the server """ def __init__(self, gae_conn_obj, data, mapping, auto_now, get_avatar, queue): self.gae_conn_obj = gae_conn_obj self.data = data self.mapping = mapping self.auto_now = auto_now self.queue = queue self.get_avatar = get_avatar threading.Thread.__init__(self)
from libs import facebook import webbrowser import cPickle import time import libpms import Queue import gtk from settings import Settings from misc import new_logger log = new_logger("facebookstatus.py") class FaceBookStatus(object): def __init__(self, parent): self.parent = parent self.db = self.parent.user_db self.queue = Queue.Queue() self.api_key = "26d3226223a91268db2a4915cd7e0b69" self.secret_key = "d5077b8ef8ca5b1e948ec16ed3fc7e0c" self.fb = facebook.Facebook(self.api_key, self.secret_key) self.new_session() def new_session(self, update=False): auth_values = self.db.cursor.execute("""select session_key, uid, expiry, last_time, offline_access, publish_stream from facebook where username=?""", (Settings.USERNAME,)).fetchone() if auth_values is not None and update is False: log.debug("Authorised user") self.fb.session_key = auth_values[0]
#pms is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #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 pms. If not, see http://www.gnu.org/licenses/ import sqlite3 from xml.etree import ElementTree as ET import time import libpms import datetime from misc import new_logger from settings import Settings log = new_logger("database.py") class DB(object): def __init__(self, db_name): self.db = sqlite3.Connection(db_name) self.cursor = self.db.cursor() def close_connection(self): self.db.close() def create_tables(self, table_list): for query in table_list: self.cursor.execute(query) self.db.commit()
import webbrowser from cgi import escape from PIL import Image import db import groups import login import preferences import misc import notification import facebookstatus from settings import Settings from misc import new_logger import ircclient log = new_logger("main.py") class PMS(object): def __init__(self, gae_conn, user_db): self.wTree = gtk.glade.XML(Settings.GLADE + "main.glade") self.wTree.signal_autoconnect(self) self.gae_conn = gae_conn self.user_db = user_db self.preferences = preferences.Preferences() self.wTree.get_widget("notifications").set_active(self.preferences.popup) self.wTree.get_widget("username_label").set_text("Logged in as " + Settings.USERNAME) self.main_window = self.wTree.get_widget("window") self.main_window.show() self.main_window.set_icon_from_file(Settings.LOGO1) self.right_click_menu = self.wTree.get_widget("right_click_menu")
#GNU General Public License for more details. # #You should have received a copy of the GNU General Public License #along with pms. If not, see http://www.gnu.org/licenses/ import os import time import cPickle import hashlib import gtk import gtk.glade import pygtk import pango import gobject from settings import Settings from misc import new_logger, nicetime log = new_logger("group.py") class GroupWindow(): def __init__(self, parent): self.parent = parent self.wTree = gtk.glade.XML(Settings.GLADE + "group.glade") self.wTree.signal_autoconnect(self) self.wTree.get_widget("group_error").set_text("Loading groups") self.grouplist_file = Settings.HOME + "grouplist_" + Settings.USERNAME self.columns = ["Name", "Owner", "Description", "password", "membership", "Password?", "Member?"] self.wTree.get_widget("window").set_icon_from_file(Settings.LOGO1) self.group_list = self.check_for_old_grouplist() self.group_liststore = gtk.ListStore(str, str, str, bool, bool, gtk.gdk.Pixbuf, gtk.gdk.Pixbuf) if not self.group_list: self.group_list = self.new_grouplist()
#You should have received a copy of the GNU General Public License #along with pms. If not, see http://www.gnu.org/licenses/ import os import shutil import cPickle import gtk import pygtk import gtk.glade import urllib import time import gobject import sys from settings import Settings from misc import new_logger log = new_logger("Preferences.py") class PreferencesWindow(object): def __init__(self, parent): self.parent = parent self.preferences = self.parent.preferences self.wTree = gtk.glade.XML(Settings.GLADE + "preferences.glade") self.wTree.signal_autoconnect(self) self.set_gui() self.new_avatar = False self.thumb_path = os.path.join(Settings.HOME, "thumbnails", "temp.thumbnail") def set_gui(self): self.wTree.get_widget("msg_check").set_value(self.preferences.msg_check)
#along with pms. If not, see http://www.gnu.org/licenses/ import hashlib import os import time import gtk import gtk.glade import pygtk pygtk.require20() import re import libpms import db import main import cPickle from settings import Settings from misc import new_logger log = new_logger("login.py") class Login(object): def __init__(self, new_user=False): self.wTree = gtk.glade.XML(Settings.GLADE + "login.glade") self.wTree.signal_autoconnect(self) self.gae_conn = libpms.AppEngineConnection() self.db = db.UserDB(Settings.HOME + "usersDB") user_details = self.db.return_user_details() self.login_auto_completer() if user_details is None or new_user is True: log.info("No previous user found") self.wTree.get_widget("login_window").show() else: log.info("Previous user found: %s" % user_details[0])