From 637ba7a502694581afa009cfcba9022b53c2be26 Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Sat, 20 Feb 2016 05:28:10 +0000 Subject: [PATCH] added steam.client features to docs * various other docs alterations * moved games played under features.misc --- docs/.gitignore | 1 + docs/api/steam.client.features.rst | 21 +++++++++++++++++++ docs/api/steam.client.gc.rst | 7 +++++++ docs/api/steam.client.rst | 13 ++++-------- docs/api/steam.rst | 11 +++++----- docs/index.rst | 17 +++++++--------- docs/{quick_start.rst => user_guide.rst} | 4 ++-- steam/__init__.py | 4 ++-- steam/client/__init__.py | 19 ----------------- steam/client/features/__init__.py | 8 +++++++- steam/client/features/misc.py | 26 ++++++++++++++++++++++++ steam/client/features/user.py | 4 ++++ steam/client/gc.py | 2 +- steam/enums/common.py | 12 +++++++++++ 14 files changed, 99 insertions(+), 50 deletions(-) create mode 100644 docs/api/steam.client.features.rst create mode 100644 docs/api/steam.client.gc.rst rename docs/{quick_start.rst => user_guide.rst} (99%) create mode 100644 steam/client/features/misc.py create mode 100644 steam/client/features/user.py diff --git a/docs/.gitignore b/docs/.gitignore index 72a070f..cb18242 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,3 +1,4 @@ +_build _doc _static _templates diff --git a/docs/api/steam.client.features.rst b/docs/api/steam.client.features.rst new file mode 100644 index 0000000..5ea2de8 --- /dev/null +++ b/docs/api/steam.client.features.rst @@ -0,0 +1,21 @@ +steam.client.features +===================== + +.. automodule:: steam.client.features + +User +---- + +.. automodule:: steam.client.features.user + :members: + :undoc-members: + :show-inheritance: + +Misc +---- + +.. automodule:: steam.client.features.misc + :members: + :undoc-members: + :show-inheritance: + diff --git a/docs/api/steam.client.gc.rst b/docs/api/steam.client.gc.rst new file mode 100644 index 0000000..0e098cf --- /dev/null +++ b/docs/api/steam.client.gc.rst @@ -0,0 +1,7 @@ +steam.client.gc +=============== + +.. automodule:: steam.client.gc + :members: + :show-inheritance: + diff --git a/docs/api/steam.client.rst b/docs/api/steam.client.rst index 09f0c33..d8fc019 100644 --- a/docs/api/steam.client.rst +++ b/docs/api/steam.client.rst @@ -1,15 +1,10 @@ steam.client ============ -.. automodule:: steam.client - :members: - :show-inheritance: - -steam.client.gc ---------------- +.. toctree:: + steam.client.features + steam.client.gc -.. automodule:: steam.client.gc +.. automodule:: steam.client :members: :show-inheritance: - - diff --git a/docs/api/steam.rst b/docs/api/steam.rst index 4875be3..0004786 100644 --- a/docs/api/steam.rst +++ b/docs/api/steam.rst @@ -1,18 +1,17 @@ steam ===== -.. automodule:: steam - :members: - :undoc-members: - :show-inheritance: - .. toctree:: - steam.client steam.core steam.enums steam.util +.. automodule:: steam + :members: + :undoc-members: + :show-inheritance: + steam.steamid ------------- diff --git a/docs/index.rst b/docs/index.rst index 369c464..fb5078f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,3 +1,5 @@ +:tocdepth: 10 + .. include:: global.rst ``steam`` module documentation @@ -8,6 +10,8 @@ A python module for intracting with various parts of Steam_. +Visit the `Github repository `_. + .. note:: The module is still very much an alpha. API can change without warning @@ -27,22 +31,15 @@ To install the current dev version from `Github repository `_. - -Table of contents -================= +Contents +======== .. toctree:: :maxdepth: 3 - quick_start + user_guide api/index - Indices and tables ================== diff --git a/docs/quick_start.rst b/docs/user_guide.rst similarity index 99% rename from docs/quick_start.rst rename to docs/user_guide.rst index a21b47a..bdd197d 100644 --- a/docs/quick_start.rst +++ b/docs/user_guide.rst @@ -1,7 +1,7 @@ .. include:: global.rst -Quick start -*********** +User guide +********** Welcome to the quick start section. The aim here is to give you a very quick diff --git a/steam/__init__.py b/steam/__init__.py index 2d9fa5c..0d1f8b4 100644 --- a/steam/__init__.py +++ b/steam/__init__.py @@ -1,7 +1,7 @@ -__version__ = "0.6.1" +__version__ = "0.6.2" __author__ = "Rossen Georgiev" -version_info = (0, 6, 1) +version_info = (0, 6, 2) from steam.steamid import SteamID from steam.webapi import WebAPI diff --git a/steam/client/__init__.py b/steam/client/__init__.py index 767d7d4..ae8cc87 100644 --- a/steam/client/__init__.py +++ b/steam/client/__init__.py @@ -356,22 +356,3 @@ class SteamClient(EventEmitter, FeatureBase): """ while True: gevent.sleep(300) - - def games_played(self, app_ids): - """ - Set the application being played by the user - - :param app_ids: a list of application ids - :type app_ids: :class:`list` - """ - if not isinstance(app_ids, list): - raise ValueError("Expected app_ids to be of type list") - - app_ids = map(int, app_ids) - - message = MsgProto(EMsg.ClientGamesPlayed) - GamePlayed = message.body.GamePlayed - - message.body.games_played.extend(map(lambda x: GamePlayed(game_id=x), app_ids)) - - self.send(message) diff --git a/steam/client/features/__init__.py b/steam/client/features/__init__.py index 82215f1..f1a8580 100644 --- a/steam/client/features/__init__.py +++ b/steam/client/features/__init__.py @@ -1,4 +1,10 @@ -class FeatureBase(object): +""" +All high level features of :class:`steam.client.SteamClient` are here in seperate submodules. +""" +from steam.client.features.misc import Misc +from steam.client.features.user import User + +class FeatureBase(Misc, User): """ This object is used as base to implement all high level functionality. The features are seperated into submodules. diff --git a/steam/client/features/misc.py b/steam/client/features/misc.py new file mode 100644 index 0000000..3c85786 --- /dev/null +++ b/steam/client/features/misc.py @@ -0,0 +1,26 @@ +""" +Various features that don't have a category +""" + +class Misc(object): + def __init__(self): + super(Misc, self).__init__() + + def games_played(self, app_ids): + """ + Set the application being played by the user + + :param app_ids: a list of application ids + :type app_ids: :class:`list` + """ + if not isinstance(app_ids, list): + raise ValueError("Expected app_ids to be of type list") + + app_ids = map(int, app_ids) + + message = MsgProto(EMsg.ClientGamesPlayed) + GamePlayed = message.body.GamePlayed + + message.body.games_played.extend(map(lambda x: GamePlayed(game_id=x), app_ids)) + + self.send(message) diff --git a/steam/client/features/user.py b/steam/client/features/user.py new file mode 100644 index 0000000..7985aa1 --- /dev/null +++ b/steam/client/features/user.py @@ -0,0 +1,4 @@ + +class User(object): + def __init__(self): + super(User, self).__init__() diff --git a/steam/client/gc.py b/steam/client/gc.py index 44e1fbb..912ed03 100644 --- a/steam/client/gc.py +++ b/steam/client/gc.py @@ -1,5 +1,5 @@ """ -Example usage for messeages to the Dota 2 GC. +Example usage for messages to the Dota 2 GC. .. code:: python diff --git a/steam/enums/common.py b/steam/enums/common.py index f9b1c11..8218d6a 100644 --- a/steam/enums/common.py +++ b/steam/enums/common.py @@ -6,6 +6,7 @@ __all__ = [ 'EType', 'EServerType', 'EOSType', + 'EPersonaState', ] @@ -257,3 +258,14 @@ class EOSType(SteamIntEnum): WinMAX = 15 Max = 26 + + +class EPersonaState(SteamIntEnum): + Offline = 0 + Online = 1 + Busy = 2 + Away = 3 + Snooze = 4 + LookingToTrade = 5 + LookingToPlay = 6 + Max = 7