コード例 #1
0
ファイル: web.py プロジェクト: BlaXpirit/steam-notifier
def found_login_url(url):
    if not url.path().startswith('/login'):
        return False
    
    stop()
    
    global page, view, running
    page = qu(QWebPage, network_access_manager=nam)

    def load_progress(progress):
        qu(view, window_title=page.mainFrame().url().toString())
    
    def load_finished(ok):
        global page, view
        if found_commentnotifications_url(page.mainFrame().url()):
            view.close()
    
    qu(page, load_progress=load_progress, load_finished=load_finished)

    view = qu(QWebView, page=page, window_title="Steam Notifier")
    page.mainFrame().load(url)
    if not running:
        view.show()
    running = False
    return True
コード例 #2
0
ファイル: __init__.py プロジェクト: BlaXpirit/steam-notifier
def update_menu(categories, comments):
    tray_menu.clear()
    
    for kind, category in categories.items():
        if not category.count:
            continue
        add_to(tray_menu, make_action(category.text,
            triggered=lambda category=category: category_click(category))
        )
        if kind == 'comments':
            for group, gr_comments in group_comments(comments).items():
                if group:
                    add_to(tray_menu, make_action('    {}:'.format(group),
                        triggered=lambda category=category: category_click(category))
                    )
                for comment in gr_comments:
                    add_to(tray_menu, make_action(u'        \u2022 {}'.format(comment.text),
                        triggered=lambda comment=comment: comment_click(comment), tool_tip=comment.tooltip)
                    )
            add_to(tray_menu, None)
    
    if not tray_menu.isEmpty():
        add_to(tray_menu, None)
        add_to(tray_menu, options_menu)
        qu(tray_icon, context_menu=tray_menu)
    else:
        qu(tray_icon, context_menu=options_menu)
コード例 #3
0
ファイル: web.py プロジェクト: BlaXpirit/steam-notifier
 def load_progress(progress):
     qu(view, window_title=page.mainFrame().url().toString())
コード例 #4
0
ファイル: web.py プロジェクト: BlaXpirit/steam-notifier
# along with Steam Notifier.  If not, see <http://www.gnu.org/licenses/>.


import qt
from qt.network import QNetworkAccessManager, QNetworkRequest
from qt.webkit import QWebPage, QWebView
from qt.core import QTimer, QUrl

from qt.util import qu

from .cookies import PersistentCookieJar
from .parse import parse_commentnotifications


cookie_jar = PersistentCookieJar('settings/cookies.txt')
nam = qu(QNetworkAccessManager, cookie_jar=cookie_jar)

running = False

def found_login_url(url):
    if not url.path().startswith('/login'):
        return False
    
    stop()
    
    global page, view, running
    page = qu(QWebPage, network_access_manager=nam)

    def load_progress(progress):
        qu(view, window_title=page.mainFrame().url().toString())
    
コード例 #5
0
ファイル: __init__.py プロジェクト: BlaXpirit/steam-notifier
def make_action(text, **kwargs):
    return qu(QAction, text, tray_icon, **kwargs)
コード例 #6
0
ファイル: __init__.py プロジェクト: BlaXpirit/steam-notifier
__version__ = '0.2.7'

import sys
import os
import collections
import re

import qt; qt.init()
from qt.core import QRectF, QUrl, QTimer, QSize
from qt.gui import QImage, QPixmap, QIcon, QColor, QPainter, QFont, QDesktopServices, QCursor
from qt.widgets import QSystemTrayIcon, QMenu, QAction, QApplication, QMessageBox
from qt.util import qu, add_to



app = qu(QApplication, sys.argv, quit_on_last_window_closed=False)


from . import web, api


empty_images = {12: QPixmap('resources/empty_12.png'), 20: QPixmap('resources/empty_20.png')}


tray_icon = QSystemTrayIcon()

def make_action(text, **kwargs):
    return qu(QAction, text, tray_icon, **kwargs)


def about():