示例#1
0
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program 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.
#-------------------------------------------------------------------------------


from PyQt4 import QtCore, QtGui, QtNetwork
import util
import os
from featuredmods import logger

FormClass, BaseClass = util.loadUiType("featuredmods/featuredmods.ui")



class FeaturedModsWidget(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):
        
        BaseClass.__init__(self, *args, **kwargs)        
        
        self.setupUi(self)

        self.client = client
        
        self.currentMod     = None
        self.modFiles       = None
        self.versionFiles   = None
示例#2
0
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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.
#-------------------------------------------------------------------------------

import util
from PyQt4 import QtGui, QtCore
import json
import datetime
from fa import maps

FormClass, BaseClass = util.loadUiType("stats/mapstat.ui")


class LadderMapStat(FormClass, BaseClass):
    '''
    This class list all the maps given by the server, and ask for more details when selected.
    '''
    def __init__(self, client, parent, *args, **kwargs):
        FormClass.__init__(self, client, *args, **kwargs)
        BaseClass.__init__(self, client, *args, **kwargs)

        self.setupUi(self)

        self.parent = parent
        self.client = client
示例#3
0
import config
from config import Settings

from PyQt4 import QtGui, QtCore, QtNetwork

import util
import modvault


logger = logging.getLogger(__name__)

# This contains a complete dump of everything that was supplied to logOutput
debugLog = []


FormClass, BaseClass = util.loadUiType("fa/updater/updater.ui")
class UpdaterProgressDialog(FormClass, BaseClass):
    def __init__(self, parent):
        FormClass.__init__(self, parent)
        BaseClass.__init__(self, parent)
        self.setupUi(self)
        self.logPlainTextEdit.setVisible(False)
        self.adjustSize()
        self.watches = []

    @QtCore.pyqtSlot(str)
    def appendLog(self, text):
        self.logPlainTextEdit.appendPlainText(text)

    @QtCore.pyqtSlot(QtCore.QObject)
    def addWatch(self, watch):
示例#4
0
import os
import fa
import time
import client
import json

LIVEREPLAY_DELAY = 5  #livereplay delay in minutes
LIVEREPLAY_DELAY_TIME = LIVEREPLAY_DELAY * 60  #livereplay delay for time() (in seconds)
LIVEREPLAY_DELAY_QTIMER = LIVEREPLAY_DELAY * 60000  #livereplay delay for Qtimer (in milliseconds)

from replays.replayitem import ReplayItem, ReplayItemDelegate

# Replays uses the new Inheritance Based UI creation pattern
# This allows us to do all sorts of awesome stuff by overriding methods etc.

FormClass, BaseClass = util.loadUiType("replays/replays.ui")


class ReplaysWidget(BaseClass, FormClass):
    SOCKET = 11002
    HOST = "lobby.faforever.com"

    def __init__(self, client):
        super(BaseClass, self).__init__()

        self.setupUi(self)

        #self.replayVault.setVisible(False)
        self.client = client
        client.replaysTab.layout().addWidget(self)
示例#5
0
# (at your option) any later version.
# 
# This program 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.
#-------------------------------------------------------------------------------


from PyQt4 import QtGui, QtCore
from galacticWar import logger
import util
from planetaryReinforcementItem import PlanetaryItem, PlanetaryReinforcementDelegate
import cPickle

FormClass, BaseClass = util.loadUiType("galacticwar/planetaryItems.ui")



class PlanetaryWidget(FormClass, BaseClass):
    def __init__(self, parent, *args, **kwargs):
        logger.debug("GW Temporary item instantiating.")
        BaseClass.__init__(self, *args, **kwargs)
        
        self.setupUi(self)
        self.parent = parent

        self.planetaryDefenseListWidget.setItemDelegate(PlanetaryReinforcementDelegate(self))
        self.parent.planetaryDefenseUpdated.connect(self.processReinforcementInfo)
        self.parent.creditsUpdated.connect(self.updateCreditsCheck)
        
示例#6
0
from PyQt4 import QtCore
import util
from notificatation_system.ns_hook import NsHook
import notificatation_system as ns


class NsHookUserOnline(NsHook):
    def __init__(self):
        NsHook.__init__(self, ns.NotificationSystem.USER_ONLINE)
        self.button.setEnabled(True)
        self.dialog = UserOnlineDialog(self, self.eventType)
        self.button.clicked.connect(self.dialog.show)


FormClass, BaseClass = util.loadUiType("notification_system/user_online.ui")


class UserOnlineDialog(FormClass, BaseClass):
    def __init__(self, parent, eventType):
        BaseClass.__init__(self)
        self.parent = parent
        self.eventType = eventType
        self.setupUi(self)

        # remove help button
        self.setWindowFlags(self.windowFlags()
                            & (~QtCore.Qt.WindowContextHelpButtonHint))

        self.loadSettings()

    def loadSettings(self):
示例#7
0
# -*- coding:utf-8 -*-
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *

import os
from util import loadUiType
from util import DIR

UI_PATH = os.path.join(DIR, "ui", "dialog.ui")

form_class, base_class = loadUiType(UI_PATH)


class NormalDialog(base_class, form_class):
    def __init__(self, parent):
        super(NormalDialog, self).__init__()
        self.parent_window = parent
        self.setupUi(self)
        # Note 不带窗口边框
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.OK_BTN.clicked.connect(self.close)

    def display(self, title, msg):
        # Note 设置标题和输出信息
        self.Title_Label.setText(title)
        self.Message_Label.setText(msg)

        width = self.parent_window.size().width()
        height = self.parent_window.size().height()
示例#8
0
from PyQt4 import QtCore, QtGui, QtWebKit
import util
from stats import mapstat
import client
import time

import logging

logger = logging.getLogger(__name__)

ANTIFLOOD = 0.1

FormClass, BaseClass = util.loadUiType("stats/stats.ui")


class StatsWidget(BaseClass, FormClass):

    #signals
    laddermaplist = QtCore.pyqtSignal(dict)
    laddermapstat = QtCore.pyqtSignal(dict)

    def __init__(self, client):
        super(BaseClass, self).__init__()

        self.setupUi(self)

        self.client = client
        client.ladderTab.layout().addWidget(self)

        self.client.statsInfo.connect(self.processStatsInfos)
示例#9
0
# This program 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.
#-------------------------------------------------------------------------------

from PyQt4 import QtCore
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
import util
import os
import fa
from tutorials.tutorialitem import TutorialItem, TutorialItemDelegate

from tutorials import logger

FormClass, BaseClass = util.loadUiType("tutorials/tutorials.ui")


class tutorialsWidget(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)

        self.client = client
        self.client.tutorialsTab.layout().addWidget(self)

        self.sections = {}
        self.tutorials = {}

        self.client.tutorialsInfo.connect(self.processTutorialInfo)
示例#10
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#-------------------------------------------------------------------------------


from PyQt4 import QtGui, QtCore
import util
from galacticWar import logger
from attackitem import AttackItem
from defenseitem import DefenseItem

from teams.teamswidget import TeamWidget

from galacticWar import FACTIONS

FormClass, BaseClass = util.loadUiType("galacticwar/infopanel.ui")

class InfoPanelWidget(FormClass, BaseClass):
    def __init__(self, parent, *args, **kwargs):
        logger.debug("GW Info panel instantiating.")
        BaseClass.__init__(self, *args, **kwargs)
        
        self.setupUi(self)
        self.parent = parent
        self.galaxy = self.parent.galaxy

        #self.setup()
        self.attackListWidget.hide()
        
        self.planet = None
        
示例#11
0
from teams.teams import Teams
import util
import util.slpp
import fa

import zipfile
import StringIO

from util import GW_TEXTURE_DIR
import json
import os

from types import IntType, FloatType, ListType, DictType
import loginwizards

FormClass, BaseClass = util.loadUiType("galacticwar/galacticwar.ui")

class LobbyWidget(FormClass, BaseClass):
    planetClicked                   = QtCore.pyqtSignal(int)
    hovering                        = QtCore.pyqtSignal()
    creditsUpdated                  = QtCore.pyqtSignal(int)
    rankUpdated                     = QtCore.pyqtSignal(int)
    creditsUpdated                  = QtCore.pyqtSignal(int)
    victoriesUpdated                = QtCore.pyqtSignal(int)
    attacksUpdated                  = QtCore.pyqtSignal()
    planetUpdated                   = QtCore.pyqtSignal(int)
    attackProposalUpdated           = QtCore.pyqtSignal(int)
    ReinforcementUpdated            = QtCore.pyqtSignal(dict)
    planetaryDefenseUpdated         = QtCore.pyqtSignal(dict)
    ReinforcementsGroupUpdated      = QtCore.pyqtSignal(dict)
    ReinforcementsGroupDeleted      = QtCore.pyqtSignal(dict)
示例#12
0
# 
# This program 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.
#-------------------------------------------------------------------------------


from PyQt4 import QtGui, QtCore
from galacticWar import logger
import util
from reinforcementItem import ReinforcementItem, ReinforcementDelegate, ReinforcementGroupDelegate
import cPickle
import pickle

FormClass, BaseClass = util.loadUiType("galacticwar/reinforcementItems.ui")


class groupListWidget(QtGui.QListWidget):
    def __init__(self, parent, group, *args, **kwargs):
        QtGui.QListWidget.__init__(self, *args, **kwargs)
        self.parent = parent
        self.group = group
        self.setMouseTracking(1)
        self.setAutoFillBackground(False)
        self.setAcceptDrops(True)
        
        self.setItemDelegate(ReinforcementGroupDelegate(self.parent))
        self.groupUnits = {}

        self.mouseMoveEvent = self.mouseMove
from PyQt4 import QtCore, QtGui
import util

FormClass, BaseClass = util.loadUiType("friendlist/friendlist.ui")
class FriendListDialog(FormClass, BaseClass):
    def __init__(self, client):
        BaseClass.__init__(self, client)
        self.client = client

        self.setupUi(self)

        self.updateTopLabel()

        self.model = FriendListModel([FriendGroup('online', client), FriendGroup('offline', client)], client)

        proxy = QtGui.QSortFilterProxyModel()
        proxy.setSourceModel(self.model)
        proxy.setSortRole(QtCore.Qt.UserRole)
        self.friendlist.setModel(proxy)

        self.friendlist.header().setStretchLastSection(False);
        self.friendlist.header().resizeSection (1, 48)
        self.friendlist.header().resizeSection (2, 64)
        self.friendlist.header().resizeSection (3, 18)

        # stretch first column
        self.friendlist.header().setResizeMode(0, QtGui.QHeaderView.Stretch)
        self.friendlist.expandAll()

        # Frameless
        #self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint)
示例#14
0
from games._mapSelectWidget import mapSelectWidget
from games import logger
from fa import Faction
import random
import fa
import modvault
import notificatation_system as ns



RANKED_SEARCH_EXPANSION_TIME = 10000 #milliseconds before search radius expands

SEARCH_RADIUS_INCREMENT = 0.05
SEARCH_RADIUS_MAX = 0.25

FormClass, BaseClass = util.loadUiType("games/games.ui")

import functools


class GamesWidget(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):

        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)

        self.client = client
        self.client.gamesTab.layout().addWidget(self)

        #Dictionary containing our actual games.
示例#15
0
from PyQt4 import QtCore, QtGui
import util
import secondaryServer

from tourneys.tourneyitem import TourneyItem, TourneyItemDelegate

FormClass, BaseClass = util.loadUiType("tournaments/tournaments.ui")


class TournamentsWidget(FormClass, BaseClass):
    ''' list and manage the main tournament lister '''
    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)

        self.client = client
        self.client.tourneyTab.layout().addWidget(self)

        #tournament server
        self.tourneyServer = secondaryServer.SecondaryServer(
            "Tournament", 11001, self)
        self.tourneyServer.setInvisible()

        #Dictionary containing our actual tournaments.
        self.tourneys = {}

        self.tourneyList.setItemDelegate(TourneyItemDelegate(self))

        self.tourneyList.itemDoubleClicked.connect(self.tourneyDoubleClicked)
示例#16
0
import config
from config import Settings
from notifications.ns_hook import NsHook
import notifications as ns

"""
Settings for notifications: if a player comes online
"""
class NsHookUserOnline(NsHook):
    def __init__(self):
        NsHook.__init__(self, ns.Notifications.USER_ONLINE)
        self.button.setEnabled(True)
        self.dialog = UserOnlineDialog(self, self.eventType)
        self.button.clicked.connect(self.dialog.show)

FormClass, BaseClass = util.loadUiType("notification_system/user_online.ui")
class UserOnlineDialog(FormClass, BaseClass):
    def __init__(self, parent, eventType):
        BaseClass.__init__(self)
        self.parent = parent
        self.eventType = eventType
        self._settings_key = 'notifications/{}'.format(eventType)
        self.setupUi(self)

        # remove help button
        self.setWindowFlags(self.windowFlags() & (~QtCore.Qt.WindowContextHelpButtonHint))

        self.loadSettings()


    def loadSettings(self):
示例#17
0



import util
from PyQt4 import QtGui, QtCore
import json
import datetime
from fa import maps

FormClass, BaseClass = util.loadUiType("stats/mapstat.ui")

class LadderMapStat(FormClass, BaseClass):
    '''
    This class list all the maps given by the server, and ask for more details when selected.
    '''
    def __init__(self, client, parent, *args, **kwargs):
        FormClass.__init__(self, client, *args, **kwargs)
        BaseClass.__init__(self, client, *args, **kwargs)

        self.setupUi(self)
        
        self.parent = parent
        self.client = client
        
        self.mapid = 0

        # adding ourself to the stat tab

        self.parent.laddermapTab.layout().addWidget(self)
示例#18
0
from PyQt4 import QtCore, QtGui
import util
import secondaryServer

from tourneys.tourneyitem import TourneyItem, TourneyItemDelegate


FormClass, BaseClass = util.loadUiType("tournaments/tournaments.ui")


class TournamentsWidget(FormClass, BaseClass):
    ''' list and manage the main tournament lister '''
    
    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)        
        
        self.setupUi(self)

        self.client = client
        self.client.tourneyTab.layout().addWidget(self)
        
        #tournament server
        self.tourneyServer = secondaryServer.SecondaryServer("Tournament", 11001, self)
        self.tourneyServer.setInvisible()

        #Dictionary containing our actual tournaments.
        self.tourneys = {}
  
        self.tourneyList.setItemDelegate(TourneyItemDelegate(self))
        
示例#19
0
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest

from games.gameitem import GameItem, GameItemDelegate
from coop.coopmapitem import CoopMapItem, CoopMapItemDelegate
from games.hostgamewidget import HostgameWidget
from games import logger
from fa import Faction
import random
import fa
import modvault
import os



FormClass, BaseClass = util.loadUiType("coop/coop.ui")


class CoopWidget(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):
        
        BaseClass.__init__(self, *args, **kwargs)        
        
        self.setupUi(self)

        self.client = client
        self.client.coopTab.layout().addWidget(self)
        
        #Dictionary containing our actual games.
        self.games = {}
        
示例#20
0
# (at your option) any later version.
#
# This program 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.
#-------------------------------------------------------------------------------

from PyQt4 import QtGui, QtCore
from galacticWar import logger
import util
from reinforcementItem import ReinforcementItem, ReinforcementDelegate, ReinforcementGroupDelegate
import cPickle
import pickle

FormClass, BaseClass = util.loadUiType("galacticwar/reinforcementItems.ui")


class groupListWidget(QtGui.QListWidget):
    def __init__(self, parent, group, *args, **kwargs):
        QtGui.QListWidget.__init__(self, *args, **kwargs)
        self.parent = parent
        self.group = group
        self.setMouseTracking(1)
        self.setAutoFillBackground(False)
        self.setAcceptDrops(True)

        self.setItemDelegate(ReinforcementGroupDelegate(self.parent))
        self.groupUnits = {}

        self.mouseMoveEvent = self.mouseMove
示例#21
0
from PyQt4 import QtCore, QtGui
import util, time

"""
The UI popup of the notification system
"""
FormClass, BaseClass = util.loadUiType("notification_system/dialog.ui")
class NotificationDialog(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)
        self.client = client

        self.labelIcon.setPixmap(util.icon("client/tray_icon.png", pix=True).scaled(32, 32))
        self.standardIcon = util.icon("client/comment.png", pix=True)

        screen = QtGui.QDesktopWidget().screenGeometry()
        dialog_size = self.geometry()

        # TODO: more positions
        # bottom right
        self.move(screen.width() - dialog_size.width(), screen.height() - dialog_size.height())

        # Frameless, always on top, steal no focus & no entry at the taskbar
        self.setWindowFlags(QtCore.Qt.ToolTip)

        # TODO: integrate into client.css
        #self.setStyleSheet(self.client.styleSheet())

    @QtCore.pyqtSlot()
示例#22
0
from notifications.ns_hook import NsHook
import notifications as ns
"""
Settings for notifications: if a new game is hosted.
"""


class NsHookNewGame(NsHook):
    def __init__(self):
        NsHook.__init__(self, ns.Notifications.NEW_GAME)
        self.button.setEnabled(True)
        self.dialog = NewGameDialog(self, self.eventType)
        self.button.clicked.connect(self.dialog.show)


FormClass, BaseClass = util.loadUiType("notification_system/new_game.ui")


class NewGameDialog(FormClass, BaseClass):
    def __init__(self, parent, eventType):
        BaseClass.__init__(self)
        self.parent = parent
        self.eventType = eventType
        self._settings_key = 'notifications/{}'.format(eventType)
        self.setupUi(self)

        # remove help button
        self.setWindowFlags(self.windowFlags()
                            & (~QtCore.Qt.WindowContextHelpButtonHint))

        self.loadSettings()
示例#23
0
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program 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.
#-------------------------------------------------------------------------------


from PyQt4 import QtGui, QtCore
from galacticWar import logger
from galacticWar import FACTIONS
import util

FormClass, BaseClass = util.loadUiType("galacticwar/options.ui")

        

class GWOptions(FormClass, BaseClass):
    def __init__(self, parent, *args, **kwargs):
        logger.debug("GW options instantiating.")
        BaseClass.__init__(self, *args, **kwargs)
        
        self.setupUi(self)
        self.parent = parent
        
         
        self.rotation = True
        self.AA = True
示例#24
0
from PyQt4 import QtCore, QtGui
import util
import notificatation_system as ns
from notificatation_system.hook_useronline import NsHookUserOnline
from notificatation_system.ns_hook import NsHook
from notificatation_system.hook_newgame import NsHookNewGame
from notificatation_system.hook_teaminvite import NsHookTeamInvite


FormClass2, BaseClass2 = util.loadUiType("notification_system/ns_settings.ui")
class NsSettingsDialog(FormClass2, BaseClass2):
    def __init__(self, client):
        BaseClass2.__init__(self)
        #BaseClass2.__init__(self, client)

        self.setupUi(self)
        self.client = client

        # remove help button
        self.setWindowFlags(self.windowFlags() & (~QtCore.Qt.WindowContextHelpButtonHint))

        # init hooks
        self.hooks = {}
        self.hooks[ns.NotificationSystem.USER_ONLINE] = NsHookUserOnline()
        self.hooks[ns.NotificationSystem.NEW_GAME] = NsHookNewGame()
        self.hooks[ns.NotificationSystem.TEAM_INVITE] = NsHookTeamInvite()

        model = NotificationHooks(self, self.hooks.values())
        self.tableView.setModel(model)
        # stretch first column
        self.tableView.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.Stretch)
示例#25
0
from PyQt4 import QtCore, QtGui
import util, time
"""
The UI popup of the notification system
"""
FormClass, BaseClass = util.loadUiType("notification_system/dialog.ui")


class NotificationDialog(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)
        self.client = client

        self.labelIcon.setPixmap(
            util.icon("client/tray_icon.png", pix=True).scaled(32, 32))
        self.standardIcon = util.icon("client/comment.png", pix=True)

        screen = QtGui.QDesktopWidget().screenGeometry()
        dialog_size = self.geometry()

        # TODO: more positions
        # bottom right
        self.move(screen.width() - dialog_size.width(),
                  screen.height() - dialog_size.height())

        # Frameless, always on top, steal no focus & no entry at the taskbar
        self.setWindowFlags(QtCore.Qt.ToolTip)

        # TODO: integrate into client.css
示例#26
0
from teams.teams import Teams
import util
import util.slpp
import fa

import zipfile
import StringIO

from util import GW_TEXTURE_DIR
import json
import os

from types import IntType, FloatType, ListType, DictType
import loginwizards

FormClass, BaseClass = util.loadUiType("galacticwar/galacticwar.ui")


class LobbyWidget(FormClass, BaseClass):
    planetClicked = QtCore.pyqtSignal(int)
    hovering = QtCore.pyqtSignal()
    creditsUpdated = QtCore.pyqtSignal(int)
    rankUpdated = QtCore.pyqtSignal(int)
    creditsUpdated = QtCore.pyqtSignal(int)
    victoriesUpdated = QtCore.pyqtSignal(int)
    attacksUpdated = QtCore.pyqtSignal()
    depotUpdated = QtCore.pyqtSignal()
    planetUpdated = QtCore.pyqtSignal(int)
    attackProposalUpdated = QtCore.pyqtSignal(int)
    ReinforcementUpdated = QtCore.pyqtSignal(dict)
    planetaryDefenseUpdated = QtCore.pyqtSignal(dict)
示例#27
0
import json

import config
from config import Settings

from PyQt4 import QtGui, QtCore, QtNetwork

import util
import modvault

logger = logging.getLogger(__name__)

# This contains a complete dump of everything that was supplied to logOutput
debugLog = []

FormClass, BaseClass = util.loadUiType("fa/updater/updater.ui")


class UpdaterProgressDialog(FormClass, BaseClass):
    def __init__(self, parent):
        FormClass.__init__(self, parent)
        BaseClass.__init__(self, parent)
        self.setupUi(self)
        self.logPlainTextEdit.setVisible(False)
        self.adjustSize()
        self.watches = []

    @QtCore.pyqtSlot(str)
    def appendLog(self, text):
        self.logPlainTextEdit.appendPlainText(text)
示例#28
0
from chat.irclib import SimpleIRCClient
import util
import fa

import sys
from chat import logger, user2name
from chat.channel import Channel
import notificatation_system as ns

IRC_PORT = 8167
IRC_SERVER = "irc.faforever.com"
POLLING_INTERVAL = 300   # milliseconds between irc polls
PONG_INTERVAL = 100000   # milliseconds between pongs


FormClass, BaseClass = util.loadUiType("chat/chat.ui")

class ChatWidget(FormClass, BaseClass, SimpleIRCClient):
    '''
    This is the chat lobby module for the FAF client.
    It manages a list of channels and dispatches IRC events (lobby inherits from irclib's client class
    '''
    def __init__(self, client, *args, **kwargs):
        logger.debug("Lobby instantiating.")
        BaseClass.__init__(self, *args, **kwargs)
        SimpleIRCClient.__init__(self)

        self.setupUi(self)


        # CAVEAT: These will fail if loaded before theming is loaded
示例#29
0
from PyQt4 import QtCore, QtGui

import config
from config import Settings
import util
import notifications as ns
from notifications.hook_useronline import NsHookUserOnline
from notifications.hook_newgame import NsHookNewGame

"""
The UI of the Notification System Settings Frame.
Each module/hook for the notification system must be registered here.
"""
# TODO: how to register hooks?
FormClass2, BaseClass2 = util.loadUiType("notification_system/ns_settings.ui")
class NsSettingsDialog(FormClass2, BaseClass2):
    def __init__(self, client):
        BaseClass2.__init__(self)
        #BaseClass2.__init__(self, client)

        self.setupUi(self)
        self.client = client

        # remove help button
        self.setWindowFlags(self.windowFlags() & (~QtCore.Qt.WindowContextHelpButtonHint))

        # init hooks
        self.hooks = {}
        self.hooks[ns.Notifications.USER_ONLINE] = NsHookUserOnline()
        self.hooks[ns.Notifications.NEW_GAME] = NsHookNewGame()
示例#30
0
import urllib2

from PyQt4 import QtCore, QtGui

from util import strtodate, datetostr, now
import util

FormClass, BaseClass = util.loadUiType("modvault/mod.ui")


class ModWidget(FormClass, BaseClass):
    def __init__(self, parent, mod, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)
        self.parent = parent

        self.setStyleSheet(self.parent.client.styleSheet())

        self.setWindowTitle(mod.name)

        self.mod = mod

        self.Title.setText(mod.name)
        self.Description.setText(mod.description)
        modtext = ""
        if mod.isuimod: modtext = "UI mod\n"
        self.Info.setText(modtext + "By %s\nUploaded %s" %
                          (mod.author, str(mod.date)))
        if mod.thumbnail == None:
            self.Picture.setPixmap(util.pixmap("games/unknown_map.png"))
示例#31
0
from PyQt4 import QtCore, QtGui
import util

from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest

from games.gameitem import GameItem, GameItemDelegate
from coop.coopmapitem import CoopMapItem, CoopMapItemDelegate
from games.hostgamewidget import HostgameWidget
from games import logger
from fa import Faction
import random
import fa
import modvault
import os

FormClass, BaseClass = util.loadUiType("coop/coop.ui")


class CoopWidget(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):

        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)

        self.client = client
        self.client.coopTab.layout().addWidget(self)

        #Dictionary containing our actual games.
        self.games = {}
示例#32
0
from PyQt4 import QtCore
import util
from notificatation_system.ns_hook import NsHook
import notificatation_system as ns


class NsHookNewGame(NsHook):
    def __init__(self):
        NsHook.__init__(self, ns.NotificationSystem.NEW_GAME)
        self.button.setEnabled(True)
        self.dialog = NewGameDialog(self, self.eventType)
        self.button.clicked.connect(self.dialog.show)

FormClass, BaseClass = util.loadUiType("notification_system/new_game.ui")
class NewGameDialog(FormClass, BaseClass):
    def __init__(self, parent, eventType):
        BaseClass.__init__(self)
        self.parent = parent
        self.eventType = eventType
        self.setupUi(self)

        # remove help button
        self.setWindowFlags(self.windowFlags() & (~QtCore.Qt.WindowContextHelpButtonHint))

        self.loadSettings()


    def loadSettings(self):
        util.settings.beginGroup("notification_system")
        util.settings.beginGroup(self.eventType)
        self.mode = util.settings.value('mode', 'friends')
示例#33
0
import util
import fa

import sys
import chat
from chat import user2name, parse_irc_source
from chat.channel import Channel
from chat.irclib import SimpleIRCClient
import notifications as ns

IRC_PORT = 8167
IRC_SERVER = "irc.faforever.com"
POLLING_INTERVAL = 300  # milliseconds between irc polls
PONG_INTERVAL = 100000  # milliseconds between pongs

FormClass, BaseClass = util.loadUiType("chat/chat.ui")


class ChatWidget(FormClass, BaseClass, SimpleIRCClient):
    use_chat = Settings.persisted_property('chat/enabled',
                                           type=bool,
                                           default_value=True)
    '''
    This is the chat lobby module for the FAF client.
    It manages a list of channels and dispatches IRC events (lobby inherits from irclib's client class)
    '''
    def __init__(self, client, *args, **kwargs):
        if not self.use_chat:
            logger.info("Disabling chat")
            return
示例#34
0
# This program 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.
#-------------------------------------------------------------------------------



import urllib2

from PyQt4 import QtCore, QtGui

import modvault
import util

FormClass, BaseClass = util.loadUiType("modvault/uimod.ui")


class UIModWidget(FormClass, BaseClass):
    FORMATTER_UIMOD = unicode(util.readfile("modvault/uimod.qthtml"))
    def __init__(self, parent, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)
        self.parent = parent
        
        self.setStyleSheet(self.parent.client.styleSheet())
        
        self.setWindowTitle("Ui Mod Manager")

        self.doneButton.clicked.connect(self.doneClicked)
示例#35
0
import client
import json

import logging
logger = logging.getLogger(__name__)

LIVEREPLAY_DELAY = 5 #livereplay delay in minutes
LIVEREPLAY_DELAY_TIME = LIVEREPLAY_DELAY * 60 #livereplay delay for time() (in seconds)
LIVEREPLAY_DELAY_QTIMER = LIVEREPLAY_DELAY * 60000 #livereplay delay for Qtimer (in milliseconds)

from replays.replayitem import ReplayItem, ReplayItemDelegate

# Replays uses the new Inheritance Based UI creation pattern
# This allows us to do all sorts of awesome stuff by overriding methods etc.

FormClass, BaseClass = util.loadUiType("replays/replays.ui")

class ReplaysWidget(BaseClass, FormClass):
    SOCKET  = 11002
    HOST    = "lobby.faforever.com"
    
    def __init__(self, client):
        super(BaseClass, self).__init__()

        self.setupUi(self)

        #self.replayVault.setVisible(False)
        self.client = client
        client.replaysTab.layout().addWidget(self)
        
        client.gameInfo.connect(self.processGameInfo)
示例#36
0
from PyQt4 import QtCore, QtGui
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
from fa.replay import replay
import util
import os
import fa
from tutorials.tutorialitem import TutorialItem, TutorialItemDelegate

import logging
logger = logging.getLogger(__name__)

FormClass, BaseClass = util.loadUiType("tutorials/tutorials.ui")


class tutorialsWidget(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):
        BaseClass.__init__(self, *args, **kwargs)        
        
        self.setupUi(self)

        self.client = client
        self.client.tutorialsTab.layout().addWidget(self)    
        
        self.sections = {}
        self.tutorials = {}

        self.client.tutorialsInfo.connect(self.processTutorialInfo)
        
        logger.info("Tutorials instantiated.")
        
        
示例#37
0
from games.hostgamewidget import HostgameWidget

from games._mapSelectWidget import mapSelectWidget
from games import logger
from fa import Faction
import random
import fa
import modvault
import notificatation_system as ns

RANKED_SEARCH_EXPANSION_TIME = 10000  #milliseconds before search radius expands

SEARCH_RADIUS_INCREMENT = 0.05
SEARCH_RADIUS_MAX = 0.25

FormClass, BaseClass = util.loadUiType("games/games.ui")

import functools


class GamesWidget(FormClass, BaseClass):
    def __init__(self, client, *args, **kwargs):

        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)

        self.client = client
        self.client.gamesTab.layout().addWidget(self)

        #Dictionary containing our actual games.
示例#38
0
#-------------------------------------------------------------------------------





from PyQt4 import QtCore, QtGui, QtWebKit
import util
from stats import logger
from stats import mapstat
import client
import time

ANTIFLOOD = 0.1

FormClass, BaseClass = util.loadUiType("stats/stats.ui")

class StatsWidget(BaseClass, FormClass):

    #signals
    laddermaplist = QtCore.pyqtSignal(dict)
    laddermapstat = QtCore.pyqtSignal(dict)
    def __init__(self, client):
        super(BaseClass, self).__init__()

        self.setupUi(self)

        self.client = client
        client.ladderTab.layout().addWidget(self)
        
        self.client.statsInfo.connect(self.processStatsInfos)
示例#39
0
# 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.
#-------------------------------------------------------------------------------

from PyQt4 import QtGui, QtCore
import util
from galacticWar import logger
from attackitem import AttackItem
from defenseitem import DefenseItem

from teams.teamswidget import TeamWidget

from galacticWar import FACTIONS

FormClass, BaseClass = util.loadUiType("galacticwar/infopanel.ui")


class InfoPanelWidget(FormClass, BaseClass):
    def __init__(self, parent, *args, **kwargs):
        logger.debug("GW Info panel instantiating.")
        BaseClass.__init__(self, *args, **kwargs)

        self.setupUi(self)
        self.parent = parent
        self.galaxy = self.parent.galaxy

        #self.setup()
        self.attackListWidget.hide()

        self.planet = None