├── .gitignore ├── .gitmodules ├── .travis.yml ├── README.md ├── appveyor.yml ├── gi_repository ├── __init__.py ├── _constants.py ├── _error.py ├── _gobject │ └── __init__.py ├── _option.py ├── _propertyhelper.py ├── _signalhelper.py ├── docstring.py ├── importer.py ├── module.py ├── overrides │ ├── Dee.py │ ├── GExiv2.py │ ├── GIMarshallingTests.py │ ├── GLib.py │ ├── GObject.py │ ├── Gdk.py │ ├── Gedit.py │ ├── Ggit.py │ ├── Gio.py │ ├── GooCanvas.py │ ├── Gst.py │ ├── GstPbutils.py │ ├── Gtk.py │ ├── Pango.py │ ├── Vips.py │ ├── __init__.py │ └── keysyms.py ├── pygtkcompat.py ├── repository │ └── __init__.py └── types.py ├── lib32 ├── LIBSTEAM.LICENSE ├── _gi.pyd ├── _gi_cairo.pyd ├── girepository-1.0 │ ├── Atk-1.0.typelib │ ├── DBus-1.0.typelib │ ├── DBusGLib-1.0.typelib │ ├── GDesktopEnums-3.0.typelib │ ├── GIRepository-2.0.typelib │ ├── GL-1.0.typelib │ ├── GLib-2.0.typelib │ ├── GModule-2.0.typelib │ ├── GObject-2.0.typelib │ ├── Gdk-3.0.typelib │ ├── GdkPixbuf-2.0.typelib │ ├── GdkWin32-3.0.typelib │ ├── Gio-2.0.typelib │ ├── Gtk-3.0.typelib │ ├── Pango-1.0.typelib │ ├── PangoCairo-1.0.typelib │ ├── Rsvg-2.0.typelib │ ├── cairo-1.0.typelib │ ├── fontconfig-2.0.typelib │ ├── freetype2-2.0.typelib │ ├── libxml2-2.0.typelib │ ├── win32-1.0.typelib │ ├── xfixes-4.0.typelib │ ├── xft-2.0.typelib │ ├── xlib-2.0.typelib │ └── xrandr-1.3.typelib ├── libatk-1.0-0.dll ├── libcairo-gobject-2.dll ├── libffi-6.dll ├── libgdk-3-0.dll ├── libgdk_pixbuf-2.0-0.dll ├── libgio-2.0-0.dll ├── libgirepository-1.0-1.dll ├── libglib-2.0-0.dll ├── libgmodule-2.0-0.dll ├── libgobject-2.0-0.dll ├── libgthread-2.0-0.dll ├── libgtk-3-0.dll ├── libintl-8.dll ├── libpango-1.0-0.dll ├── libpangocairo-1.0-0.dll ├── libpangowin32-1.0-0.dll ├── libpng16-16.dll ├── librsvg-2-2.dll ├── libsteam_api.dll ├── libsteam_api.so ├── libwinpthread-1.dll └── libz.dll ├── lib64 ├── LIBSTEAM.LICENSE ├── _gi.pyd ├── _gi_cairo.pyd ├── girepository-1.0 │ ├── Atk-1.0.typelib │ ├── DBus-1.0.typelib │ ├── DBusGLib-1.0.typelib │ ├── GDesktopEnums-3.0.typelib │ ├── GIRepository-2.0.typelib │ ├── GL-1.0.typelib │ ├── GLib-2.0.typelib │ ├── GModule-2.0.typelib │ ├── GObject-2.0.typelib │ ├── Gdk-3.0.typelib │ ├── GdkPixbuf-2.0.typelib │ ├── GdkWin32-3.0.typelib │ ├── Gio-2.0.typelib │ ├── Gtk-3.0.typelib │ ├── Pango-1.0.typelib │ ├── PangoCairo-1.0.typelib │ ├── Rsvg-2.0.typelib │ ├── cairo-1.0.typelib │ ├── fontconfig-2.0.typelib │ ├── freetype2-2.0.typelib │ ├── libxml2-2.0.typelib │ ├── win32-1.0.typelib │ ├── xfixes-4.0.typelib │ ├── xft-2.0.typelib │ ├── xlib-2.0.typelib │ └── xrandr-1.3.typelib ├── libatk-1.0-0.dll ├── libcairo-gobject-2.dll ├── libffi-6.dll ├── libgdk-3-0.dll ├── libgdk_pixbuf-2.0-0.dll ├── libgio-2.0-0.dll ├── libgirepository-1.0-1.dll ├── libglib-2.0-0.dll ├── libgmodule-2.0-0.dll ├── libgobject-2.0-0.dll ├── libgthread-2.0-0.dll ├── libgtk-3-0.dll ├── libintl-8.dll ├── libpango-1.0-0.dll ├── libpangocairo-1.0-0.dll ├── libpangowin32-1.0-0.dll ├── libpng16-16.dll ├── librsvg-2-2.dll ├── libsteam_api.dll ├── libsteam_api.so ├── libwinpthread-1.dll └── libz.dll ├── release.py ├── scripts ├── build.cmd ├── fix_wire.sh ├── package.cmd └── update_gtk.sh ├── setup.cfg ├── setup.py ├── steam-tools.py ├── stlib ├── __init__.py ├── authenticator.py ├── browser.py ├── card_farming.py ├── config.py ├── libsteam.py ├── libsteam_wrapper.py ├── logging.py ├── logins.py ├── network.py ├── steamgifts_join.py └── steamtrades_bump.py └── ui ├── __init__.py ├── console.py ├── fix_std.py ├── gtk_markup_substring.py ├── icons ├── Default │ ├── LICENSE │ ├── actions │ │ ├── 22 │ │ │ ├── gtk-about.svg │ │ │ ├── gtk-connect.svg │ │ │ ├── gtk-ok.svg │ │ │ ├── gtk-properties.svg │ │ │ ├── gtk-quit.svg │ │ │ ├── gtk-stop.svg │ │ │ ├── media-playback-start.svg │ │ │ ├── media-playback-stop.svg │ │ │ └── process-stop.svg │ │ └── 48 │ │ │ ├── gtk-about.svg │ │ │ ├── gtk-apply.svg │ │ │ ├── gtk-connect.svg │ │ │ ├── gtk-properties.svg │ │ │ └── gtk-quit.svg │ ├── animations │ │ └── 48 │ │ │ └── process-working-symbolic.svg │ └── index.theme ├── steam-tools.ico ├── steam-tools.png ├── steam.png ├── steam_green.png ├── steam_red.png ├── steam_yellow.png ├── steamcompanion.png ├── steamcompanion_green.png ├── steamcompanion_red.png ├── steamcompanion_yellow.png ├── steamgifts.png ├── steamgifts_green.png ├── steamgifts_red.png ├── steamgifts_yellow.png ├── steamtrades.png ├── steamtrades_green.png ├── steamtrades_red.png └── steamtrades_yellow.png ├── interface.css ├── interface.xml ├── main.py ├── menu.xml ├── signals.py ├── timers.py └── version.py /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | *.pyc 3 | build/ 4 | dist/ 5 | *.zip 6 | *~* 7 | ui/#* 8 | .idea/* 9 | cacert.pem 10 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/.gitmodules -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | python: 4 | - "3.4" 5 | 6 | install: 7 | - sudo apt-get update -q 8 | - sudo apt-get install --no-install-recommends -y python3-gi python3-gi-cairo 9 | - sudo pip install requests 10 | - sudo pip install gevent 11 | - sudo pip install beautifulsoup4 12 | - sudo pip install pycrypto 13 | 14 | script: 15 | - sudo rm -f /usr/bin/python3 16 | - sudo ln -s $(which python3.4) /usr/bin/python3 17 | - python3.4 ./release.py 18 | 19 | deploy: 20 | provider: releases 21 | api_key: 22 | secure: nP+4u/z+IAtJDLP78SyvJ4e2RmHgWF78VXi9tu9fJyK+ETlW5OWP4CE/z38VST2PNCFlPtLpH1uKHsIf/DwDyslAehL/bO6SYja5+oM94ZsVX/WFpX+SFrMolE0iEr+yhoeH6ppPhNORNYpDE/Ns/jbZ8z2s9yFPpgVXZaHaehGHtDBAGLmxCz8YtpPtq4nrkjHfWAPrj3wCo+6COVflFtikXnWWDvw+UdZ7pyxcGoWHJ6PmOIMOSUMNSrDVYRcW3u7jHhrChidj5yn3kHTT0Zsp5IQvMDKstCH0BQJpxIsaql7Ivc/PxUMMdCAI/K2gbWRW+P3zrGqmoyyis3x23SfCj/MymO6O2J9APLJmsTrrTkqASevXuTLQUNVjCRhxmAuBV1dwPYkXNYNbGNn/3QyatdWVbyM4cy5AlM62Bi/XQB5UulxbmkgdvLXmP2neJi7zwbWh2AduRZgynEcEBOgOdExC8GM+30KqNKsvphWpdzPwZMj12YT183TOh4FQSVVZiaKZ9maBVVXQJRUKSpg0m9dYngcUqliAjsBDXyDP7zhJyDxBCuRHqa/43L/tVEOiYQne4dprEmC1Mw3mKzM7tfTbzfqgA8+sFxiDrBJ8kJw17LhHROALDtp+kqUc3+jd4A2wSM8UG08nlV647phK53VDva6g85AhzaMWDcE= 23 | file_glob: true 24 | file: release/* 25 | skip_cleanup: true 26 | tag_name: $TRAVIS_TAG 27 | draft: true 28 | on: 29 | tags: true 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | !!! DEPRECATED !!! 2 | ------------------ 3 | 4 | Steam Tools is deprecated. Steam Tools has been rewritten and split into two projects: [stlib](http://github.com/ShyPixie/stlib) and [Steam Tools NG](http://github.com/ShyPixie/steam-tools-ng) 5 | 6 | You can find them by clicking on these links: 7 | 8 | http://github.com/ShyPixie/stlib 9 | http://github.com/ShyPixie/steam-tools-ng 10 | 11 | 12 | This repository is officially obsolete 13 | 14 | 15 | ___________________________________________________________________________________________ 16 | 17 | 18 | [![Linux Build Status](https://img.shields.io/travis/ShyPixie/steam-tools/master.svg?label=Linux%20build)](https://travis-ci.org/ShyPixie/steam-tools) 19 | [![Windows Build status](https://img.shields.io/appveyor/ci/ShyPixie/steam-tools/master.svg?label=Windows%20build)](https://ci.appveyor.com/project/ShyPixie/steam-tools) 20 | [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/ShyPixie/steam-tools.svg)](https://scrutinizer-ci.com/g/ShyPixie/steam-tools/) 21 | [![GitHub license](https://img.shields.io/badge/license-GPLv3-green.svg)](https://www.gnu.org/licenses/gpl-3.0.html) 22 | [![GitHub release](https://img.shields.io/github/release/ShyPixie/steam-tools.svg)](https://github.com/ShyPixie/steam-tools/releases) 23 | [![GitHub Test release](https://img.shields.io/badge/testing-2.0.2-orange.svg)](https://github.com/ShyPixie/steam-tools/releases) 24 | [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=WVQ5XM935XNLN&item_name=Steam%20Tools) 25 | 26 | Some useful tools for use with steam client or compatible programs, websites. 27 | 28 | NOW WITH GUI! =D 29 | ===== 30 | 31 | ![Steam Tools](http://lara.click/downloads/tmp/st20.png) 32 | 33 | You can run the follow modules from steam-tools: 34 | 35 | - **Card Farming:** Will check for card drops and automatically start a fake app for drop the cards. 36 | 37 | - **Fake App:** Create a fake steam app using the Game ID 38 | 39 | - **Auto Trade:** Auto accept/decline item trades from steam. (**Coming Soon**) 40 | 41 | - **Authenticator:** A steam mobile authenticator clone. (**Coming Soon**) 42 | 43 | - **ST Bump:** Automatically bump your trades at steamtrades.com 44 | 45 | - **SG Join:** Automatically join in giveaways at steamgifts.com 46 | 47 | - **SC Join:** Automatically join in giveaways at steamcompanion.com 48 | 49 | I want the old console mode :( 50 | ------------------------------ 51 | 52 | **YOU ALREADY HAVE!** 53 | 54 | You can use steam-tools with params to access the console mode. For example, for use the ST join module: 55 | 56 | $ steam-tools -c steamtrades-join 57 | 58 | You can use all modules above. (I'll update the wiki when I have time.) 59 | 60 | 61 | How to install? 62 | --------------- 63 | 64 | You don't need. Download from the "Releases" tab and run. 65 | 66 | How to build from source? 67 | ------------------------- 68 | 69 | You don't need, but if you want... read the sources. 70 | ___________________________________________________________________________________________ 71 | 72 | This is an work in progress. You can request new features. 73 | 74 | The Steam Tools 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 version 3 of the License, or (at your option) any later version. 75 | 76 | The Steam Tools 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. 77 | 78 | You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. 79 | 80 | Lara Maia 81 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | global: 3 | UPX_URL: http://upx.sourceforge.net/download/upx391w.zip 4 | 5 | matrix: 6 | - platform: x86 7 | PYTHON: 'C:\Python34' 8 | PYTHON_VERSION: "3.4.4" 9 | PYTHON_ARCH: "32" 10 | 11 | - platform: x64 12 | PYTHON: 'C:\Python34-x64' 13 | PYTHON_VERSION: "3.4.4" 14 | PYTHON_ARCH: "64" 15 | 16 | clone_depth: 1 17 | 18 | matrix: 19 | fast_finish: true 20 | 21 | install: 22 | - appveyor DownloadFile "%UPX_URL%" -FileName upx391w.zip 23 | - md "C:\UPX\" 24 | - 7z e -y upx391w.zip -o"C:\UPX\" 25 | 26 | - call "%PYTHON%\python.exe" -m pip install --user --disable-pip-version-check --upgrade pip 27 | - call "%PYTHON%\python.exe" -m pip install --user py2exe 28 | - call "%PYTHON%\python.exe" -m pip install --user requests 29 | - call "%PYTHON%\python.exe" -m pip install --user beautifulsoup4 30 | - call "%PYTHON%\python.exe" -m pip install --user psutil 31 | - call "%PYTHON%\python.exe" -m pip install --user gevent 32 | 33 | - DEL /F "C:\Users\appveyor\AppData\Roaming\Python\Python34\site-packages\gevent\_util_py2.py" 34 | 35 | build_script: 36 | - call %PYTHON%\python.exe -u ./release.py" 37 | 38 | artifacts: 39 | - path: 'release\*' 40 | 41 | deploy: 42 | release: steam-tools-v$(appveyor_build_version) 43 | description: 'Steam Tools' 44 | provider: GitHub 45 | auth_token: 46 | secure: s9JXsQXUwIQLtip9BtKvEJQT24DqNDrbNwxMk39ixpq62lnDhE7cc3tq5cX3s85M 47 | artifact: /.*\.zip/ 48 | draft: true 49 | prerelease: false 50 | on: 51 | appveyor_repo_tag: true 52 | -------------------------------------------------------------------------------- /gi_repository/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2005-2009 Johan Dahlin 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 | # USA 20 | 21 | from __future__ import absolute_import 22 | 23 | # support overrides in different directories than our gi module 24 | from pkgutil import extend_path 25 | __path__ = extend_path(__path__, __name__) 26 | 27 | import sys 28 | import os 29 | import importlib 30 | import types 31 | 32 | _static_binding_error = ('When using gi.repository you must not import static ' 33 | 'modules like "gobject". Please change all occurrences ' 34 | 'of "import gobject" to "from gi.repository import GObject". ' 35 | 'See: https://bugzilla.gnome.org/show_bug.cgi?id=709183') 36 | 37 | # we can't have pygobject 2 loaded at the same time we load the internal _gobject 38 | if 'gobject' in sys.modules: 39 | raise ImportError(_static_binding_error) 40 | 41 | 42 | from . import _gi 43 | from ._gi import _gobject 44 | from ._gi import _API 45 | from ._gi import Repository 46 | from ._gi import PyGIDeprecationWarning 47 | from ._gi import PyGIWarning 48 | 49 | _API = _API # pyflakes 50 | PyGIDeprecationWarning = PyGIDeprecationWarning 51 | PyGIWarning = PyGIWarning 52 | 53 | _versions = {} 54 | _overridesdir = os.path.join(os.path.dirname(__file__), 'overrides') 55 | 56 | version_info = _gobject.pygobject_version[:] 57 | __version__ = "{0}.{1}.{2}".format(*version_info) 58 | 59 | 60 | class _DummyStaticModule(types.ModuleType): 61 | __path__ = None 62 | 63 | def __getattr__(self, name): 64 | raise AttributeError(_static_binding_error) 65 | 66 | 67 | sys.modules['glib'] = _DummyStaticModule('glib', _static_binding_error) 68 | sys.modules['gobject'] = _DummyStaticModule('gobject', _static_binding_error) 69 | sys.modules['gio'] = _DummyStaticModule('gio', _static_binding_error) 70 | sys.modules['gtk'] = _DummyStaticModule('gtk', _static_binding_error) 71 | sys.modules['gtk.gdk'] = _DummyStaticModule('gtk.gdk', _static_binding_error) 72 | 73 | 74 | def check_version(version): 75 | if isinstance(version, str): 76 | version_list = tuple(map(int, version.split("."))) 77 | else: 78 | version_list = version 79 | 80 | if version_list > version_info: 81 | raise ValueError(( 82 | "pygobject's version %s required, and available version " 83 | "%s is not recent enough") % (version, __version__) 84 | ) 85 | 86 | 87 | def require_version(namespace, version): 88 | repository = Repository.get_default() 89 | 90 | if namespace in repository.get_loaded_namespaces(): 91 | loaded_version = repository.get_version(namespace) 92 | if loaded_version != version: 93 | raise ValueError('Namespace %s is already loaded with version %s' % 94 | (namespace, loaded_version)) 95 | 96 | if namespace in _versions and _versions[namespace] != version: 97 | raise ValueError('Namespace %s already requires version %s' % 98 | (namespace, _versions[namespace])) 99 | 100 | available_versions = repository.enumerate_versions(namespace) 101 | if not available_versions: 102 | raise ValueError('Namespace %s not available' % namespace) 103 | 104 | if version not in available_versions: 105 | raise ValueError('Namespace %s not available for version %s' % 106 | (namespace, version)) 107 | 108 | _versions[namespace] = version 109 | 110 | 111 | def get_required_version(namespace): 112 | return _versions.get(namespace, None) 113 | 114 | 115 | def require_foreign(namespace, symbol=None): 116 | """Ensure the given foreign marshaling module is available and loaded. 117 | 118 | :param str namespace: 119 | Introspection namespace of the foreign module (e.g. "cairo") 120 | :param symbol: 121 | Optional symbol typename to ensure a converter exists. 122 | :type symbol: str or None 123 | :raises: ImportError 124 | 125 | :Example: 126 | 127 | .. code-block:: python 128 | 129 | import gi 130 | import cairo 131 | gi.require_foreign('cairo') 132 | 133 | """ 134 | try: 135 | _gi.require_foreign(namespace, symbol) 136 | except Exception as e: 137 | raise ImportError(str(e)) 138 | importlib.import_module('gi.repository', namespace) 139 | -------------------------------------------------------------------------------- /gi_repository/_constants.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # pygobject - Python bindings for the GObject library 3 | # Copyright (C) 2006-2007 Johan Dahlin 4 | # 5 | # gi/_constants.py: GObject type constants 6 | # 7 | # This library is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public 9 | # License as published by the Free Software Foundation; either 10 | # version 2.1 of the License, or (at your option) any later version. 11 | # 12 | # This library is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this library; if not, see . 19 | 20 | from ._gi import _gobject 21 | 22 | TYPE_INVALID = _gobject.TYPE_INVALID 23 | TYPE_NONE = _gobject.type_from_name('void') 24 | TYPE_INTERFACE = _gobject.type_from_name('GInterface') 25 | TYPE_CHAR = _gobject.type_from_name('gchar') 26 | TYPE_UCHAR = _gobject.type_from_name('guchar') 27 | TYPE_BOOLEAN = _gobject.type_from_name('gboolean') 28 | TYPE_INT = _gobject.type_from_name('gint') 29 | TYPE_UINT = _gobject.type_from_name('guint') 30 | TYPE_LONG = _gobject.type_from_name('glong') 31 | TYPE_ULONG = _gobject.type_from_name('gulong') 32 | TYPE_INT64 = _gobject.type_from_name('gint64') 33 | TYPE_UINT64 = _gobject.type_from_name('guint64') 34 | TYPE_ENUM = _gobject.type_from_name('GEnum') 35 | TYPE_FLAGS = _gobject.type_from_name('GFlags') 36 | TYPE_FLOAT = _gobject.type_from_name('gfloat') 37 | TYPE_DOUBLE = _gobject.type_from_name('gdouble') 38 | TYPE_STRING = _gobject.type_from_name('gchararray') 39 | TYPE_POINTER = _gobject.type_from_name('gpointer') 40 | TYPE_BOXED = _gobject.type_from_name('GBoxed') 41 | TYPE_PARAM = _gobject.type_from_name('GParam') 42 | TYPE_OBJECT = _gobject.type_from_name('GObject') 43 | TYPE_PYOBJECT = _gobject.type_from_name('PyObject') 44 | TYPE_GTYPE = _gobject.type_from_name('GType') 45 | TYPE_STRV = _gobject.type_from_name('GStrv') 46 | TYPE_VARIANT = _gobject.type_from_name('GVariant') 47 | TYPE_UNICHAR = TYPE_UINT 48 | -------------------------------------------------------------------------------- /gi_repository/_error.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2014 Simon Feltman 5 | # 6 | # _error.py: GError Python implementation 7 | # 8 | # This library is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU Lesser General Public 10 | # License as published by the Free Software Foundation; either 11 | # version 2.1 of the License, or (at your option) any later version. 12 | # 13 | # This library is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # Lesser General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public 19 | # License along with this library; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | # USA 22 | 23 | 24 | # NOTE: This file should not have any dependencies on introspection libs 25 | # like gi.repository.GLib because it would cause a circular dependency. 26 | # Developers wanting to use the GError class in their applications should 27 | # use gi.repository.GLib.GError 28 | 29 | 30 | class GError(RuntimeError): 31 | def __init__(self, message='unknown error', domain='pygi-error', code=0): 32 | super(GError, self).__init__(message) 33 | self.message = message 34 | self.domain = domain 35 | self.code = code 36 | 37 | def __str__(self): 38 | return "%s: %s (%d)" % (self.domain, self.message, self.code) 39 | 40 | def __repr__(self): 41 | return "%s.%s('%s', '%s', %d)" % (GError.__module__, GError.__name__, 42 | self.message, self.domain, self.code) 43 | 44 | def copy(self): 45 | return GError(self.message, self.domain, self.code) 46 | 47 | def matches(self, domain, code): 48 | """Placeholder that will be monkey patched in GLib overrides.""" 49 | raise NotImplementedError 50 | 51 | @staticmethod 52 | def new_literal(domain, message, code): 53 | """Placeholder that will be monkey patched in GLib overrides.""" 54 | raise NotImplementedError 55 | -------------------------------------------------------------------------------- /gi_repository/_gobject/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # pygobject - Python bindings for the GObject library 3 | # Copyright (C) 2006-2012 Johan Dahlin 4 | # 5 | # gobject/__init__.py: initialisation file for gobject module 6 | # 7 | # This library is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public 9 | # License as published by the Free Software Foundation; either 10 | # version 2.1 of the License, or (at your option) any later version. 11 | # 12 | # This library is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this library; if not, see . 19 | 20 | # Needed for compatibility with "pygobject.h" 21 | import gi._gi 22 | _PyGObject_API = gi._gi._gobject._PyGObject_API 23 | pygobject_version = gi._gi._gobject.pygobject_version 24 | -------------------------------------------------------------------------------- /gi_repository/docstring.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2013 Simon Feltman 5 | # 6 | # docstring.py: documentation string generator for gi. 7 | # 8 | # This library is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU Lesser General Public 10 | # License as published by the Free Software Foundation; either 11 | # version 2.1 of the License, or (at your option) any later version. 12 | # 13 | # This library is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # Lesser General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public 19 | # License along with this library; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | # USA 22 | 23 | from ._gi import \ 24 | VFuncInfo, \ 25 | FunctionInfo, \ 26 | CallableInfo, \ 27 | ObjectInfo, \ 28 | StructInfo, \ 29 | Direction, \ 30 | TypeTag 31 | 32 | 33 | #: Module storage for currently registered doc string generator function. 34 | _generate_doc_string_func = None 35 | 36 | 37 | def set_doc_string_generator(func): 38 | """Set doc string generator function 39 | 40 | :param callable func: 41 | Callable which takes a GIInfoStruct and returns documentation for it. 42 | """ 43 | global _generate_doc_string_func 44 | _generate_doc_string_func = func 45 | 46 | 47 | def get_doc_string_generator(): 48 | """Returns the currently registered doc string generator.""" 49 | return _generate_doc_string_func 50 | 51 | 52 | def generate_doc_string(info): 53 | """Generate a doc string given a GIInfoStruct. 54 | 55 | :param gi.types.BaseInfo info: 56 | GI info instance to generate documentation for. 57 | :returns: 58 | Generated documentation as a string. 59 | :rtype: str 60 | 61 | This passes the info struct to the currently registered doc string 62 | generator and returns the result. 63 | """ 64 | return _generate_doc_string_func(info) 65 | 66 | 67 | _type_tag_to_py_type = {TypeTag.BOOLEAN: bool, 68 | TypeTag.INT8: int, 69 | TypeTag.UINT8: int, 70 | TypeTag.INT16: int, 71 | TypeTag.UINT16: int, 72 | TypeTag.INT32: int, 73 | TypeTag.UINT32: int, 74 | TypeTag.INT64: int, 75 | TypeTag.UINT64: int, 76 | TypeTag.FLOAT: float, 77 | TypeTag.DOUBLE: float, 78 | TypeTag.GLIST: list, 79 | TypeTag.GSLIST: list, 80 | TypeTag.ARRAY: list, 81 | TypeTag.GHASH: dict, 82 | TypeTag.UTF8: str, 83 | TypeTag.FILENAME: str, 84 | TypeTag.UNICHAR: str, 85 | TypeTag.INTERFACE: None, 86 | TypeTag.GTYPE: None, 87 | TypeTag.ERROR: None, 88 | TypeTag.VOID: None, 89 | } 90 | 91 | 92 | def _get_pytype_hint(gi_type): 93 | type_tag = gi_type.get_tag() 94 | py_type = _type_tag_to_py_type.get(type_tag, None) 95 | 96 | if py_type and hasattr(py_type, '__name__'): 97 | return py_type.__name__ 98 | elif type_tag == TypeTag.INTERFACE: 99 | iface = gi_type.get_interface() 100 | 101 | info_name = iface.get_name() 102 | if not info_name: 103 | return gi_type.get_tag_as_string() 104 | 105 | return '%s.%s' % (iface.get_namespace(), info_name) 106 | 107 | return gi_type.get_tag_as_string() 108 | 109 | 110 | def _generate_callable_info_doc(info): 111 | in_args_strs = [] 112 | if isinstance(info, VFuncInfo): 113 | in_args_strs = ['self'] 114 | elif isinstance(info, FunctionInfo): 115 | if info.is_method(): 116 | in_args_strs = ['self'] 117 | 118 | args = info.get_arguments() 119 | hint_blacklist = ('void',) 120 | 121 | # Build lists of indices prior to adding the docs because it is possible 122 | # the index retrieved comes before input arguments being used. 123 | ignore_indices = set() 124 | user_data_indices = set() 125 | for arg in args: 126 | ignore_indices.add(arg.get_destroy()) 127 | ignore_indices.add(arg.get_type().get_array_length()) 128 | user_data_indices.add(arg.get_closure()) 129 | 130 | # Build input argument strings 131 | for i, arg in enumerate(args): 132 | if arg.get_direction() == Direction.OUT: 133 | continue # skip exclusively output args 134 | if i in ignore_indices: 135 | continue 136 | argstr = arg.get_name() 137 | hint = _get_pytype_hint(arg.get_type()) 138 | if hint not in hint_blacklist: 139 | argstr += ':' + hint 140 | if arg.may_be_null() or i in user_data_indices: 141 | # allow-none or user_data from a closure 142 | argstr += '=None' 143 | elif arg.is_optional(): 144 | argstr += '=' 145 | in_args_strs.append(argstr) 146 | in_args_str = ', '.join(in_args_strs) 147 | 148 | # Build return + output argument strings 149 | out_args_strs = [] 150 | return_hint = _get_pytype_hint(info.get_return_type()) 151 | if not info.skip_return() and return_hint and return_hint not in hint_blacklist: 152 | argstr = return_hint 153 | if info.may_return_null(): 154 | argstr += ' or None' 155 | out_args_strs.append(argstr) 156 | 157 | for i, arg in enumerate(args): 158 | if arg.get_direction() == Direction.IN: 159 | continue # skip exclusively input args 160 | if i in ignore_indices: 161 | continue 162 | argstr = arg.get_name() 163 | hint = _get_pytype_hint(arg.get_type()) 164 | if hint not in hint_blacklist: 165 | argstr += ':' + hint 166 | out_args_strs.append(argstr) 167 | 168 | if out_args_strs: 169 | return '%s(%s) -> %s' % (info.__name__, in_args_str, ', '.join(out_args_strs)) 170 | else: 171 | return '%s(%s)' % (info.__name__, in_args_str) 172 | 173 | 174 | def _generate_class_info_doc(info): 175 | header = '\n:Constructors:\n\n::\n\n' # start with \n to avoid auto indent of other lines 176 | doc = '' 177 | 178 | if isinstance(info, StructInfo): 179 | # Don't show default constructor for disguised (0 length) structs 180 | if info.get_size() > 0: 181 | doc += ' ' + info.get_name() + '()\n' 182 | else: 183 | doc += ' ' + info.get_name() + '(**properties)\n' 184 | 185 | for method_info in info.get_methods(): 186 | if method_info.is_constructor(): 187 | doc += ' ' + _generate_callable_info_doc(method_info) + '\n' 188 | 189 | if doc: 190 | return header + doc 191 | else: 192 | return '' 193 | 194 | 195 | def _generate_doc_dispatch(info): 196 | if isinstance(info, (ObjectInfo, StructInfo)): 197 | return _generate_class_info_doc(info) 198 | 199 | elif isinstance(info, CallableInfo): 200 | return _generate_callable_info_doc(info) 201 | 202 | return '' 203 | 204 | 205 | set_doc_string_generator(_generate_doc_dispatch) 206 | -------------------------------------------------------------------------------- /gi_repository/importer.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2005-2009 Johan Dahlin 5 | # 2015 Christoph Reiter 6 | # 7 | # importer.py: dynamic importer for introspected libraries. 8 | # 9 | # This library is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU Lesser General Public 11 | # License as published by the Free Software Foundation; either 12 | # version 2.1 of the License, or (at your option) any later version. 13 | # 14 | # This library is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # Lesser General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU Lesser General Public 20 | # License along with this library; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 22 | # USA 23 | 24 | from __future__ import absolute_import 25 | import sys 26 | import warnings 27 | from contextlib import contextmanager 28 | 29 | import gi 30 | from ._gi import Repository 31 | from ._gi import PyGIWarning 32 | from .module import get_introspection_module 33 | from .overrides import load_overrides 34 | 35 | 36 | repository = Repository.get_default() 37 | 38 | # only for backwards compatibility 39 | modules = {} 40 | 41 | 42 | @contextmanager 43 | def _check_require_version(namespace, stacklevel): 44 | """A context manager which tries to give helpful warnings 45 | about missing gi.require_version() which could potentially 46 | break code if only an older version than expected is installed 47 | or a new version gets introduced. 48 | 49 | :: 50 | 51 | with _check_require_version("Gtk", stacklevel): 52 | load_namespace_and_overrides() 53 | """ 54 | 55 | was_loaded = repository.is_registered(namespace) 56 | 57 | yield 58 | 59 | if was_loaded: 60 | # it was loaded before by another import which depended on this 61 | # namespace or by C code like libpeas 62 | return 63 | 64 | if namespace in ("GLib", "GObject", "Gio"): 65 | # part of glib (we have bigger problems if versions change there) 66 | return 67 | 68 | if gi.get_required_version(namespace) is not None: 69 | # the version was forced using require_version() 70 | return 71 | 72 | version = repository.get_version(namespace) 73 | warnings.warn( 74 | "%(namespace)s was imported without specifying a version first. " 75 | "Use gi.require_version('%(namespace)s', '%(version)s') before " 76 | "import to ensure that the right version gets loaded." 77 | % {"namespace": namespace, "version": version}, 78 | PyGIWarning, stacklevel=stacklevel) 79 | 80 | 81 | class DynamicImporter(object): 82 | 83 | # Note: see PEP302 for the Importer Protocol implemented below. 84 | 85 | def __init__(self, path): 86 | self.path = path 87 | 88 | def find_module(self, fullname, path=None): 89 | if not fullname.startswith(self.path): 90 | return 91 | 92 | path, namespace = fullname.rsplit('.', 1) 93 | if path != self.path: 94 | return 95 | 96 | if repository.enumerate_versions(namespace): 97 | return self 98 | else: 99 | raise ImportError('cannot import name %s, ' 100 | 'introspection typelib not found' % namespace) 101 | 102 | def load_module(self, fullname): 103 | if fullname in sys.modules: 104 | return sys.modules[fullname] 105 | 106 | path, namespace = fullname.rsplit('.', 1) 107 | 108 | # we want the warning to point to the line doing the import 109 | if sys.version_info >= (3, 0): 110 | stacklevel = 10 111 | else: 112 | stacklevel = 4 113 | with _check_require_version(namespace, stacklevel=stacklevel): 114 | introspection_module = get_introspection_module(namespace) 115 | dynamic_module = load_overrides(introspection_module) 116 | 117 | dynamic_module.__file__ = '<%s>' % fullname 118 | dynamic_module.__loader__ = self 119 | sys.modules[fullname] = dynamic_module 120 | 121 | return dynamic_module 122 | -------------------------------------------------------------------------------- /gi_repository/overrides/Dee.py: -------------------------------------------------------------------------------- 1 | from gi.overrides import override 2 | from gi.importer import modules 3 | 4 | Dee = modules['Dee']._introspection_module 5 | from gi.repository import GLib 6 | 7 | __all__ = [] 8 | 9 | class RowWrapper: 10 | def __init__ (self, model, itr): 11 | self.model = model 12 | self.itr = itr 13 | self.__initialized = True 14 | 15 | def __getitem__ (self, column): 16 | return self.model.get_value(self.itr, column) 17 | 18 | def __setitem__ (self, column, val): 19 | self.model.set_value (self.itr, column, val) 20 | 21 | def __getattr__ (self, name): 22 | col_index = self.model.get_column_index (name) 23 | if col_index < 0: 24 | raise AttributeError("object has no attribute '%s'" % name) 25 | return self.model.get_value (self.itr, col_index) 26 | 27 | def __setattr__ (self, name, value): 28 | if not "_RowWrapper__initialized" in self.__dict__: 29 | self.__dict__[name] = value 30 | return 31 | col_index = self.model.get_column_index (name) 32 | if col_index < 0: 33 | raise AttributeError("object has no attribute '%s'" % name) 34 | self.model.set_value (self.itr, col_index, value) 35 | 36 | def __iter__ (self): 37 | for column in range(self.model.get_n_columns()): 38 | yield self.model.get_value (self.itr, column) 39 | 40 | def __len__ (self): 41 | return self.model.get_n_columns() 42 | 43 | def __str__ (self): 44 | return "(%s)" % ", ".join(map(str,self)) 45 | 46 | def __eq__ (self, other): 47 | if not isinstance (other, RowWrapper): 48 | return False 49 | if self.model != other.model: 50 | return False 51 | return self.itr == other.itr 52 | 53 | class Model(Dee.Model): 54 | 55 | def __init__(self): 56 | Dee.Model.__init__(self) 57 | 58 | def set_schema (self, *args): 59 | self.set_schema_full (tuple(args)) 60 | 61 | def set_column_names (self, *args): 62 | self.set_column_names_full (tuple(args)) 63 | 64 | def _build_row (self, args, kwargs): 65 | schema = self.get_schema() 66 | result = [None] * len(schema) 67 | if len(args) > 0: 68 | for i, arg in enumerate(args): 69 | if isinstance(arg, GLib.Variant): 70 | result[i] = arg 71 | else: 72 | result[i] = GLib.Variant(schema[i], arg) 73 | 74 | # check 75 | if result.count(None) > 0: 76 | raise RuntimeError("Not all columns were set") 77 | else: 78 | names = self.get_column_names() 79 | dicts = [None] * len(schema) 80 | if len(names) == 0: 81 | raise RuntimeError("Column names were not set") 82 | for col_name, arg in kwargs.items(): 83 | if names.count(col_name) > 0: 84 | col_index = names.index(col_name) 85 | variant = arg if isinstance(arg, GLib.Variant) else GLib.Variant(schema[col_index], arg) 86 | result[col_index] = variant 87 | else: 88 | col_schema, col_index = self.get_field_schema(col_name) 89 | if col_schema: 90 | variant = arg if isinstance(arg, GLib.Variant) else GLib.Variant(col_schema, arg) 91 | colon_index = col_name.find("::") 92 | field_name = col_name if colon_index < 0 else col_name[colon_index+2:] 93 | if dicts[col_index] is None: dicts[col_index] = {} 94 | dicts[col_index][field_name] = variant 95 | else: 96 | raise RuntimeError("Unknown column name: %s" % col_name) 97 | 98 | # finish vardict creation 99 | for index, d in enumerate(dicts): 100 | if d: result[index] = GLib.Variant(schema[index], d) 101 | 102 | # handle empty dicts (no "xrange" in python3) 103 | for i in range(len(schema)): 104 | if result[i] is None and schema[i] == "a{sv}": 105 | result[i] = GLib.Variant(schema[i], {}) 106 | 107 | # checks 108 | num_unset = result.count(None) 109 | if num_unset > 0: 110 | col_name = names[result.index(None)] 111 | raise RuntimeError("Column '%s' was not set" % col_name) 112 | 113 | return result 114 | 115 | def prepend (self, *args, **kwargs): 116 | return self.prepend_row (self._build_row(args, kwargs)) 117 | 118 | def append (self, *args, **kwargs): 119 | return self.append_row (self._build_row(args, kwargs)) 120 | 121 | def insert (self, pos, *args, **kwargs): 122 | return self.insert_row (pos, self._build_row(args, kwargs)) 123 | 124 | def insert_before (self, iter, *args, **kwargs): 125 | return self.insert_row_before (iter, self._build_row(args, kwargs)) 126 | 127 | def insert_row_sorted (self, row_spec, sort_func, data): 128 | return self.insert_row_sorted_with_sizes (row_spec, sort_func, data) 129 | 130 | def insert_sorted (self, sort_func, *args, **kwargs): 131 | return self.insert_row_sorted (self._build_row(args, kwargs), sort_func, None) 132 | 133 | def find_row_sorted (self, row_spec, sort_func, data): 134 | return self.find_row_sorted_with_sizes (row_spec, sort_func, data) 135 | 136 | def find_sorted (self, sort_func, *args, **kwargs): 137 | return self.find_row_sorted (self._build_row(args, kwargs), sort_func, None) 138 | 139 | def get_schema (self): 140 | return Dee.Model.get_schema(self) 141 | 142 | def get_value (self, itr, column): 143 | return Dee.Model.get_value (self, itr, column).unpack() 144 | 145 | def set_value (self, itr, column, value): 146 | var = GLib.Variant (self.get_column_schema(column), value) 147 | if isinstance (itr, int): 148 | itr = self.get_iter_at_row(itr) 149 | Dee.Model.set_value (self, itr, column, var) 150 | 151 | def __getitem__ (self, itr): 152 | if isinstance (itr, int): 153 | itr = self.get_iter_at_row(itr) 154 | return RowWrapper(self, itr) 155 | 156 | def __setitem__ (self, itr, row): 157 | max_col = self.get_n_columns () 158 | for column, value in enumerate (row): 159 | if column >= max_col: 160 | raise IndexError("Too many columns in row assignment: %s" % column) 161 | self.set_value (itr, column, value) 162 | 163 | def get_row (self, itr): 164 | return self[itr] 165 | 166 | def __iter__ (self): 167 | itr = self.get_first_iter () 168 | last = self.get_last_iter () 169 | while itr != last: 170 | yield self.get_row(itr) 171 | itr = self.next(itr) 172 | raise StopIteration 173 | 174 | def __len__ (self): 175 | return self.get_n_rows() 176 | 177 | 178 | class ModelIter(Dee.ModelIter): 179 | 180 | def __init__(self): 181 | Dee.ModelIter.__init__(self) 182 | 183 | def __eq__ (self, other): 184 | if not isinstance (other, ModelIter): 185 | return False 186 | return repr(self) == repr(other) 187 | 188 | 189 | 190 | Model = override(Model) 191 | __all__.append('Model') 192 | ModelIter = override(ModelIter) 193 | __all__.append('ModelIter') 194 | 195 | 196 | -------------------------------------------------------------------------------- /gi_repository/overrides/GExiv2.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2012 Robert Park 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 | # USA 20 | 21 | from datetime import datetime 22 | from fractions import Fraction 23 | 24 | from gi.repository import GObject 25 | from ..overrides import override 26 | from ..module import get_introspection_module 27 | 28 | GExiv2 = get_introspection_module('GExiv2') 29 | 30 | __all__ = [] 31 | 32 | DATE_FORMAT = '%Y:%m:%d %H:%M:%S' 33 | MAX_INT = 2**31 - 1 34 | 35 | @override 36 | class Metadata(GExiv2.Metadata): 37 | def __init__(self, path=None): 38 | super(Metadata, self).__init__() 39 | self._path = path 40 | if path is not None: 41 | self.open_path(path) 42 | 43 | def open_path(self, path): 44 | self._path = path 45 | super(Metadata, self).open_path(path) 46 | 47 | def save_file(self, path=None): 48 | super(Metadata, self).save_file(path or self._path) 49 | 50 | def get_date_time(self): 51 | datestring = self['Exif.Photo.DateTimeOriginal'] 52 | if datestring is not None: 53 | return datetime.strptime(datestring, DATE_FORMAT) 54 | 55 | def set_date_time(self, value): 56 | self['Exif.Photo.DateTimeOriginal'] = value.strftime(DATE_FORMAT) 57 | 58 | def get_exposure_time(self): 59 | num, denom = super(Metadata, self).get_exposure_time() 60 | return Fraction(num, denom) if denom else None 61 | 62 | def get_exif_tag_rational(self, key): 63 | num, denom = super(Metadata, self).get_exif_tag_rational(key) 64 | return Fraction(num, denom) if denom else None 65 | 66 | def set_exif_tag_rational(self, key, fraction): 67 | limit = MAX_INT 68 | while True: 69 | try: 70 | return super(Metadata, self).set_exif_tag_rational( 71 | key, fraction.numerator, fraction.denominator) 72 | except ValueError: 73 | fraction = fraction.limit_denominator(limit) 74 | limit = int(limit / 2) 75 | 76 | def get_tags(self): 77 | return self.get_exif_tags() + self.get_iptc_tags() + self.get_xmp_tags() 78 | 79 | def get(self, key, default=None): 80 | return self.get_tag_string(key) if self.has_tag(key) else default 81 | 82 | def get_raw(self, key): 83 | return self.get_tag_raw(key).get_data() 84 | 85 | def __iter__(self): 86 | return iter(self.get_tags()) 87 | 88 | def __contains__(self, key): 89 | return self.has_tag(key) 90 | 91 | def __len__(self): 92 | return len(self.get_tags()) 93 | 94 | def __getitem__(self, key): 95 | if self.has_tag(key): 96 | return self.get_tag_string(key) 97 | else: 98 | raise KeyError('%s: Unknown tag' % key) 99 | 100 | def __delitem__(self, key): 101 | if self.has_tag(key): 102 | self.clear_tag(key) 103 | else: 104 | raise KeyError('%s: Unknown tag' % key) 105 | 106 | __setitem__ = GExiv2.Metadata.set_tag_string 107 | 108 | __all__.append('Metadata') 109 | 110 | if not GExiv2.initialize(): 111 | raise RuntimeError("GExiv2 couldn't be initialized") 112 | 113 | -------------------------------------------------------------------------------- /gi_repository/overrides/GIMarshallingTests.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2010 Simon van der Linden 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 | # USA 20 | 21 | from ..overrides import override 22 | from ..module import get_introspection_module 23 | 24 | GIMarshallingTests = get_introspection_module('GIMarshallingTests') 25 | 26 | __all__ = [] 27 | 28 | OVERRIDES_CONSTANT = 7 29 | __all__.append('OVERRIDES_CONSTANT') 30 | 31 | 32 | class OverridesStruct(GIMarshallingTests.OverridesStruct): 33 | 34 | def __new__(cls, long_): 35 | return GIMarshallingTests.OverridesStruct.__new__(cls) 36 | 37 | def __init__(self, long_): 38 | GIMarshallingTests.OverridesStruct.__init__(self) 39 | self.long_ = long_ 40 | 41 | def method(self): 42 | return GIMarshallingTests.OverridesStruct.method(self) / 7 43 | 44 | OverridesStruct = override(OverridesStruct) 45 | __all__.append('OverridesStruct') 46 | 47 | 48 | class OverridesObject(GIMarshallingTests.OverridesObject): 49 | 50 | def __new__(cls, long_): 51 | return GIMarshallingTests.OverridesObject.__new__(cls) 52 | 53 | def __init__(self, long_): 54 | GIMarshallingTests.OverridesObject.__init__(self) 55 | # FIXME: doesn't work yet 56 | # self.long_ = long_ 57 | 58 | @classmethod 59 | def new(cls, long_): 60 | self = GIMarshallingTests.OverridesObject.new() 61 | # FIXME: doesn't work yet 62 | # self.long_ = long_ 63 | return self 64 | 65 | def method(self): 66 | """Overridden doc string.""" 67 | return GIMarshallingTests.OverridesObject.method(self) / 7 68 | 69 | OverridesObject = override(OverridesObject) 70 | __all__.append('OverridesObject') 71 | -------------------------------------------------------------------------------- /gi_repository/overrides/Gedit.py: -------------------------------------------------------------------------------- 1 | from gi.repository import GObject 2 | import inspect 3 | 4 | from ..overrides import override 5 | from ..importer import modules 6 | 7 | Gedit = modules['Gedit']._introspection_module 8 | __all__ = [] 9 | 10 | class MessageBus(Gedit.MessageBus): 11 | def create(self, object_path, method, **kwargs): 12 | tp = self.lookup(object_path, method) 13 | 14 | if not tp.is_a(Gedit.Message.__gtype__): 15 | return None 16 | 17 | kwargs['object-path'] = object_path 18 | kwargs['method'] = method 19 | 20 | return GObject.new(tp, **kwargs) 21 | 22 | def send_sync(self, object_path, method, **kwargs): 23 | msg = self.create(object_path, method, **kwargs) 24 | self.send_message_sync(msg) 25 | 26 | return msg 27 | 28 | def send(self, object_path, method, **kwargs): 29 | msg = self.create(object_path, method, **kwargs) 30 | self.send_message(msg) 31 | 32 | return msg 33 | 34 | MessageBus = override(MessageBus) 35 | __all__.append('MessageBus') 36 | 37 | class Message(Gedit.Message): 38 | def __getattribute__(self, name): 39 | try: 40 | return Gedit.Message.__getattribute__(self, name) 41 | except: 42 | return getattr(self.props, name) 43 | 44 | Message = override(Message) 45 | __all__.append('Message') 46 | 47 | 48 | def get_trace_info(num_back_frames=0): 49 | frame = inspect.currentframe().f_back 50 | try: 51 | for i in range(num_back_frames): 52 | frame = frame.f_back 53 | 54 | filename = frame.f_code.co_filename 55 | 56 | # http://code.activestate.com/recipes/145297-grabbing-the-current-line-number-easily/ 57 | lineno = frame.f_lineno 58 | 59 | func_name = frame.f_code.co_name 60 | try: 61 | # http://stackoverflow.com/questions/2203424/python-how-to-retrieve-class-information-from-a-frame-object 62 | cls_name = frame.f_locals["self"].__class__.__name__ 63 | except: 64 | pass 65 | else: 66 | func_name = "%s.%s" % (cls_name, func_name) 67 | 68 | return (filename, lineno, func_name) 69 | finally: 70 | frame = None 71 | 72 | orig_debug_plugin_message_func = Gedit.debug_plugin_message 73 | 74 | @override(Gedit.debug_plugin_message) 75 | def debug_plugin_message(format, *format_args): 76 | filename, lineno, func_name = get_trace_info(2) 77 | orig_debug_plugin_message_func(filename, lineno, func_name, format % format_args) 78 | __all__.append(debug_plugin_message) 79 | 80 | # vi:ex:ts=4:et 81 | -------------------------------------------------------------------------------- /gi_repository/overrides/Ggit.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2012 - Jesse van den Kieboom 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | from gi.repository import Gio 21 | from ..overrides import override 22 | from ..module import get_introspection_module 23 | 24 | 25 | Ggit = get_introspection_module('Ggit') 26 | __all__ = [] 27 | 28 | 29 | def _wrap_iter_size(self): 30 | for i in range(0, self.size()): 31 | yield self.get(i) 32 | 33 | def _wrap_iter_get(self): 34 | while self.next(): 35 | yield self.get() 36 | 37 | def _wrap_iter_get_by_index(self): 38 | for i in range(0, self.size()): 39 | yield self.get_by_index(i) 40 | 41 | def _wrap_iter_next(self): 42 | while True: 43 | value = self.next() 44 | if value is None: 45 | break 46 | 47 | yield value 48 | 49 | def _wrap_initable_init(self, *args, **kwargs): 50 | super(self.__class__, self).__init__(*args, **kwargs) 51 | Gio.Initable.init(self, None) 52 | 53 | def _override_dyn(base, **kwargs): 54 | name = base.__name__ 55 | 56 | try: 57 | cls = globals()[name] 58 | 59 | except KeyError: 60 | cls = override(type(name, (base,), {})) 61 | globals()[name] = cls 62 | __all__.append(name) 63 | 64 | for method, wrapper in kwargs.items(): 65 | setattr(cls, method, wrapper) 66 | 67 | 68 | for c in dir(Ggit): 69 | try: 70 | o = getattr(Ggit, c) 71 | 72 | except AttributeError: 73 | continue 74 | 75 | if not hasattr(o, '__gtype__'): 76 | continue 77 | 78 | # Add __str__ mapping using to_string 79 | if hasattr(o, 'to_string'): 80 | _override_dyn(o, __str__=o.to_string) 81 | 82 | # Add iterator pattern 83 | # GgitCommitParents, GgitIndexEntriesResolveUndo, GgitTree 84 | if hasattr(o, 'get') and hasattr(o, 'size'): 85 | _override_dyn(o, __iter__=_wrap_iter_size) 86 | 87 | # GgitBranchEnumerator 88 | elif hasattr(o, 'get') and hasattr(o, 'next'): 89 | _override_dyn(o, __iter__=_wrap_iter_get) 90 | 91 | # GgitIndexEntries 92 | elif hasattr(o, 'get_by_index') and hasattr(o, 'size'): 93 | _override_dyn(o, __iter__=_wrap_iter_get_by_index) 94 | 95 | # GgitRevisionWalker 96 | elif hasattr(o, 'next'): 97 | _override_dyn(o, __iter__=_wrap_iter_next) 98 | 99 | # GgitIndex, GgitRepository, GgitRevisionWalker, ... 100 | if o.__gtype__.is_a(Gio.Initable): 101 | _override_dyn(o, __init__=_wrap_initable_init) 102 | 103 | # vi:ex:ts=4:et 104 | -------------------------------------------------------------------------------- /gi_repository/overrides/Gio.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2010 Ignacio Casal Quinteiro 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 | # USA 20 | 21 | from ..overrides import override, deprecated_init 22 | from ..module import get_introspection_module 23 | 24 | from gi.repository import GLib 25 | 26 | import sys 27 | 28 | Gio = get_introspection_module('Gio') 29 | 30 | __all__ = [] 31 | 32 | 33 | class FileEnumerator(Gio.FileEnumerator): 34 | def __iter__(self): 35 | return self 36 | 37 | def __next__(self): 38 | file_info = self.next_file(None) 39 | 40 | if file_info is not None: 41 | return file_info 42 | else: 43 | raise StopIteration 44 | 45 | # python 2 compat for the iter protocol 46 | next = __next__ 47 | 48 | 49 | FileEnumerator = override(FileEnumerator) 50 | __all__.append('FileEnumerator') 51 | 52 | 53 | class MenuItem(Gio.MenuItem): 54 | def set_attribute(self, attributes): 55 | for (name, format_string, value) in attributes: 56 | self.set_attribute_value(name, GLib.Variant(format_string, value)) 57 | 58 | 59 | MenuItem = override(MenuItem) 60 | __all__.append('MenuItem') 61 | 62 | 63 | class Settings(Gio.Settings): 64 | '''Provide dictionary-like access to GLib.Settings.''' 65 | 66 | __init__ = deprecated_init(Gio.Settings.__init__, 67 | arg_names=('schema', 'path', 'backend')) 68 | 69 | def __contains__(self, key): 70 | return key in self.list_keys() 71 | 72 | def __len__(self): 73 | return len(self.list_keys()) 74 | 75 | def __bool__(self): 76 | # for "if mysettings" we don't want a dictionary-like test here, just 77 | # if the object isn't None 78 | return True 79 | 80 | # alias for Python 2.x object protocol 81 | __nonzero__ = __bool__ 82 | 83 | def __getitem__(self, key): 84 | # get_value() aborts the program on an unknown key 85 | if key not in self: 86 | raise KeyError('unknown key: %r' % (key,)) 87 | 88 | return self.get_value(key).unpack() 89 | 90 | def __setitem__(self, key, value): 91 | # set_value() aborts the program on an unknown key 92 | if key not in self: 93 | raise KeyError('unknown key: %r' % (key,)) 94 | 95 | # determine type string of this key 96 | range = self.get_range(key) 97 | type_ = range.get_child_value(0).get_string() 98 | v = range.get_child_value(1) 99 | if type_ == 'type': 100 | # v is boxed empty array, type of its elements is the allowed value type 101 | type_str = v.get_child_value(0).get_type_string() 102 | assert type_str.startswith('a') 103 | type_str = type_str[1:] 104 | elif type_ == 'enum': 105 | # v is an array with the allowed values 106 | assert v.get_child_value(0).get_type_string().startswith('a') 107 | type_str = v.get_child_value(0).get_child_value(0).get_type_string() 108 | allowed = v.unpack() 109 | if value not in allowed: 110 | raise ValueError('value %s is not an allowed enum (%s)' % (value, allowed)) 111 | else: 112 | raise NotImplementedError('Cannot handle allowed type range class ' + str(type_)) 113 | 114 | self.set_value(key, GLib.Variant(type_str, value)) 115 | 116 | def keys(self): 117 | return self.list_keys() 118 | 119 | Settings = override(Settings) 120 | __all__.append('Settings') 121 | 122 | 123 | class _DBusProxyMethodCall: 124 | '''Helper class to implement DBusProxy method calls.''' 125 | 126 | def __init__(self, dbus_proxy, method_name): 127 | self.dbus_proxy = dbus_proxy 128 | self.method_name = method_name 129 | 130 | def __async_result_handler(self, obj, result, user_data): 131 | (result_callback, error_callback, real_user_data) = user_data 132 | try: 133 | ret = obj.call_finish(result) 134 | except Exception: 135 | etype, e = sys.exc_info()[:2] 136 | # return exception as value 137 | if error_callback: 138 | error_callback(obj, e, real_user_data) 139 | else: 140 | result_callback(obj, e, real_user_data) 141 | return 142 | 143 | result_callback(obj, self._unpack_result(ret), real_user_data) 144 | 145 | def __call__(self, *args, **kwargs): 146 | # the first positional argument is the signature, unless we are calling 147 | # a method without arguments; then signature is implied to be '()'. 148 | if args: 149 | signature = args[0] 150 | args = args[1:] 151 | if not isinstance(signature, str): 152 | raise TypeError('first argument must be the method signature string: %r' % signature) 153 | else: 154 | signature = '()' 155 | 156 | arg_variant = GLib.Variant(signature, tuple(args)) 157 | 158 | if 'result_handler' in kwargs: 159 | # asynchronous call 160 | user_data = (kwargs['result_handler'], 161 | kwargs.get('error_handler'), 162 | kwargs.get('user_data')) 163 | self.dbus_proxy.call(self.method_name, arg_variant, 164 | kwargs.get('flags', 0), kwargs.get('timeout', -1), None, 165 | self.__async_result_handler, user_data) 166 | else: 167 | # synchronous call 168 | result = self.dbus_proxy.call_sync(self.method_name, arg_variant, 169 | kwargs.get('flags', 0), 170 | kwargs.get('timeout', -1), 171 | None) 172 | return self._unpack_result(result) 173 | 174 | @classmethod 175 | def _unpack_result(klass, result): 176 | '''Convert a D-BUS return variant into an appropriate return value''' 177 | 178 | result = result.unpack() 179 | 180 | # to be compatible with standard Python behaviour, unbox 181 | # single-element tuples and return None for empty result tuples 182 | if len(result) == 1: 183 | result = result[0] 184 | elif len(result) == 0: 185 | result = None 186 | 187 | return result 188 | 189 | 190 | class DBusProxy(Gio.DBusProxy): 191 | '''Provide comfortable and pythonic method calls. 192 | 193 | This marshalls the method arguments into a GVariant, invokes the 194 | call_sync() method on the DBusProxy object, and unmarshalls the result 195 | GVariant back into a Python tuple. 196 | 197 | The first argument always needs to be the D-Bus signature tuple of the 198 | method call. Example: 199 | 200 | proxy = Gio.DBusProxy.new_sync(...) 201 | result = proxy.MyMethod('(is)', 42, 'hello') 202 | 203 | The exception are methods which take no arguments, like 204 | proxy.MyMethod('()'). For these you can omit the signature and just write 205 | proxy.MyMethod(). 206 | 207 | Optional keyword arguments: 208 | 209 | - timeout: timeout for the call in milliseconds (default to D-Bus timeout) 210 | 211 | - flags: Combination of Gio.DBusCallFlags.* 212 | 213 | - result_handler: Do an asynchronous method call and invoke 214 | result_handler(proxy_object, result, user_data) when it finishes. 215 | 216 | - error_handler: If the asynchronous call raises an exception, 217 | error_handler(proxy_object, exception, user_data) is called when it 218 | finishes. If error_handler is not given, result_handler is called with 219 | the exception object as result instead. 220 | 221 | - user_data: Optional user data to pass to result_handler for 222 | asynchronous calls. 223 | 224 | Example for asynchronous calls: 225 | 226 | def mymethod_done(proxy, result, user_data): 227 | if isinstance(result, Exception): 228 | # handle error 229 | else: 230 | # do something with result 231 | 232 | proxy.MyMethod('(is)', 42, 'hello', 233 | result_handler=mymethod_done, user_data='data') 234 | ''' 235 | def __getattr__(self, name): 236 | return _DBusProxyMethodCall(self, name) 237 | 238 | DBusProxy = override(DBusProxy) 239 | __all__.append('DBusProxy') 240 | -------------------------------------------------------------------------------- /gi_repository/overrides/GooCanvas.py: -------------------------------------------------------------------------------- 1 | from ..overrides import override 2 | from ..importer import modules 3 | 4 | GooCanvas = modules['GooCanvas']._introspection_module 5 | 6 | __all__ = [] 7 | 8 | #We cant change the numner of points once constructed, and boxed types do not allow 9 | #arguments to constructors, so override __new__ 10 | class CanvasPoints(GooCanvas.CanvasPoints): 11 | 12 | def __new__(cls, points): 13 | 14 | assert len(points) 15 | assert len(points[0]) 16 | 17 | obj = cls.new(len(points)) 18 | i = 0 19 | for p in points: 20 | obj.set_point(i, p[0],p[1]) 21 | i += 1 22 | return obj 23 | 24 | CanvasPoints = override(CanvasPoints) 25 | __all__.append('CanvasPoints') 26 | 27 | class CanvasPolyline(GooCanvas.CanvasPolyline): 28 | 29 | @classmethod 30 | def new_line(cls, parent, x1, y1, x2, y2, **props): 31 | props.update( 32 | parent=parent, 33 | points=CanvasPoints(((x1,y1),(x2,y2))), 34 | close_path=False) 35 | return cls(**props) 36 | 37 | CanvasPolyline = override(CanvasPolyline) 38 | __all__.append('CanvasPolyline') 39 | 40 | -------------------------------------------------------------------------------- /gi_repository/overrides/GstPbutils.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Gst.py 5 | # 6 | # Copyright (C) 2012 Alessandro Decina 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU Lesser General Public 10 | # License as published by the Free Software Foundation; either 11 | # version 2.1 of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # Lesser General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public 19 | # License along with this program; if not, write to the 20 | # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | # Boston, MA 02110-1301, USA. 22 | # This program is free software; you can redistribute it and/or modify 23 | # it under the terms of the GNU General Public License as published by 24 | # the Free Software Foundation; either version 3, or (at your option) 25 | # any later version. 26 | 27 | from ..overrides import override as override_ 28 | from ..importer import modules 29 | 30 | from gi.repository import Gst 31 | 32 | GstPbutils = modules['GstPbutils']._introspection_module 33 | __all__ = [] 34 | 35 | def override(cls): 36 | name = cls.__name__ 37 | globals()[name] = override_(cls) 38 | __all__.append(name) 39 | 40 | return cls 41 | 42 | @override 43 | class EncodingVideoProfile(GstPbutils.EncodingVideoProfile): 44 | def __init__(self, format, preset=None, restriction=None, presence=0): 45 | GstPbutils.EncodingVideoProfile.__init__(self) 46 | self.set_format(format) 47 | if preset is not None: 48 | self.set_preset(preset) 49 | if restriction is None: 50 | restriction = Gst.Caps('ANY') 51 | self.set_restriction(restriction) 52 | self.set_presence(presence) 53 | 54 | @override 55 | class EncodingAudioProfile(GstPbutils.EncodingAudioProfile): 56 | def __init__(self, format, preset=None, restriction=None, presence=0): 57 | GstPbutils.EncodingAudioProfile.__init__(self) 58 | self.set_format(format) 59 | if preset is not None: 60 | self.set_preset(preset) 61 | if restriction is None: 62 | restriction = Gst.Caps('ANY') 63 | self.set_restriction(restriction) 64 | self.set_presence(presence) 65 | 66 | @override 67 | class EncodingContainerProfile(GstPbutils.EncodingContainerProfile): 68 | def __init__(self, name, description, format, preset=None): 69 | GstPbutils.EncodingContainerProfile.__init__(self) 70 | self.set_format(format) 71 | if name is not None: 72 | self.set_name(name) 73 | if description is not None: 74 | self.set_description(description) 75 | if preset is not None: 76 | self.set_preset(preset) 77 | -------------------------------------------------------------------------------- /gi_repository/overrides/Pango.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2010 Paolo Borelli 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 | # USA 20 | 21 | from ..overrides import override 22 | from ..module import get_introspection_module 23 | 24 | Pango = get_introspection_module('Pango') 25 | 26 | __all__ = [] 27 | 28 | 29 | class FontDescription(Pango.FontDescription): 30 | 31 | def __new__(cls, string=None): 32 | if string is not None: 33 | return Pango.font_description_from_string(string) 34 | else: 35 | return Pango.FontDescription.__new__(cls) 36 | 37 | def __init__(self, *args, **kwargs): 38 | return super(FontDescription, self).__init__() 39 | 40 | FontDescription = override(FontDescription) 41 | __all__.append('FontDescription') 42 | 43 | 44 | class Layout(Pango.Layout): 45 | 46 | def __new__(cls, context): 47 | return Pango.Layout.new(context) 48 | 49 | def set_markup(self, text, length=-1): 50 | super(Layout, self).set_markup(text, length) 51 | 52 | Layout = override(Layout) 53 | __all__.append('Layout') 54 | -------------------------------------------------------------------------------- /gi_repository/overrides/keysyms.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # pygtk - Python bindings for the GTK toolkit. 3 | # Copyright (C) 1998-2003 James Henstridge 4 | # 5 | # gtk/keysyms.py: list of keysyms. 6 | # 7 | # This library is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public 9 | # License as published by the Free Software Foundation; either 10 | # version 2.1 of the License, or (at your option) any later version. 11 | # 12 | # This library is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this library; if not, see . 19 | 20 | import sys 21 | import warnings 22 | 23 | from ..module import get_introspection_module 24 | 25 | Gdk = get_introspection_module('Gdk') 26 | 27 | warnings.warn('keysyms has been deprecated. Please use Gdk.KEY_ instead.', 28 | RuntimeWarning) 29 | 30 | _modname = globals()['__name__'] 31 | _keysyms = sys.modules[_modname] 32 | 33 | for name in dir(Gdk): 34 | if name.startswith('KEY_'): 35 | target = name[4:] 36 | if target[0] in '0123456789': 37 | target = '_' + target 38 | value = getattr(Gdk, name) 39 | setattr(_keysyms, target, value) 40 | 41 | 42 | # Not found in Gdk but left for compatibility. 43 | Armenian_eternity = 0x14a1 44 | Armenian_section_sign = 0x14a2 45 | Armenian_parenleft = 0x14a5 46 | Armenian_guillemotright = 0x14a6 47 | Armenian_guillemotleft = 0x14a7 48 | Armenian_em_dash = 0x14a8 49 | Armenian_dot = 0x14a9 50 | Armenian_mijaket = 0x14a9 51 | Armenian_comma = 0x14ab 52 | Armenian_en_dash = 0x14ac 53 | Armenian_ellipsis = 0x14ae 54 | -------------------------------------------------------------------------------- /gi_repository/pygtkcompat.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | import warnings 3 | 4 | from gi import PyGIDeprecationWarning 5 | 6 | warnings.warn('gi.pygtkcompat is being deprecated in favor of using "pygtkcompat" directly.', 7 | PyGIDeprecationWarning) 8 | 9 | # pyflakes.ignore 10 | from pygtkcompat import (enable, 11 | enable_gtk, 12 | enable_vte, 13 | enable_poppler, 14 | enable_webkit, 15 | enable_gudev, 16 | enable_gst, 17 | enable_goocanvas) 18 | 19 | 20 | __all__ = ['enable', 21 | 'enable_gtk', 22 | 'enable_vte', 23 | 'enable_poppler', 24 | 'enable_webkit', 25 | 'enable_gudev', 26 | 'enable_gst', 27 | 'enable_goocanvas'] 28 | -------------------------------------------------------------------------------- /gi_repository/repository/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2009 Johan Dahlin 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 | # USA 20 | 21 | from __future__ import absolute_import 22 | 23 | import sys 24 | 25 | from ..importer import DynamicImporter 26 | 27 | sys.meta_path.append(DynamicImporter('gi.repository')) 28 | 29 | del DynamicImporter 30 | del sys 31 | -------------------------------------------------------------------------------- /lib32/LIBSTEAM.LICENSE: -------------------------------------------------------------------------------- 1 | YOU SHOULD CAREFULLY READ THE ENTIRE FOLLOWING LICENSE AGREEMENT BEFORE INSTALLING THIS SOFTWARE PROGRAM. THIS AGREEMENT CONTAINS IMPORTANT TERMS THAT AFFECT YOUR LEGAL RIGHTS. BY INSTALLING THE SOFTWARE PROGRAM, YOU AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, PLEASE DO NOT INSTALL THIS SOFTWARE PROGRAM. 2 | 3 | The software application(s) (the “Program”) is the copyrighted work of Valve Corporation (“Valve”) or its suppliers. All rights reserved, except as expressly stated herein. The Program is provided solely for installation by end users according to the terms of this License Agreement, except as provided below regarding permitted redistributions. All use of the Program is governed by the terms of the Steam subscriber agreement located at www.steampowered.com/agreement (the “Steam Agreement”), as such terms may be updated from time to time, which terms are incorporated into this License Agreement by this reference. Any use, reproduction or redistribution of the Program not in accordance with the terms of the License Agreement and the Steam Agreement is expressly prohibited. 4 | 5 | LICENSE AGREEMENT 6 | 7 | 1. Grant of Licenses. 8 | 9 | A. Personal Use Limited Installation License. Valve hereby grants, and by installing the Program you thereby accept, a limited, non-exclusive license and right to install copies of the Program on each of your computers solely for your personal use. 10 | 11 | B. Limited Redistribution License. Valve hereby grants, and you accept, a limited, terminable, non-exclusive license to reproduce and distribute an unlimited number of copies of the Program; provided that the following conditions are met: 12 | (i) you must distribute the Program in its entirety; 13 | 14 | (ii) you may not modify the Program, except that, in the case of the Linux version of the Program, you may modify scripts and other documentary and graphical files, but not any files containing the term “bootstrap” in the file name, provided that you do not modify any icons, change any copyright or other notices, or alter this or any other license agreement that is included with the Program, and provided further that any modifications you make are identified by you as modifications from the original Program provided by Valve; 15 | 16 | (iii) you may repackage the Program and distribute it with another software program, provided that you do not integrate the Program in any way with that other software program, or combine the Program with that other software program in a manner that would require you to distribute the Program under any open source or other license terms different from these terms. 17 | 18 | (iv) you may not charge any separate fee or receive any compensation attributable to the Program; 19 | 20 | (v) you must include this License Agreement provided with the Program and ensure that it will display and be required to be accepted by the end user in the same manner as is required by the Program in the form received by you; and 21 | 22 | (vi) you must preserve in all copies of the Program all copyright and legal notices that are attached to the copy of the Program received by you. 23 | 24 | C. Restrictions/Reservation of Rights. Except as expressly set forth elsewhere in this License Agreement, you may not, in whole or in part: copy, photocopy, reproduce, translate, reverse engineer (with the exception of specific circumstances where such act is permitted by law), derive source code from, modify, disassemble, decompile, or create derivative works based on the Program; remove any proprietary notices or labels on the Program; or attempt in any manner to circumvent any security measures designed to control access to the Program. You may not package the Program with, or pre-install the Program on, any hardware, without obtaining a separate license from us. The Program is licensed to you as a single product. Its component parts may not be separated for use on more than one computer. You may not sell, grant a security interest in, rent, lease or license the Program to others without the prior written consent of Valve. The Program is licensed, not sold. Your license confers no title or ownership in the Program or copies thereof. 25 | 26 | 2. Ownership. All title, ownership rights and intellectual property rights in and to the Program and any and all copies thereof (including but not limited to any titles, computer code, themes, objects, characters, character names, stories, dialog, catch phrases, locations, concepts, artwork, animations, sounds, musical compositions, audio-visual effects, methods of operation, moral rights, any related documentation, and “applets” incorporated into the Program) are owned by Valve or its licensors. The Program is protected by the copyright laws of the United States, international copyright treaties and conventions and other laws. All rights are reserved. The Program contains certain licensed materials and Valve’s licensors may protect their rights in the event of any violation of this Agreement. 27 | 28 | 3. Termination. This License Agreement is effective until terminated. You may terminate the License Agreement at any time by destroying the Program. We may terminate your rights set forth in Section 1.B. of this License Agreement at any time upon notice to you. This License Agreement shall automatically terminate in the event that you fail to comply with the terms and conditions contained herein. In such event, you must immediately destroy the Program. The provisions of Sections 2, 3, and 5-7 will survive any termination of the Agreement. 29 | 30 | 4. Export Controls. The Program may not be re-exported, downloaded or otherwise exported into (or to a national or resident of) any country to which the U.S. has embargoed goods, or to anyone on the U.S. Treasury Department’s list of Specially Designated Nationals or the U.S. Commerce Department’s Table of Denial Orders. By installing the Program, you are agreeing to the foregoing and you are representing and warranting that you are not located in, under the control of, or a national or resident of any such country or on any such list. 31 | 32 | 5. WARRANTY DISCLAIMERS; LIMITATION OF LIABILITY; NO GUARANTEES. DISCLAIMERS OF WARRANTY AND LIMITATIONS ON LIABILITY SET FORTH IN THE STEAM AGREEMENT, AND/OR ELSEWHERE IN THE STEAM AGREEMENT, APPLY TO YOUR USE OF THE PROGRAM. AS NOTED IN THE STEAM AGREEMENT, FOR EU CUSTOMERS, SUCH PROVISIONS DO NOT REDUCE YOUR MANDATORY CONSUMERS’ RIGHTS UNDER THE LAWS OF YOUR LOCAL JURISDICTION. 33 | 34 | 6. Warranties/Indemnities Relating to Redistribution. If you choose to redistribute the Program, you represent and warrant that any modifications you make to the Program, if any, and your particular combination of the Program with any other software or hardware, do not infringe on any third-party intellectual property rights. You agree to defend, indemnify and hold harmless Valve, its licensors, and its and their affiliates from all liabilities, claims and expenses, including attorneys’ fees, that arise from or in connection with your redistribution of any modifications you make to the Program or your particular combination of the Program with any other software or hardware or your breach of this License Agreement. Valve reserves the right, at its own expense, to assume the exclusive defense and control of any matter otherwise subject to indemnification by you. In that event, you shall have no further obligation to provide indemnification to Valve in that matter. 35 | 36 | 7. Miscellaneous. Provisions relating to applicable law and jurisdiction, and dispute resolution, set forth in the Steam Agreement shall apply to any disputes arising under this Agreement. This License Agreement and the Steam Agreement terms incorporated herein may be amended, altered or modified at any time by Valve in Valve’s sole discretion. In the event that any provision of this License Agreement shall be held by a court or other tribunal of competent jurisdiction to be unenforceable, such provision will be enforced to the maximum extent permissible and the remaining portions of this License Agreement shall remain in full force and effect. This License Agreement and the Steam Agreement constitute and contain the entire agreement between the parties with respect to the subject matter hereof and supersede any prior oral or written agreements. 37 | You hereby acknowledge that you have read and understand the foregoing License Agreement and agree that the action of installing the Program is an acknowledgment of your agreement to be bound by the terms and conditions of the License Agreement contained herein, including the Steam Agreement. 38 | -------------------------------------------------------------------------------- /lib32/_gi.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/_gi.pyd -------------------------------------------------------------------------------- /lib32/_gi_cairo.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/_gi_cairo.pyd -------------------------------------------------------------------------------- /lib32/girepository-1.0/Atk-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/Atk-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/DBus-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/DBus-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/DBusGLib-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/DBusGLib-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GDesktopEnums-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GDesktopEnums-3.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GIRepository-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GIRepository-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GL-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GL-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GLib-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GLib-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GModule-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GModule-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GObject-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GObject-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/Gdk-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/Gdk-3.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GdkPixbuf-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GdkPixbuf-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/GdkWin32-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/GdkWin32-3.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/Gio-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/Gio-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/Gtk-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/Gtk-3.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/Pango-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/Pango-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/PangoCairo-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/PangoCairo-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/Rsvg-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/Rsvg-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/cairo-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/cairo-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/fontconfig-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/fontconfig-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/freetype2-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/freetype2-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/libxml2-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/libxml2-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/win32-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/win32-1.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/xfixes-4.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/xfixes-4.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/xft-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/xft-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/xlib-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/xlib-2.0.typelib -------------------------------------------------------------------------------- /lib32/girepository-1.0/xrandr-1.3.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/girepository-1.0/xrandr-1.3.typelib -------------------------------------------------------------------------------- /lib32/libatk-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libatk-1.0-0.dll -------------------------------------------------------------------------------- /lib32/libcairo-gobject-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libcairo-gobject-2.dll -------------------------------------------------------------------------------- /lib32/libffi-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libffi-6.dll -------------------------------------------------------------------------------- /lib32/libgdk-3-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgdk-3-0.dll -------------------------------------------------------------------------------- /lib32/libgdk_pixbuf-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgdk_pixbuf-2.0-0.dll -------------------------------------------------------------------------------- /lib32/libgio-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgio-2.0-0.dll -------------------------------------------------------------------------------- /lib32/libgirepository-1.0-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgirepository-1.0-1.dll -------------------------------------------------------------------------------- /lib32/libglib-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libglib-2.0-0.dll -------------------------------------------------------------------------------- /lib32/libgmodule-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgmodule-2.0-0.dll -------------------------------------------------------------------------------- /lib32/libgobject-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgobject-2.0-0.dll -------------------------------------------------------------------------------- /lib32/libgthread-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgthread-2.0-0.dll -------------------------------------------------------------------------------- /lib32/libgtk-3-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libgtk-3-0.dll -------------------------------------------------------------------------------- /lib32/libintl-8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libintl-8.dll -------------------------------------------------------------------------------- /lib32/libpango-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libpango-1.0-0.dll -------------------------------------------------------------------------------- /lib32/libpangocairo-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libpangocairo-1.0-0.dll -------------------------------------------------------------------------------- /lib32/libpangowin32-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libpangowin32-1.0-0.dll -------------------------------------------------------------------------------- /lib32/libpng16-16.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libpng16-16.dll -------------------------------------------------------------------------------- /lib32/librsvg-2-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/librsvg-2-2.dll -------------------------------------------------------------------------------- /lib32/libsteam_api.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libsteam_api.dll -------------------------------------------------------------------------------- /lib32/libsteam_api.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libsteam_api.so -------------------------------------------------------------------------------- /lib32/libwinpthread-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libwinpthread-1.dll -------------------------------------------------------------------------------- /lib32/libz.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib32/libz.dll -------------------------------------------------------------------------------- /lib64/LIBSTEAM.LICENSE: -------------------------------------------------------------------------------- 1 | YOU SHOULD CAREFULLY READ THE ENTIRE FOLLOWING LICENSE AGREEMENT BEFORE INSTALLING THIS SOFTWARE PROGRAM. THIS AGREEMENT CONTAINS IMPORTANT TERMS THAT AFFECT YOUR LEGAL RIGHTS. BY INSTALLING THE SOFTWARE PROGRAM, YOU AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, PLEASE DO NOT INSTALL THIS SOFTWARE PROGRAM. 2 | 3 | The software application(s) (the “Program”) is the copyrighted work of Valve Corporation (“Valve”) or its suppliers. All rights reserved, except as expressly stated herein. The Program is provided solely for installation by end users according to the terms of this License Agreement, except as provided below regarding permitted redistributions. All use of the Program is governed by the terms of the Steam subscriber agreement located at www.steampowered.com/agreement (the “Steam Agreement”), as such terms may be updated from time to time, which terms are incorporated into this License Agreement by this reference. Any use, reproduction or redistribution of the Program not in accordance with the terms of the License Agreement and the Steam Agreement is expressly prohibited. 4 | 5 | LICENSE AGREEMENT 6 | 7 | 1. Grant of Licenses. 8 | 9 | A. Personal Use Limited Installation License. Valve hereby grants, and by installing the Program you thereby accept, a limited, non-exclusive license and right to install copies of the Program on each of your computers solely for your personal use. 10 | 11 | B. Limited Redistribution License. Valve hereby grants, and you accept, a limited, terminable, non-exclusive license to reproduce and distribute an unlimited number of copies of the Program; provided that the following conditions are met: 12 | (i) you must distribute the Program in its entirety; 13 | 14 | (ii) you may not modify the Program, except that, in the case of the Linux version of the Program, you may modify scripts and other documentary and graphical files, but not any files containing the term “bootstrap” in the file name, provided that you do not modify any icons, change any copyright or other notices, or alter this or any other license agreement that is included with the Program, and provided further that any modifications you make are identified by you as modifications from the original Program provided by Valve; 15 | 16 | (iii) you may repackage the Program and distribute it with another software program, provided that you do not integrate the Program in any way with that other software program, or combine the Program with that other software program in a manner that would require you to distribute the Program under any open source or other license terms different from these terms. 17 | 18 | (iv) you may not charge any separate fee or receive any compensation attributable to the Program; 19 | 20 | (v) you must include this License Agreement provided with the Program and ensure that it will display and be required to be accepted by the end user in the same manner as is required by the Program in the form received by you; and 21 | 22 | (vi) you must preserve in all copies of the Program all copyright and legal notices that are attached to the copy of the Program received by you. 23 | 24 | C. Restrictions/Reservation of Rights. Except as expressly set forth elsewhere in this License Agreement, you may not, in whole or in part: copy, photocopy, reproduce, translate, reverse engineer (with the exception of specific circumstances where such act is permitted by law), derive source code from, modify, disassemble, decompile, or create derivative works based on the Program; remove any proprietary notices or labels on the Program; or attempt in any manner to circumvent any security measures designed to control access to the Program. You may not package the Program with, or pre-install the Program on, any hardware, without obtaining a separate license from us. The Program is licensed to you as a single product. Its component parts may not be separated for use on more than one computer. You may not sell, grant a security interest in, rent, lease or license the Program to others without the prior written consent of Valve. The Program is licensed, not sold. Your license confers no title or ownership in the Program or copies thereof. 25 | 26 | 2. Ownership. All title, ownership rights and intellectual property rights in and to the Program and any and all copies thereof (including but not limited to any titles, computer code, themes, objects, characters, character names, stories, dialog, catch phrases, locations, concepts, artwork, animations, sounds, musical compositions, audio-visual effects, methods of operation, moral rights, any related documentation, and “applets” incorporated into the Program) are owned by Valve or its licensors. The Program is protected by the copyright laws of the United States, international copyright treaties and conventions and other laws. All rights are reserved. The Program contains certain licensed materials and Valve’s licensors may protect their rights in the event of any violation of this Agreement. 27 | 28 | 3. Termination. This License Agreement is effective until terminated. You may terminate the License Agreement at any time by destroying the Program. We may terminate your rights set forth in Section 1.B. of this License Agreement at any time upon notice to you. This License Agreement shall automatically terminate in the event that you fail to comply with the terms and conditions contained herein. In such event, you must immediately destroy the Program. The provisions of Sections 2, 3, and 5-7 will survive any termination of the Agreement. 29 | 30 | 4. Export Controls. The Program may not be re-exported, downloaded or otherwise exported into (or to a national or resident of) any country to which the U.S. has embargoed goods, or to anyone on the U.S. Treasury Department’s list of Specially Designated Nationals or the U.S. Commerce Department’s Table of Denial Orders. By installing the Program, you are agreeing to the foregoing and you are representing and warranting that you are not located in, under the control of, or a national or resident of any such country or on any such list. 31 | 32 | 5. WARRANTY DISCLAIMERS; LIMITATION OF LIABILITY; NO GUARANTEES. DISCLAIMERS OF WARRANTY AND LIMITATIONS ON LIABILITY SET FORTH IN THE STEAM AGREEMENT, AND/OR ELSEWHERE IN THE STEAM AGREEMENT, APPLY TO YOUR USE OF THE PROGRAM. AS NOTED IN THE STEAM AGREEMENT, FOR EU CUSTOMERS, SUCH PROVISIONS DO NOT REDUCE YOUR MANDATORY CONSUMERS’ RIGHTS UNDER THE LAWS OF YOUR LOCAL JURISDICTION. 33 | 34 | 6. Warranties/Indemnities Relating to Redistribution. If you choose to redistribute the Program, you represent and warrant that any modifications you make to the Program, if any, and your particular combination of the Program with any other software or hardware, do not infringe on any third-party intellectual property rights. You agree to defend, indemnify and hold harmless Valve, its licensors, and its and their affiliates from all liabilities, claims and expenses, including attorneys’ fees, that arise from or in connection with your redistribution of any modifications you make to the Program or your particular combination of the Program with any other software or hardware or your breach of this License Agreement. Valve reserves the right, at its own expense, to assume the exclusive defense and control of any matter otherwise subject to indemnification by you. In that event, you shall have no further obligation to provide indemnification to Valve in that matter. 35 | 36 | 7. Miscellaneous. Provisions relating to applicable law and jurisdiction, and dispute resolution, set forth in the Steam Agreement shall apply to any disputes arising under this Agreement. This License Agreement and the Steam Agreement terms incorporated herein may be amended, altered or modified at any time by Valve in Valve’s sole discretion. In the event that any provision of this License Agreement shall be held by a court or other tribunal of competent jurisdiction to be unenforceable, such provision will be enforced to the maximum extent permissible and the remaining portions of this License Agreement shall remain in full force and effect. This License Agreement and the Steam Agreement constitute and contain the entire agreement between the parties with respect to the subject matter hereof and supersede any prior oral or written agreements. 37 | You hereby acknowledge that you have read and understand the foregoing License Agreement and agree that the action of installing the Program is an acknowledgment of your agreement to be bound by the terms and conditions of the License Agreement contained herein, including the Steam Agreement. 38 | -------------------------------------------------------------------------------- /lib64/_gi.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/_gi.pyd -------------------------------------------------------------------------------- /lib64/_gi_cairo.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/_gi_cairo.pyd -------------------------------------------------------------------------------- /lib64/girepository-1.0/Atk-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/Atk-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/DBus-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/DBus-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/DBusGLib-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/DBusGLib-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GDesktopEnums-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GDesktopEnums-3.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GIRepository-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GIRepository-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GL-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GL-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GLib-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GLib-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GModule-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GModule-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GObject-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GObject-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/Gdk-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/Gdk-3.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GdkPixbuf-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GdkPixbuf-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/GdkWin32-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/GdkWin32-3.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/Gio-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/Gio-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/Gtk-3.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/Gtk-3.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/Pango-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/Pango-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/PangoCairo-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/PangoCairo-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/Rsvg-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/Rsvg-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/cairo-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/cairo-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/fontconfig-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/fontconfig-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/freetype2-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/freetype2-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/libxml2-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/libxml2-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/win32-1.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/win32-1.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/xfixes-4.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/xfixes-4.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/xft-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/xft-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/xlib-2.0.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/xlib-2.0.typelib -------------------------------------------------------------------------------- /lib64/girepository-1.0/xrandr-1.3.typelib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/girepository-1.0/xrandr-1.3.typelib -------------------------------------------------------------------------------- /lib64/libatk-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libatk-1.0-0.dll -------------------------------------------------------------------------------- /lib64/libcairo-gobject-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libcairo-gobject-2.dll -------------------------------------------------------------------------------- /lib64/libffi-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libffi-6.dll -------------------------------------------------------------------------------- /lib64/libgdk-3-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgdk-3-0.dll -------------------------------------------------------------------------------- /lib64/libgdk_pixbuf-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgdk_pixbuf-2.0-0.dll -------------------------------------------------------------------------------- /lib64/libgio-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgio-2.0-0.dll -------------------------------------------------------------------------------- /lib64/libgirepository-1.0-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgirepository-1.0-1.dll -------------------------------------------------------------------------------- /lib64/libglib-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libglib-2.0-0.dll -------------------------------------------------------------------------------- /lib64/libgmodule-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgmodule-2.0-0.dll -------------------------------------------------------------------------------- /lib64/libgobject-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgobject-2.0-0.dll -------------------------------------------------------------------------------- /lib64/libgthread-2.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgthread-2.0-0.dll -------------------------------------------------------------------------------- /lib64/libgtk-3-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libgtk-3-0.dll -------------------------------------------------------------------------------- /lib64/libintl-8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libintl-8.dll -------------------------------------------------------------------------------- /lib64/libpango-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libpango-1.0-0.dll -------------------------------------------------------------------------------- /lib64/libpangocairo-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libpangocairo-1.0-0.dll -------------------------------------------------------------------------------- /lib64/libpangowin32-1.0-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libpangowin32-1.0-0.dll -------------------------------------------------------------------------------- /lib64/libpng16-16.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libpng16-16.dll -------------------------------------------------------------------------------- /lib64/librsvg-2-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/librsvg-2-2.dll -------------------------------------------------------------------------------- /lib64/libsteam_api.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libsteam_api.dll -------------------------------------------------------------------------------- /lib64/libsteam_api.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libsteam_api.so -------------------------------------------------------------------------------- /lib64/libwinpthread-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libwinpthread-1.dll -------------------------------------------------------------------------------- /lib64/libz.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/lib64/libz.dll -------------------------------------------------------------------------------- /release.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import glob 20 | import importlib.machinery 21 | import os 22 | import shutil 23 | import subprocess 24 | import sys 25 | import tempfile 26 | import time 27 | 28 | __version_module_path__ = os.path.join('ui', 'version.py') 29 | __version_class__ = importlib.machinery.SourceFileLoader('version', __version_module_path__) 30 | version = __version_class__.load_module() 31 | 32 | script_path = os.path.dirname(os.path.abspath(sys.argv[0])) 33 | build_path = os.path.join(script_path, 'dist') 34 | release_path = os.path.join(script_path, 'release') 35 | temporary_path = tempfile.mktemp(prefix='steam_tools_release_') 36 | 37 | 38 | # noinspection PyShadowingNames 39 | def update_version(current_system, current_arch): 40 | global version 41 | __version_module_path__ = os.path.join(build_path, 'version.pyc') 42 | __version_class__ = importlib.machinery.SourcelessFileLoader('version', __version_module_path__) 43 | 44 | try: 45 | __version_module__ = __version_class__.load_module() 46 | 47 | for var in dir(__version_module__): 48 | setattr(version, var, eval('__version_module__.' + var)) 49 | except FileNotFoundError: 50 | setattr(version, '__VERSION_EXTRA__', ''.join([str(current_system), str(current_arch)])) 51 | 52 | version.__VERSION__ = '{}.{}.{} {}'.format(version.__VERSION_MAJOR__, 53 | version.__VERSION_MINOR__, 54 | version.__VERSION_REVISION__, 55 | version.__VERSION_EXTRA__) 56 | 57 | 58 | def safe_call(call): 59 | try: 60 | print('Calling:', ' '.join(call)) 61 | subprocess.check_call(call) 62 | except subprocess.CalledProcessError as e: 63 | print("command: {}\nrcode: {}".format(call, e.returncode)) 64 | sys.exit(1) 65 | except FileNotFoundError as e: 66 | print("Something is missing in your system for make an complete release") 67 | print("command: {}".format(call)) 68 | print(e) 69 | sys.exit(1) 70 | 71 | 72 | def build(current_system, current_arch, force=False): 73 | print("\n--------------------------------------------") 74 | print("Build Configuration:") 75 | print(" - System: {}".format(current_system)) 76 | print(" - Architecture: {} bits".format(current_arch)) 77 | print(" - Version: {}.{}.{}\n".format(version.__VERSION_MAJOR__, 78 | version.__VERSION_MINOR__, 79 | version.__VERSION_REVISION__)) 80 | 81 | for timer in range(5, 0, -1): 82 | print('Starting in', timer, end='\r') 83 | time.sleep(1) 84 | print('\n') 85 | 86 | if current_system == 'Linux': 87 | if os.name == 'nt' and not os.getenv('PWD'): 88 | interpreter = ['C:\\msys64\\usr\\bin\\python3.4.exe', '-u'] 89 | else: 90 | interpreter = ['/usr/bin/python3', '-u'] 91 | 92 | params = ['setup.py', 'sdist'] 93 | archive_extension_ = '.tar.gz' 94 | 95 | if not os.path.isfile(interpreter[0]): 96 | print('Linux Python interpreter not found.') 97 | print('Cannot build for Linux. Ignoring.') 98 | return None 99 | 100 | print('Building...') 101 | safe_call(interpreter + params) 102 | 103 | update_version(current_system, current_arch) 104 | else: 105 | if os.name == 'posix' and not sys.platform == 'cygwin': 106 | print('You cannot build steam tools for Windows from Linux. Ignoring.') 107 | return None 108 | 109 | interpreter = [os.path.join('scripts', 'build.cmd')] 110 | 111 | if current_arch == 64: 112 | if sys.maxsize > 2**32: 113 | params = ['Python34-x64'] 114 | else: 115 | print('You cannot build steam tools for Windows64 from Windows32. Ignoring.') 116 | return None 117 | else: 118 | if sys.maxsize > 2**32 and not force: 119 | print('Use `force\' param to build 32bits version from Windows64.') 120 | return None 121 | else: 122 | params = ['Python34'] 123 | 124 | archive_extension_ = '.zip' 125 | 126 | print('Building...') 127 | safe_call(interpreter + params) 128 | 129 | update_version(current_system, current_arch) 130 | 131 | safe_call([os.path.join('scripts', 'package.cmd'), 132 | '-'.join(version.__VERSION__.split(' '))]) 133 | 134 | archive_name_ = 'Steam Tools-{}'.format('-'.join(version.__VERSION__.split(' '))) 135 | archive_in_path_ = os.path.join('dist', archive_name_ + archive_extension_) 136 | archive_out_path_ = os.path.join(temporary_path, archive_name_ + archive_extension_) 137 | shutil.move(archive_in_path_, archive_out_path_) 138 | 139 | return archive_out_path_ 140 | 141 | 142 | if __name__ == '__main__': 143 | builds = {'Windows': [32, 64], 144 | 'Linux': ['All']} 145 | 146 | zip_file_paths = [] 147 | 148 | if os.path.isdir(release_path): 149 | shutil.rmtree(release_path) 150 | 151 | if not os.path.isdir(temporary_path): 152 | os.makedirs(temporary_path) 153 | 154 | if len(sys.argv) > 1 and sys.argv[1] == 'force': 155 | force=True 156 | else: 157 | force=False 158 | 159 | for system, archs in builds.items(): 160 | for arch in archs: 161 | os.system('git clean -fdx') 162 | archive_path = build(system, arch, force) 163 | zip_file_paths.append(archive_path) 164 | 165 | print('Releasing...') 166 | 167 | if not os.path.isdir(release_path): 168 | os.makedirs(release_path) 169 | 170 | for path in zip_file_paths: 171 | if path: 172 | shutil.move(path, release_path) 173 | 174 | print('Done.') 175 | -------------------------------------------------------------------------------- /scripts/build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | pushd -d "$0\.." 4 | 5 | if "%1" == "" goto nopython 6 | 7 | echo "Compiling..." 8 | 9 | call "C:\\%1\\python.exe" -u setup.py py2exe 10 | 11 | cd dist 12 | 13 | echo "Optimizing..." 14 | 15 | if exist "C:\\7-zip\\7z.exe" set PATH="%PATH%;C:\\7-zip\\7z.exe" 16 | 17 | 7z -aoa x library.zip -olibrary 18 | del library.zip 19 | 20 | cd library 21 | 7z a -tzip -mx9 ..\library.zip -r 22 | cd.. 23 | rd library /s /q 24 | 25 | call "C:\UPX\upx.exe" --best *.* 26 | 27 | exit 0 28 | 29 | :nopython 30 | echo Please, specify the python version. 31 | goto error 32 | 33 | :error 34 | popd 35 | exit 1 36 | -------------------------------------------------------------------------------- /scripts/fix_wire.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pushd $(dirname $0) 4 | 5 | echo "Fixing..." 6 | sed 's/0.019999999552965164/0.02/g' -i ../ui/interface.xml 7 | sed '/Steam login status/{n;s|pixbuf">icons/steam-tools|pixbuf">icons/steam|}' -i ../ui/interface.xml 8 | sed '/SteamGifts login status/{n;s|pixbuf">icons/steam-tools|pixbuf">icons/steamgifts|}' -i ../ui/interface.xml 9 | sed '/SteamCompanion login status/{n;s|pixbuf">icons/steam-tools|pixbuf">icons/steamcompanion|}' -i ../ui/interface.xml 10 | sed '/SteamTrades login status/{n;s|pixbuf">icons/steam-tools|pixbuf">icons/steamtrades|}' -i ../ui/interface.xml 11 | sed 's|icon">icons/steam-tools.png|icon">icons/steam-tools.ico|' -i ../ui/interface.xml 12 | echo "Done." 13 | 14 | popd 15 | -------------------------------------------------------------------------------- /scripts/package.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | pushd -d "$0\.." 4 | 5 | if "%1" == "" goto noversion 6 | 7 | echo "Building package..." 8 | 9 | if exist "C:\\7-zip\\7z.exe" set PATH="%PATH%;C:\\7-zip\\7z.exe" 10 | 11 | rename dist "Steam Tools-%1" 12 | 7z a -tzip -mx9 "Steam Tools-%1.zip" "Steam Tools-%1" -r 13 | mkdir dist 14 | move "Steam Tools-%1.zip" dist 15 | 16 | exit 0 17 | 18 | :noversion 19 | echo Please, specify a ST version 20 | goto error 21 | 22 | :error 23 | popd 24 | exit 1 -------------------------------------------------------------------------------- /scripts/update_gtk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | msys_dir=/cygdrive/c/msys64 4 | supported_arch=(32 64) 5 | 6 | required_dlls=( 7 | 'libgtk-3-0.dll' 8 | 'libgdk-3-0.dll' 9 | 'libgdk_pixbuf-2.0-0.dll' 10 | 'libpango-1.0-0.dll' 11 | 'libpangocairo-1.0-0.dll' 12 | 'libpangowin32-1.0-0.dll' 13 | 'libatk-1.0-0.dll' 14 | 'libcairo-gobject-2.dll' 15 | 'libffi-6.dll' 16 | 'libgio-2.0-0.dll' 17 | 'libgirepository-1.0-1.dll' 18 | 'libglib-2.0-0.dll' 19 | 'libgmodule-2.0-0.dll' 20 | 'libgobject-2.0-0.dll' 21 | 'libgthread-2.0-0.dll' 22 | 'libintl-8.dll' 23 | 'libpng16-16.dll' 24 | 'librsvg-2-2.dll' 25 | 'libwinpthread-1.dll' 26 | ) 27 | 28 | pushd $(dirname $0)/.. 29 | 30 | echo -e "\nCleaning...\n" 31 | 32 | rm -rfv gi_repository/ 33 | 34 | mkdir -p gi_repository \ 35 | lib32.new/girepository-1.0 \ 36 | lib64.new/girepository-1.0 37 | 38 | mv lib32/libsteam* lib32.new/ 39 | mv lib64/libsteam* lib64.new/ 40 | mv lib32/LIBSTEAM* lib32.new/ 41 | mv lib64/LIBSTEAM* lib64.new/ 42 | 43 | rm -rfv lib32 lib64 44 | mv lib32.new lib32 45 | mv lib64.new lib64 46 | 47 | echo -e "\nUpdating...\n" 48 | 49 | for arch in ${supported_arch[@]}; do 50 | mingw_dir=$msys_dir/mingw${arch} 51 | library_dir=lib${arch} 52 | 53 | cp -rfv $mingw_dir/lib/girepository-1.0/* $library_dir/girepository-1.0/ 54 | 55 | for dll in ${required_dlls[@]}; do 56 | cp -rfv $mingw_dir/bin/$dll $library_dir/ 57 | done 58 | done 59 | 60 | cp -rfv $msys_dir/mingw64/lib/python3.5/site-packages/gi/* gi_repository/ 61 | 62 | echo -e "\nCleanup unneded...\n" 63 | 64 | rm -fv gi_repository/*.pyc 65 | rm -fv gi_repository/*.a 66 | rm -fv gi_repository/*cpython* 67 | 68 | for arch in ${supported_arch[@]}; do 69 | library_dir=lib${arch} 70 | rm -fv $library_dir/girepository-1.0/HarfBuzz* 71 | rm -fv $library_dir/girepository-1.0/Json* 72 | rm -fv $library_dir/girepository-1.0/PangoFT2* 73 | done 74 | 75 | echo -e "\nDone.\n" 76 | 77 | popd 78 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [install] 2 | prefix=/usr/local 3 | install_data=$prefix/share/steam-tools 4 | install_scripts=$prefix/bin 5 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import compileall 20 | import importlib.machinery 21 | import os 22 | import sys 23 | from distutils.command.install_scripts import install_scripts 24 | from distutils.core import setup 25 | 26 | __version_module_path__ = os.path.join('ui', 'version.py') 27 | __version_class__ = importlib.machinery.SourceFileLoader('version', __version_module_path__) 28 | version = __version_class__.load_module() 29 | 30 | 31 | def arch(): 32 | if sys.maxsize > 2 ** 32: 33 | return 64 34 | else: 35 | return 32 36 | 37 | 38 | libdir = 'lib' + str(arch()) 39 | 40 | if os.name == 'nt': 41 | if 'build' in sys.argv or 'install' in sys.argv: 42 | print("You cannot use build/install command with Windows.") 43 | sys.exit(1) 44 | 45 | import site 46 | import atexit 47 | import shutil 48 | import tempfile 49 | import textwrap 50 | # noinspection PyUnresolvedReferences 51 | import py2exe 52 | import requests.certs 53 | from compileall import compile_file 54 | 55 | # Fix site for gi.repository 56 | temporary_site = tempfile.mktemp() 57 | shutil.copytree('gi_repository', os.path.join(temporary_site, 'gi')) 58 | site.addsitedir(temporary_site) 59 | elif 'py2exe' in sys.argv: 60 | print("You cannot use py2exe without a Windows Python") 61 | print("Rerun with the correct python version") 62 | sys.exit(1) 63 | 64 | 65 | class CheckExtension(install_scripts): 66 | def run(self): 67 | install_scripts.run(self) 68 | for script in self.get_outputs(): 69 | if script.endswith('.py') and os.name != 'nt': 70 | os.rename(script, script[:-3]) 71 | 72 | 73 | if os.name == 'nt': 74 | data_files = [('', [os.path.join(libdir, 'libsteam_api.dll')])] 75 | else: 76 | data_files = [('', [os.path.join(libdir, 'libsteam_api.so')])] 77 | 78 | data_files.append(('ui', [os.path.join('ui', 'interface.xml'), 79 | os.path.join('ui', 'interface.css'), 80 | os.path.join('ui', 'menu.xml')])) 81 | 82 | # Include icons 83 | icons_path = os.path.join('ui', 'icons') 84 | for icon in os.listdir(icons_path): 85 | if os.path.isfile(os.path.join(icons_path, icon)): 86 | data_files.append((icons_path, [os.path.join(icons_path, icon)])) 87 | 88 | 89 | def py2exe_options(): 90 | if os.name == 'nt': 91 | packages = ['gi', 92 | 'psutil', 93 | 'requests', 94 | 'gevent', 95 | 'bs4'] 96 | 97 | py2exe_options_ = {'bundle_files': 3, 98 | 'optimize': 1, 99 | 'compressed': 0, 100 | 'packages': packages} 101 | 102 | program_icon = os.path.join('ui', 'icons', 'steam-tools.ico') 103 | 104 | main_script = {'script': 'steam-tools.py', 105 | 'icon_resources': [(1, program_icon)], 106 | 'copyright': 'Copyright (C) 2016 Lara Maia', 107 | 'version': '{}.{}.{}'.format(version.__VERSION_MAJOR__, 108 | version.__VERSION_MINOR__, 109 | version.__VERSION_REVISION__), 110 | } 111 | 112 | libsteam_script = {'script': os.path.join('stlib', 'libsteam_wrapper.py')} 113 | 114 | options = {'py2exe': py2exe_options_} 115 | 116 | return {'console': [main_script, libsteam_script], 117 | 'options': options} 118 | else: 119 | return {} 120 | 121 | 122 | def fix_gevent(): 123 | for site_ in site.getsitepackages(): 124 | full_path = os.path.join(site_, 'gevent') 125 | if os.path.isdir(full_path): 126 | for file_ in os.listdir(full_path): 127 | if file_ == '_util_py2.py': 128 | os.remove(os.path.join(full_path, file_)) 129 | 130 | 131 | def fix_cacert(): 132 | requests_path = os.path.dirname(requests.__file__) 133 | cacert_file = os.path.join(requests_path, 'cacert.pem') 134 | certs_wrapper = os.path.join(requests_path, 'certs.py') 135 | 136 | if os.path.isfile(certs_wrapper + '.bak'): 137 | os.remove(certs_wrapper + '.bak') 138 | 139 | os.rename(certs_wrapper, certs_wrapper + '.bak') 140 | 141 | def fallback(): 142 | os.remove(certs_wrapper) 143 | os.rename(certs_wrapper + '.bak', certs_wrapper) 144 | compile_file(certs_wrapper, force=True, quiet=1) 145 | 146 | atexit.register(fallback) 147 | 148 | with open(certs_wrapper, 'w') as f: 149 | f.write(textwrap.dedent("""\ 150 | import os, sys 151 | 152 | def where(): 153 | return os.path.join(os.path.dirname(sys.executable), 'cacert.pem') 154 | """)) 155 | 156 | compile_file(certs_wrapper, force=True, quiet=1) 157 | 158 | data_files.append(('', [cacert_file])) 159 | 160 | 161 | def fix_gtk(): 162 | # Add dlls 163 | for file_ in os.listdir(libdir): 164 | if file_.endswith('.dll'): 165 | data_files.append(('', [os.path.join(libdir, file_)])) 166 | elif file_.endswith('.pyd'): 167 | shutil.copy(os.path.join(libdir, file_), 168 | os.path.join(temporary_site, 'gi')) 169 | 170 | # Add typelib 171 | typelib_directory = os.path.join(libdir, 'girepository-1.0') 172 | for file_ in os.listdir(typelib_directory): 173 | if file_.endswith('.typelib'): 174 | data_files.append((os.path.join('lib', 'girepository-1.0'), 175 | [os.path.join(typelib_directory, file_)])) 176 | 177 | # Add icons 178 | for root, dirs, files in os.walk(os.path.join('ui', 'icons', 'Default')): 179 | icons_path = os.path.join('share', 'icons', 'Default', root[17:]) 180 | for file_ in files: 181 | data_files.append((icons_path, [os.path.join(root, file_)])) 182 | 183 | # Fix default icon theme 184 | temporary_directory = tempfile.mktemp() 185 | os.makedirs(temporary_directory) 186 | settings_path = os.path.join(temporary_directory, 'settings.ini') 187 | with open(settings_path , 'w') as file_: 188 | file_.write('[Settings]\n') 189 | file_.write('gtk-icon-theme-name = Default\n') 190 | data_files.append((os.path.join('etc', 'gtk-3.0'), [settings_path])) 191 | 192 | 193 | if os.name == 'nt': 194 | fix_cacert() 195 | fix_gtk() 196 | fix_gevent() 197 | 198 | if os.name == 'nt': 199 | version_extra = 'Windows{}'.format(arch()) 200 | else: 201 | version_extra = 'LinuxAll' 202 | 203 | if not 'sdist' in sys.argv: 204 | with open('version.py', 'w') as file_: 205 | file_.write('__VERSION_EXTRA__ = "{}"'.format(version_extra)) 206 | 207 | compileall.compile_file('version.py', legacy=True) 208 | os.remove('version.py') 209 | data_files.append(('', ['version.pyc'])) 210 | 211 | setup( 212 | name='Steam Tools', 213 | 214 | version='{}.{}.{}-{}'.format(version.__VERSION_MAJOR__, 215 | version.__VERSION_MINOR__, 216 | version.__VERSION_REVISION__, 217 | version_extra), 218 | 219 | description="Some useful tools for use with steam client or compatible programs, websites. (Windows & Linux)", 220 | author='Lara Maia', 221 | author_email='dev@lara.click', 222 | url='http://github.com/ShyPixie/steam-tools', 223 | license='GPL', 224 | data_files=data_files, 225 | 226 | scripts=['steam-tools.py'], 227 | 228 | packages=['stlib', 229 | 'ui'], 230 | 231 | cmdclass={'install_scripts': CheckExtension}, 232 | 233 | requires=['pygobject', 234 | 'requests', 235 | 'gevent', 236 | 'beautifulsoup4', 237 | 'pycrypto'], 238 | 239 | **py2exe_options() 240 | ) 241 | -------------------------------------------------------------------------------- /steam-tools.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | # MUST be ALWAYS the first import 20 | # noinspection PyUnresolvedReferences 21 | import ui.fix_std 22 | 23 | import argparse 24 | import os 25 | import sys 26 | import textwrap 27 | 28 | import stlib 29 | 30 | if __name__ == "__main__": 31 | stlib.logging.console_msg('Steam Tools version {}'.format(ui.version.__VERSION__)) 32 | stlib.logging.console_msg('Copyright (C) 2016 Lara Maia - \n') 33 | 34 | command_parser = argparse.ArgumentParser( 35 | formatter_class=argparse.RawDescriptionHelpFormatter, 36 | epilog=textwrap.dedent(''' 37 | Available modules for console mode: 38 | - cardfarming 39 | - fakeapp 40 | - steamtrades_bump 41 | - steamgifts_join 42 | ''')) 43 | 44 | command_parser.add_argument('-c', '--cli', 45 | choices=['cardfarming', 'fakeapp', 'steamtrades_bump', 'steamgifts_join', 'authenticator'], 46 | metavar='module [options]', 47 | action='store', 48 | nargs=1, 49 | help='Start module without GUI (console mode)', 50 | dest='module') 51 | command_parser.add_argument('options', 52 | nargs='*', 53 | help=argparse.SUPPRESS) 54 | 55 | command_params = command_parser.parse_args() 56 | 57 | try: 58 | if command_params.module: 59 | if os.name is 'nt' and os.getenv('PWD'): 60 | stlib.logger.warning('Running steam tools from custom console is not supported on Windows.') 61 | stlib.logger.warning('Some problems may occur.') 62 | 63 | ST = ui.console.SteamTools(command_params) 64 | else: 65 | if os.name is 'posix' and not os.getenv('DISPLAY'): 66 | stlib.logger.error('The DISPLAY is not set!') 67 | stlib.logger.error('Use -c / --cli for the command line interface.') 68 | sys.exit(1) 69 | 70 | ST = ui.main.SteamTools() 71 | ST.run() 72 | except KeyboardInterrupt: 73 | sys.exit(0) 74 | -------------------------------------------------------------------------------- /stlib/__init__.py: -------------------------------------------------------------------------------- 1 | # Keep the import order, please 2 | 3 | import atexit 4 | import sys 5 | 6 | import gevent.monkey 7 | 8 | gevent.monkey.patch_all() 9 | 10 | if len(sys.argv) == 1: 11 | gui_mode = True 12 | else: 13 | gui_mode = False 14 | 15 | # noinspection PyPep8 16 | from stlib import (logging, 17 | config, 18 | network, 19 | browser, 20 | libsteam, 21 | logins, 22 | card_farming, 23 | steamtrades_bump, 24 | steamgifts_join, 25 | authenticator) 26 | 27 | __all__ = ['logging', 28 | 'config', 29 | 'network', 30 | 'browser', 31 | 'libsteam', 32 | 'logins', 33 | 'card_farming', 34 | 'steamtrades_bump', 35 | 'steamgifts_join', 36 | 'authenticator'] 37 | 38 | logger = logging.get_logger() 39 | wrapper_process = None 40 | 41 | 42 | def __safe_exit(): 43 | logging.console_fixer() 44 | logger.warning('Exiting...') 45 | 46 | if wrapper_process: 47 | return libsteam.stop_wrapper() 48 | 49 | 50 | atexit.register(__safe_exit) 51 | 52 | api_query_uri = 'http://query.lara.click' 53 | steam_login_page = 'https://steamcommunity.com/login/checkstoredlogin' 54 | steam_check_page = '{}/?redirectURL=discussions'.format(steam_login_page) 55 | steamgifts_check_page = 'https://www.steamgifts.com/account/profile/sync' 56 | steamgifts_query_page = 'https://www.steamgifts.com/giveaways/search' 57 | steamtrades_check_page = 'https://www.steamtrades.com/legal/privacy-policy' 58 | steamtrades_trade_page = 'https://www.steamtrades.com/trade/' 59 | steamcompanion_check_page = 'https://steamcompanion.com/settings' 60 | SA_adb_path = 'platform-tools/adb.exe' 61 | SA_auth_path = '/data/data/com.valvesoftware.android.steam.community/' 62 | 63 | steam_user = None 64 | SG_user = None 65 | ST_user = None 66 | SC_user = None 67 | 68 | 69 | def steam_profile(): 70 | return '{}/?redirectURL=id/{}'.format(steam_login_page, steam_user) 71 | -------------------------------------------------------------------------------- /stlib/authenticator.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import base64 20 | import codecs 21 | import tempfile 22 | import hashlib 23 | import hmac 24 | import io 25 | import json 26 | import locale 27 | import os 28 | import tarfile 29 | import time 30 | import subprocess 31 | import xml.etree.ElementTree 32 | import zlib 33 | 34 | import requests 35 | from bs4 import BeautifulSoup as bs 36 | 37 | import stlib 38 | import ui 39 | 40 | if stlib.gui_mode: 41 | import gi 42 | 43 | gi.require_version('Gtk', '3.0') 44 | from gi.repository import Gtk 45 | 46 | STEAM_ALPHABET = ['2', '3', '4', '5', '6', '7', '8', '9', 47 | 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 48 | 'M', 'N', 'P', 'Q', 'R', 'T', 'V', 'W', 49 | 'X', 'Y'] 50 | 51 | 52 | def __run_adb(params): 53 | data = subprocess.check_output( 54 | [stlib.SA_adb_path ] + params, 55 | stderr=subprocess.STDOUT 56 | ) 57 | 58 | return data.decode(locale.getpreferredencoding()) 59 | 60 | 61 | def __get_data_from_authenticator(path): 62 | try: 63 | data = __run_adb([ 64 | 'shell', 65 | 'su -c "cat {}"'.format(os.path.join(stlib.SA_auth_path, path)) 66 | ]) 67 | except subprocess.CalledProcessError: 68 | stlib.logger.error('Unable to get data from %s', path) 69 | 70 | return None 71 | 72 | if 'No such file' in data: 73 | stlib.logger.critical('Something wrong with the Steam Mobile App.') 74 | 75 | return None 76 | 77 | return data 78 | 79 | 80 | def __get_server_time(): 81 | query_time_url = 'https://api.steampowered.com/ITwoFactorService/QueryTime/v1' 82 | 83 | for i in range(2): 84 | response = stlib.network.get_response(query_time_url, empty_post=True) 85 | 86 | if response: 87 | server_time = int(response.json()['response']['server_time']) 88 | return server_time + response.elapsed.seconds 89 | else: 90 | stlib.logger.verbose('Unable to get server time. Trying again.') 91 | time.sleep(1) 92 | 93 | return None 94 | 95 | 96 | def phone_exists(): 97 | try: 98 | __run_adb(['shell', 'true']) 99 | except subprocess.CalledProcessError: 100 | return False 101 | else: 102 | return True 103 | 104 | 105 | def phone_is_rooted(): 106 | try: 107 | data = __run_adb(['shell', 'su', '-c', 'true']) 108 | except subprocess.CalledProcessError: 109 | return False 110 | else: 111 | return True 112 | 113 | 114 | def get_userid(nickname): 115 | response = stlib.network.get_response('{}/{}/?{}={}'.format(stlib.api_query_uri, 116 | 'steamid', 117 | 'nickname', 118 | nickname)) 119 | return response.content 120 | 121 | 122 | def get_code(secret): 123 | server_time = __get_server_time() 124 | 125 | if not server_time: 126 | return None, None 127 | 128 | msg = int(server_time / 30).to_bytes(8, 'big') 129 | key = base64.b64decode(secret) 130 | auth = hmac.new(key, msg, hashlib.sha1) 131 | digest = auth.digest() 132 | start = digest[19] & 0xF 133 | code = digest[start:start + 4] 134 | auth_code_raw = int(codecs.encode(code, 'hex'), 16) & 0x7FFFFFFF 135 | 136 | auth_code = [] 137 | for i in range(5): 138 | auth_code.append(STEAM_ALPHABET[int(auth_code_raw % len(STEAM_ALPHABET))]) 139 | auth_code_raw /= len(STEAM_ALPHABET) 140 | 141 | return ''.join(auth_code), server_time 142 | 143 | 144 | def get_secret(type_): 145 | for i in range(2): 146 | try: 147 | data = __get_data_from_authenticator('files/Steamguard-*') 148 | return json.loads(data)[type_] 149 | except (ValueError, TypeError, KeyError): 150 | stlib.logger.verbose('Unable to get {}. Trying again.'.format(type_)) 151 | time.sleep(1) 152 | 153 | stlib.logger.verbose('Unable to get the {}.'.format(type_)) 154 | 155 | return None 156 | 157 | 158 | def get_device_id(): 159 | data = __get_data_from_authenticator('shared_prefs/steam.uuid.xml') 160 | 161 | if data: 162 | return xml.etree.ElementTree.fromstring(data)[0].text 163 | else: 164 | return None 165 | 166 | 167 | def create_time_hash(time, tag, secret): 168 | key = base64.b64decode(secret) 169 | msg = time.to_bytes(8, 'big') + codecs.encode(tag) 170 | auth = hmac.new(key, msg, hashlib.sha1) 171 | code = base64.b64encode(auth.digest()) 172 | 173 | return codecs.decode(code) 174 | 175 | 176 | def get_trades(secret, cookies): 177 | server_time = __get_server_time() 178 | 179 | if not server_time: 180 | return None 181 | 182 | payload = {'p':get_device_id(), 183 | 'a':get_key('steamid'), 184 | 'k':create_time_hash(server_time, 'conf', secret), 185 | 't':server_time, 186 | 'm':'android', 187 | 'tag':'conf'} 188 | 189 | response = requests.get('https://steamcommunity.com/mobileconf/conf', 190 | params=payload, 191 | cookies=cookies) 192 | 193 | page = bs(response.content, 'html.parser') 194 | 195 | trades = {k:[] for k in ['accept', 'cancel', 'trade_id', 'trade_key', 'description']} 196 | for item in page.findAll('div', class_='mobileconf_list_entry'): 197 | trades['accept'].append(item['data-accept']) 198 | trades['cancel'].append(item['data-cancel']) 199 | trades['trade_id'].append(item['data-confid']) 200 | trades['trade_key'].append(item['data-key']) 201 | trades['description'].append(str(item.find('div', class_='mobileconf_list_entry_description')).strip()) 202 | 203 | return trades 204 | 205 | 206 | def finalize_trade(cookies, secret, trade_id, trade_key, do='cancel'): 207 | server_time = __get_server_time() 208 | 209 | payload = {'p':get_device_id(), 210 | 'a':get_key('steamid'), 211 | 'k':create_time_hash(server_time, 'conf', secret), 212 | 't':server_time, 213 | 'm':'android', 214 | 'tag':'conf', 215 | 'cid':trade_id, 216 | 'ck':trade_key, 217 | 'op':do} 218 | 219 | response = requests.get('https://steamcommunity.com/mobileconf/ajaxop', 220 | params=payload, 221 | cookies=cookies) 222 | 223 | response.raise_for_status() 224 | 225 | return response 226 | -------------------------------------------------------------------------------- /stlib/browser.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import json 20 | import os 21 | import shutil 22 | import sqlite3 23 | import tempfile 24 | 25 | import stlib 26 | 27 | if os.name == 'posix': 28 | from Crypto.Protocol.KDF import PBKDF2 29 | from Crypto.Cipher import AES 30 | else: 31 | import locale 32 | from ctypes import * 33 | from ctypes.wintypes import DWORD 34 | 35 | 36 | class DataBlob(Structure): 37 | _fields_ = [ 38 | ('cb_data', DWORD), 39 | ('pb_data', POINTER(c_char)) 40 | ] 41 | 42 | 43 | def __decrypt_data(encrypted_data): 44 | if os.name == 'nt': 45 | # Thanks to Crusher Joe (crusherjoe eudoramail.com) 46 | buffer_in = c_buffer(encrypted_data, len(encrypted_data)) 47 | blob_in = DataBlob(len(encrypted_data), buffer_in) 48 | blob_out = DataBlob() 49 | 50 | windll.crypt32.CryptUnprotectData(byref(blob_in), None, None, None, None, 0x01, byref(blob_out)) 51 | cb_data = int(blob_out.cb_data) 52 | pb_data = blob_out.pb_data 53 | buffer = c_buffer(cb_data) 54 | windll.msvcrt.memcpy(buffer, pb_data, cb_data) 55 | windll.kernel32.LocalFree(pb_data) 56 | 57 | return buffer.raw.decode(locale.getpreferredencoding()) 58 | else: 59 | cipher = AES.new(PBKDF2(b'peanuts', b'saltysalt', 16, 1), AES.MODE_CBC, IV=b' ' * 16) 60 | decrypted = cipher.decrypt(encrypted_data[3:]) 61 | 62 | return decrypted[:-decrypted[-1]].decode('utf-8') 63 | 64 | 65 | def get_cookies(url): 66 | cookies = {} 67 | temp_dir = tempfile.mkdtemp() 68 | config_parser = stlib.config.read() 69 | profile = config_parser.get('Config', 'browserProfile') 70 | cookies_path = os.path.join(get_chrome_dir(), profile, 'Cookies') 71 | temp_cookies_path = os.path.join(temp_dir, os.path.basename(cookies_path)) 72 | shutil.copy(cookies_path, temp_cookies_path) 73 | 74 | connection = sqlite3.connect(temp_cookies_path) 75 | query = 'SELECT name, value, encrypted_value FROM cookies WHERE host_key LIKE ?' 76 | for key, data, encrypted_data in connection.execute(query, (get_domain_name(url),)): 77 | if key == '_ga': 78 | continue 79 | 80 | if encrypted_data[:3] != b'v10' and encrypted_data[:3] != b'\x01\x00\x00': 81 | if data: 82 | cookies[key] = data 83 | else: 84 | cookies[key] = encrypted_data 85 | else: 86 | cookies[key] = __decrypt_data(encrypted_data) 87 | connection.close() 88 | 89 | shutil.rmtree(temp_dir) 90 | 91 | return cookies 92 | 93 | 94 | def get_chrome_dir(): 95 | if os.name == 'nt': 96 | data_dir = os.getenv('LOCALAPPDATA') 97 | chrome_dir = os.path.join(data_dir, 'Google', 'Chrome', 'User Data') 98 | # Fallback to Chromium 99 | if not os.path.isdir(chrome_dir): 100 | chrome_dir = os.path.join(data_dir, 'Chromium', 'User Data') 101 | else: 102 | data_dir = os.getenv('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config')) 103 | chrome_dir = os.path.join(data_dir, 'google-chrome') 104 | # Fallback to Chromium 105 | if not os.path.isdir(chrome_dir): 106 | chrome_dir = os.path.join(data_dir, 'chromium') 107 | 108 | return chrome_dir 109 | 110 | 111 | def get_profiles(): 112 | chrome_dir = get_chrome_dir() 113 | 114 | profiles = [] 115 | if os.path.isdir(chrome_dir): 116 | for dir_name in sorted(os.listdir(chrome_dir)): 117 | if 'Profile' in dir_name or 'Default' in dir_name: 118 | if os.path.isfile(os.path.join(chrome_dir, dir_name, 'Cookies')): 119 | profile_path = os.path.join(chrome_dir, dir_name) 120 | profile_name = os.path.basename(profile_path) 121 | profiles.append(profile_name) 122 | 123 | return profiles 124 | 125 | 126 | def get_profile_path(profile_name=None): 127 | if profile_name: 128 | profile_path = os.path.join(get_chrome_dir(), profile_name) 129 | else: 130 | config_parser = stlib.config.read() 131 | profile_path = config_parser.get('Config', 'browserProfile') 132 | 133 | return profile_path 134 | 135 | 136 | def get_profile_name(profile_path=None): 137 | if not profile_path: 138 | profile_path = get_profile_path() 139 | 140 | profile_name = os.path.basename(profile_path) 141 | 142 | return profile_name 143 | 144 | 145 | def get_account_name(profile_path=None, profile_name=None): 146 | if not profile_path: 147 | profile_path = get_profile_path(profile_name) 148 | 149 | if not profile_name: 150 | profile_name = os.path.basename(profile_path) 151 | 152 | preferences_path = os.path.join(get_chrome_dir(), profile_name, 'Preferences') 153 | with open(preferences_path) as preferences_file: 154 | preferences = json.load(preferences_file) 155 | 156 | try: 157 | account_name = preferences['account_info'][0]['full_name'] 158 | except KeyError: 159 | account_name = preferences['profile']['name'] 160 | 161 | return account_name 162 | 163 | 164 | def get_domain_name(url): 165 | site = url.split('//', 1)[1].split('/', 1)[0].split('.') 166 | if len(site) > 2 and site[-3] == 'www': 167 | if 'steamtrades' in site: 168 | return '.' + '.'.join(site) 169 | else: 170 | return '.' + '.'.join(site[-2:]) 171 | else: 172 | if len(site) > 2: 173 | return '.'.join(site[-3:]) 174 | else: 175 | return '.'.join(site[-2:]) 176 | -------------------------------------------------------------------------------- /stlib/card_farming.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import stlib 20 | 21 | current_badge = 0 22 | 23 | def remove_completed_badges(badges): 24 | stlib.logger.info('Ignoring already completed badges') 25 | new_badges = [] 26 | for badge in badges: 27 | if get_card_count(badge) != 0: 28 | new_badges.append(badge) 29 | 30 | return new_badges 31 | 32 | 33 | def get_badge_page_count(): 34 | stlib.logger.info('Counting badge pages') 35 | profile = stlib.steam_profile() 36 | html = stlib.network.try_get_html('steam', '{}/badges/'.format(profile)) 37 | 38 | try: 39 | page_count = int(html.findAll('a', class_='pagelink')[-1].text) 40 | except IndexError: 41 | page_count = 1 42 | 43 | return page_count 44 | 45 | 46 | def get_badges(page): 47 | stlib.logger.info('Getting badges from page %d', page) 48 | profile = stlib.steam_profile() 49 | html = stlib.network.try_get_html('steam', '{}/badges/?p={}'.format(profile, page)) 50 | 51 | return html.findAll('div', class_='badge_title_row') 52 | 53 | 54 | def get_game_name(badge): 55 | stlib.logger.verbose('Getting game name') 56 | title = badge.find('div', class_='badge_title') 57 | 58 | return title.text.split('\t\t\t\t\t\t\t\t\t', 2)[1] 59 | 60 | 61 | def get_game_id(badge): 62 | stlib.logger.verbose('Getting game id') 63 | 64 | try: 65 | game_href = badge.find('a')['href'] 66 | except TypeError: 67 | # FIXME: It's a foil badge. The game id is above the badge_title_row... 68 | return str(000000) 69 | 70 | try: 71 | game_id = game_href.split('/', 3)[3] 72 | except IndexError: 73 | # Possibly a game without cards 74 | # TODO: This can speed up the remove_completed_badges? 75 | game_id = game_href.split('_', 6)[4] 76 | 77 | return str(game_id) 78 | 79 | 80 | def get_card_count(badge, update_from_web=False): 81 | game_name = get_game_name(badge) 82 | game_id = get_game_id(badge) 83 | 84 | if update_from_web: 85 | stlib.logger.verbose('Updating number of cards of %s(%s)', game_name, game_id) 86 | profile = stlib.steam_profile() 87 | html = stlib.network.try_get_html('steam', '{}/gamecards/{}'.format(profile, game_id)) 88 | stats = html.find('div', class_='badge_title_stats_drops') 89 | progress = stats.find('span', class_='progress_info_bold') 90 | else: 91 | stlib.logger.verbose('Getting number of cards of %s(%s)', game_name, game_id) 92 | progress = badge.find('span', class_='progress_info_bold') 93 | 94 | if not progress or 'No' in progress.text: 95 | return 0 96 | else: 97 | return int(progress.text.split(' ', 3)[0]) 98 | 99 | 100 | def get_cards_info(): 101 | stlib.logger.info('Getting cards info') 102 | cards_info = {k: [] for k in ['game_name', 'card_count', 'badge_price']} 103 | html = stlib.network.get_html('http://www.steamcardexchange.net/index.php?badgeprices') 104 | 105 | for info in html.findAll('tr')[1:]: 106 | cards_info['game_name'].append(info.find('a').text) 107 | cards_info['card_count'].append(int(info.findAll('td')[1].text)) 108 | cards_info['badge_price'].append(float(info.findAll('td')[2].text[1:])) 109 | 110 | return cards_info 111 | 112 | 113 | def get_badge_price(cards_info, badge): 114 | game_name = get_game_name(badge) 115 | stlib.logger.verbose('Getting badge price for %s', game_name) 116 | 117 | try: 118 | price_index = cards_info['game_name'].index(game_name) 119 | return cards_info['badge_price'][price_index] 120 | except ValueError: 121 | return 0 122 | 123 | 124 | def get_badge_cards_count(cards_info, badge): 125 | game_name = get_game_name(badge) 126 | stlib.logger.info('Getting cards count for %s', game_name) 127 | return cards_info['card_count'][cards_info['game_name'].index(game_name)] 128 | 129 | 130 | def get_total_card_count(badges): 131 | card_count = 0 132 | for badge in badges: 133 | card_count += get_card_count(badge) 134 | yield card_count 135 | 136 | 137 | def order_by_most_valuable(cards_info, badges): 138 | stlib.logger.info("Ordering by most valuable") 139 | prices = [get_badge_price(cards_info, badge) for badge in badges] 140 | badges_count = len(badges) 141 | badges_order = sorted(range(badges_count), 142 | key=lambda key: prices[key], 143 | reverse=True) 144 | ordered_badges = [] 145 | 146 | for _ in prices: 147 | ordered_badges = [badges[index] for index in badges_order] 148 | 149 | return ordered_badges 150 | -------------------------------------------------------------------------------- /stlib/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import configparser 20 | import logging 21 | import os 22 | import sys 23 | 24 | logger = logging.getLogger(__name__) 25 | 26 | if os.name == 'nt': 27 | data_dir = os.getenv('LOCALAPPDATA') 28 | else: 29 | data_dir = os.getenv('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config')) 30 | 31 | config_file_name = os.path.splitext(os.path.basename(sys.argv[0]))[0] + '.config' 32 | config_file_path = os.path.join(data_dir, 'steam-tools', config_file_name) 33 | 34 | config_parser = configparser.RawConfigParser() 35 | config_parser.optionxform = str 36 | 37 | os.makedirs(os.path.dirname(config_file_path), exist_ok=True) 38 | 39 | if not os.path.isfile(config_file_path): 40 | logger.warn("No config file found.") 41 | logger.warn("Creating a new at %s", config_file_path) 42 | 43 | config_parser.add_section('Config') 44 | config_parser.add_section('Debug') 45 | config_parser.add_section('CardFarming') 46 | config_parser.add_section('SteamTrades') 47 | config_parser.add_section('SteamGifts') 48 | config_parser.add_section('Auth') 49 | 50 | with open(config_file_path, 'w') as FP: 51 | config_parser.write(FP) 52 | 53 | 54 | def read(): 55 | config_parser.read(config_file_path) 56 | return config_parser 57 | 58 | 59 | def write(): 60 | with open(config_file_path, 'w') as config_file: 61 | config_parser.write(config_file) 62 | -------------------------------------------------------------------------------- /stlib/libsteam.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import ctypes 20 | import os 21 | import subprocess 22 | import sys 23 | 24 | import stlib 25 | 26 | if os.name is 'posix': 27 | import site 28 | 29 | 30 | def _find_libsteam(): 31 | if os.name == 'nt': 32 | libsteam = 'libsteam_api.dll' 33 | 34 | if os.path.isfile(libsteam): 35 | return libsteam 36 | else: 37 | return False 38 | else: 39 | paths = [ 40 | '/usr/share/steam-tools', 41 | '/usr/local/share/steam-tools', 42 | '/opt/steam-tools', 43 | '' 44 | ] 45 | 46 | for path in paths: 47 | libsteam_path = os.path.join(path, 'libsteam_api.so') 48 | if os.path.isfile(libsteam_path): 49 | return libsteam_path 50 | 51 | return False 52 | 53 | 54 | def _find_wrapper(): 55 | current_directory = os.path.dirname(os.path.abspath(sys.argv[0])) 56 | paths = [current_directory, os.path.join(current_directory, 'stlib')] 57 | 58 | if os.name is 'posix': 59 | for directory in site.getsitepackages(): 60 | paths.append(os.path.join(directory, 'stlib')) 61 | 62 | for path in paths: 63 | for ext in ['', '.exe', '.py']: 64 | full_path = os.path.join(path, 'libsteam_wrapper' + ext) 65 | 66 | if os.path.isfile(full_path): 67 | return full_path 68 | 69 | 70 | def run_wrapper(app_id): 71 | wrapper_path = _find_wrapper() 72 | 73 | if not wrapper_path: 74 | stlib.logger.critical('Unable to find libsteam wrapper!') 75 | return None 76 | 77 | wrapper_exec = [wrapper_path, app_id, _find_libsteam()] 78 | 79 | if wrapper_path[-3:] != 'exe': 80 | wrapper_exec = ['python'] + wrapper_exec 81 | 82 | stlib.wrapper_process = subprocess.Popen(wrapper_exec, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 83 | 84 | 85 | def stop_wrapper(): 86 | stlib.logger.verbose('Closing wrapper subprocess...') 87 | 88 | try: 89 | stlib.wrapper_process.terminate() 90 | except ProcessLookupError: 91 | stlib.logger.verbose('subprocess is already terminated.') 92 | return 1 93 | 94 | try: 95 | stlib.logger.verbose("Waiting to wrapper subprocess terminate.") 96 | stlib.wrapper_process.communicate(timeout=20) 97 | except subprocess.TimeoutExpired: 98 | stlib.logger.verbose("Force killing wrapper subprocess.") 99 | stlib.wrapper_process.kill() 100 | stlib.wrapper_process.communicate() 101 | 102 | if stlib.wrapper_process.returncode: 103 | return_ = 1 104 | else: 105 | return_ = 0 106 | 107 | stlib.wrapper_process = None 108 | return return_ 109 | 110 | 111 | def is_steam_running(): 112 | steam_api = ctypes.CDLL(_find_libsteam()) 113 | if steam_api.SteamAPI_IsSteamRunning(): 114 | return True 115 | else: 116 | return False 117 | 118 | 119 | def is_wrapper_running(): 120 | if not stlib.wrapper_process or \ 121 | stlib.wrapper_process.poll(): 122 | return False 123 | else: 124 | return True 125 | -------------------------------------------------------------------------------- /stlib/libsteam_wrapper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import os 20 | import sys 21 | import ctypes 22 | import time 23 | 24 | if __name__ == "__main__": 25 | if len(sys.argv) > 2: 26 | os.environ["SteamAppId"] = sys.argv[1] 27 | 28 | try: 29 | steam_api = ctypes.CDLL(sys.argv[2]) 30 | except OSError: 31 | sys.exit(1) 32 | 33 | if not steam_api.SteamAPI_Init(): 34 | sys.exit(1) 35 | 36 | try: 37 | while True: 38 | time.sleep(1) 39 | except KeyboardInterrupt: 40 | os.environ.pop("SteamAppId") 41 | steam_api.SteamAPI_Shutdown() 42 | sys.exit(0) 43 | 44 | sys.exit(1) 45 | -------------------------------------------------------------------------------- /stlib/logging.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import codecs 20 | import locale 21 | import logging 22 | import logging.handlers 23 | import os 24 | import shutil 25 | import sys 26 | import tempfile 27 | 28 | # NEVER import full stlib module here!!! (cyclic) 29 | from stlib import config as stconfig 30 | 31 | 32 | class ColoredFormatter(logging.Formatter): 33 | def format(self, log): 34 | color_map = { 35 | 'INFO': 37, 36 | 'WARNING': 33, 37 | 'ERROR': 35, 38 | 'CRITICAL': 31, 39 | } 40 | 41 | color_number = color_map.get(log.levelname, 37) 42 | 43 | if os.name == 'nt' and not os.getenv('PWD'): 44 | msg = ' --> {}'.format(log.getMessage()) 45 | else: 46 | msg = '\033[32m --> \033[{}m{}\033[m'.format(color_number, log.getMessage()) 47 | 48 | return msg.replace('\n', '\n ') 49 | 50 | 51 | def encoder(buffer, error='replace'): 52 | writer = codecs.getwriter(locale.getpreferredencoding()) 53 | return writer(buffer, error) 54 | 55 | 56 | def console_fixer(end='\n'): 57 | tsize = shutil.get_terminal_size()[0] 58 | print(('{:' + str(tsize - 1) + 's}').format(''), end=end, flush=True) 59 | 60 | 61 | def console_msg(*objs, sep='', end='\n', out=sys.stdout): 62 | if end == '\r': 63 | console_fixer(end) 64 | 65 | print(*objs, sep=sep, end=end, file=encoder(out.buffer), flush=True) 66 | 67 | 68 | # noinspection PyProtectedMember 69 | def get_logger(): 70 | config_parser = stconfig.read() 71 | data_dir = tempfile.gettempdir() 72 | 73 | log_file_name = os.path.splitext(os.path.basename(sys.argv[0]))[0] + '.log' 74 | log_file_path = os.path.join(data_dir, 'steam-tools') 75 | os.makedirs(log_file_path, exist_ok=True) 76 | 77 | logging.VERBOSE = 15 78 | logging.TRACE = 5 79 | logging.addLevelName(logging.VERBOSE, 'VERBOSE') 80 | logging.addLevelName(logging.TRACE, 'TRACE') 81 | 82 | console_level = config_parser.get('Debug', 'consoleLevel', fallback='info') 83 | log_file_level = config_parser.get('Debug', 'logFileLevel', fallback='verbose') 84 | 85 | # --- Internal logger control --- # 86 | logger = logging.getLogger('SteamTools') 87 | logger.verbose = lambda msg, *args: logger._log(logging.VERBOSE, msg, args) 88 | logger.trace = lambda msg, *args: logger._log(logging.TRACE, msg, args) 89 | logger.setLevel(logging.TRACE) 90 | # --- ~ --- ~ --- ~ --- ~ --- ~ --- # 91 | 92 | # --- Logfile Handler --- # 93 | log_file = logging.handlers.RotatingFileHandler(os.path.join(log_file_path, log_file_name), 94 | backupCount=1, 95 | encoding='utf-8') 96 | log_file.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s')) 97 | log_file.setLevel(eval('logging.' + log_file_level.upper())) 98 | log_file.doRollover() 99 | logger.addHandler(log_file) 100 | # --- ~ --- ~ --- ~ --- ~ # 101 | 102 | # --- Console Handler --- # 103 | console = logging.StreamHandler(encoder(sys.stdout.buffer)) 104 | console.setFormatter(ColoredFormatter()) 105 | console.setLevel(eval('logging.' + console_level.upper())) 106 | logger.addHandler(console) 107 | # --- ~ --- ~ --- ~ --- ~ # 108 | 109 | # --- Requests Logfile handler --- # 110 | httpfile = logging.handlers.RotatingFileHandler(os.path.join(log_file_path, 'requests_' + log_file_name), 111 | backupCount=1, 112 | encoding='utf-8') 113 | httpfile.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s')) 114 | httpfile.setLevel(logging.DEBUG) 115 | httpfile.doRollover() 116 | 117 | requests = logging.getLogger("requests.packages.urllib3") 118 | requests.setLevel(logging.DEBUG) 119 | # requests.removeHandler('SteamTools') 120 | requests.addHandler(httpfile) 121 | # --- ~ --- ~ --- ~ --- ~ --- ~ --- # 122 | 123 | return logger 124 | -------------------------------------------------------------------------------- /stlib/logins.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import gc 20 | import sys 21 | 22 | import bs4 23 | import gevent 24 | 25 | import stlib 26 | import ui 27 | 28 | if stlib.gui_mode: 29 | import gi 30 | 31 | gi.require_version('Gtk', '3.0') 32 | from gi.repository import Gtk 33 | 34 | 35 | def check_steam_login(greenlet): 36 | try: 37 | html = bs4.BeautifulSoup(greenlet.value.content, 'html.parser') 38 | supernav = html.find('div', class_='supernav_container') 39 | stlib.steam_user = supernav.find('a', class_='username').text.strip() 40 | except(AttributeError, IndexError): 41 | stlib.steam_user = None 42 | stlib.logger.error('Steam login status: Cookies not found' + 43 | '\nPlease, check if you are logged in on' + 44 | '\nsteampowered.com or steamcommunity.com') 45 | 46 | 47 | def check_steamgifts_login(greenlet): 48 | try: 49 | html = bs4.BeautifulSoup(greenlet.value.content, 'html.parser') 50 | form = html.findAll('form')[1] 51 | stlib.SG_user = form.find('input', {'name': 'username'}).get('value') 52 | except(AttributeError, IndexError): 53 | stlib.SG_user = None 54 | stlib.logger.error('SteamGifts login status: Cookies not found' + 55 | '\nPlease, check if you are logged in on' + 56 | '\nwww.steamgifts.com') 57 | 58 | 59 | def check_steamtrades_login(greenlet): 60 | try: 61 | html = bs4.BeautifulSoup(greenlet.value.content, 'html.parser') 62 | avatar = html.find('a', class_='nav_avatar') 63 | 64 | if not avatar: 65 | raise AttributeError 66 | 67 | user_id = avatar['href'].split('/')[2] 68 | # FIXME: get username from steamapi 69 | stlib.ST_user = user_id 70 | except(AttributeError, IndexError): 71 | stlib.ST_user = None 72 | stlib.logger.error('SteamTrades login status: Cookies not found' + 73 | '\nPlease, check if you are logged in on' + 74 | '\nwww.steamtrades.com') 75 | 76 | 77 | def check_steamcompanion_login(greenlet): 78 | try: 79 | html = bs4.BeautifulSoup(greenlet.value.content, 'html.parser') 80 | user = html.find('div', class_='profile').find('a').text.strip() 81 | 82 | if not user: 83 | raise AttributeError 84 | 85 | stlib.SC_user = user 86 | except(AttributeError, IndexError): 87 | stlib.SC_user = None 88 | stlib.logger.error('SteamCompanion login status: Cookies not found' + 89 | '\nPlease, check if you are logged in on' + 90 | '\nsteamcompanion.com') 91 | 92 | 93 | def queue_connect(service_name, callback=None, wait=False): 94 | if not callback: 95 | callback = eval(''.join(['check_', service_name, '_login'])) 96 | 97 | url = eval(''.join(['stlib.', service_name, '_check_page'])) 98 | 99 | greenlet = gevent.Greenlet(stlib.network.try_get_response, service_name, url) 100 | greenlet.link(callback) 101 | greenlet.start() 102 | 103 | if wait: 104 | try: 105 | greenlet.join() 106 | except KeyboardInterrupt: 107 | sys.exit(0) 108 | 109 | return greenlet 110 | 111 | 112 | def get_queue(): 113 | greenlets = [] 114 | 115 | for object_ in gc.get_objects(): 116 | if isinstance(object_, gevent.Greenlet): 117 | greenlets.append(object_) 118 | 119 | return greenlets 120 | 121 | 122 | def wait_queue(greenlets=None): 123 | if not greenlets: 124 | greenlets = get_queue() 125 | 126 | try: 127 | while True: 128 | # Kill all greenlets before exit 129 | if not ui.main_window.get_window(): 130 | raise SystemExit 131 | 132 | try: 133 | if greenlets[-1].ready(): 134 | greenlets.pop() 135 | 136 | ui.update_main_loop() 137 | except IndexError: 138 | break 139 | except(KeyboardInterrupt, SystemExit): 140 | for greenlet in greenlets: 141 | greenlet.kill() 142 | 143 | sys.exit(0) 144 | -------------------------------------------------------------------------------- /stlib/network.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import sys 20 | import threading 21 | import time 22 | 23 | import bs4 24 | import requests 25 | 26 | import stlib 27 | import ui 28 | 29 | STEAM_LOGIN_PAGES = [ 30 | 'https://steamcommunity.com/login/home/', 31 | 'https://store.steampowered.com//login/', 32 | ] 33 | 34 | USER_AGENT = {'User-Agent': 'Unknown/0.0.0'} 35 | 36 | 37 | class Threaded(threading.Thread): 38 | def __init__(self, function, *args, **kwargs): 39 | threading.Thread.__init__(self) 40 | self.function = function 41 | self.args = args 42 | self.kwargs = kwargs 43 | self.return_ = None 44 | 45 | def run(self): 46 | self.return_ = self.function(*self.args, **self.kwargs) 47 | 48 | 49 | # It's Magic! 50 | def async_wait(function): 51 | def async_call(*args, **kwargs): 52 | thread = Threaded(function, *args, **kwargs) 53 | thread.start() 54 | 55 | while thread.is_alive(): 56 | ui.update_main_loop() 57 | else: 58 | return thread.return_ 59 | 60 | return async_call 61 | 62 | 63 | def nonblocking_wait(seconds): 64 | for _ in range(seconds * 10): 65 | time.sleep(0.1) 66 | ui.update_main_loop() 67 | 68 | 69 | @async_wait 70 | def get_response(url, data=None, cookies=None, headers=USER_AGENT, timeout=10, verify=True, stream=False, empty_post=False): 71 | response = None 72 | 73 | if headers: 74 | headers.update(USER_AGENT) 75 | 76 | kwargs = {'data': data, 77 | 'headers': headers, 78 | 'cookies': cookies, 79 | 'timeout': timeout, 80 | 'verify': verify, 81 | 'stream': stream} 82 | 83 | for i in range(1, 4): 84 | try: 85 | if data or empty_post: 86 | response = requests.post(url, **kwargs) 87 | else: 88 | response = requests.get(url, **kwargs) 89 | 90 | response.raise_for_status() 91 | except requests.exceptions.SSLError: 92 | stlib.logger.critical('INSECURE CONNECTION DETECTED!') 93 | stlib.logger.critical('Invalid SSL Certificates.') 94 | return False 95 | except requests.exceptions.HTTPError: 96 | stlib.logger.warning('Response with HTTP error.') 97 | return None 98 | except requests.exceptions.TooManyRedirects: 99 | stlib.logger.warning('Response with too many redirects.') 100 | return None 101 | except(requests.exceptions.ConnectionError, 102 | requests.exceptions.RequestException, 103 | requests.exceptions.Timeout): 104 | stlib.logger.error('Unable to connect. Trying again... ({}/3)'.format(i)) 105 | nonblocking_wait(3) 106 | else: 107 | return response 108 | 109 | return False 110 | 111 | def try_get_response(service_name, url, data=None): 112 | config_parser = stlib.config.read() 113 | auto_recovery = False 114 | 115 | while True: 116 | try: 117 | # noinspection PyProtectedMember 118 | cookies = config_parser._sections[service_name + 'Cookies'] 119 | 120 | if not cookies: 121 | raise KeyError 122 | 123 | response = get_response(url, data, cookies) 124 | 125 | if response is None: 126 | raise KeyError 127 | elif response is False: 128 | return None 129 | 130 | if 'suspensions' in response.url: 131 | stlib.logger.critical('You are banned!') 132 | stlib.logger.critical('Exiting...') 133 | sys.exit(1) 134 | 135 | if service_name is 'steam': 136 | if any(page in str(response.content) for page in STEAM_LOGIN_PAGES): 137 | raise requests.exceptions.TooManyRedirects 138 | elif service_name is 'steamtrades': 139 | if '?login&redirect=' in str(response.content): 140 | raise requests.exceptions.TooManyRedirects 141 | except(requests.exceptions.TooManyRedirects, KeyError): 142 | if not auto_recovery: 143 | stlib.logger.error('Unable to find cookies for {}'.format(service_name)) 144 | stlib.logger.error('Trying to auto recovery') 145 | auto_recovery = True 146 | cookies = stlib.browser.get_cookies(url) 147 | 148 | config_parser[service_name + 'Cookies'] = cookies 149 | stlib.config.write() 150 | else: 151 | stlib.logger.error('Unable to get cookies for {}'.format(service_name)) 152 | return None 153 | else: 154 | return response 155 | 156 | 157 | def get_html(*args, **kwargs): 158 | response = get_response(*args, **kwargs) 159 | 160 | return bs4.BeautifulSoup(response.content, 'html.parser') 161 | 162 | 163 | def try_get_html(*args, **kwargs): 164 | response = try_get_response(*args, **kwargs) 165 | 166 | if response: 167 | return bs4.BeautifulSoup(response.content, 'html.parser') 168 | else: 169 | return None 170 | -------------------------------------------------------------------------------- /stlib/steamgifts_join.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import stlib 20 | 21 | giveaway_type = None 22 | 23 | 24 | def type_generator(type_list): 25 | for line in type_list.split(','): 26 | yield line.strip() 27 | 28 | 29 | def configure(): 30 | config_url = 'https://www.steamgifts.com/account/settings/giveaways' 31 | html = stlib.network.try_get_html('steamgifts', config_url) 32 | form = html.find('form') 33 | data = dict([(inputs['name'], inputs['value']) for inputs in form.findAll('input')]) 34 | 35 | post_data = {'xsrf_token': data['xsrf_token'], 36 | 'filter_giveaways_exist_in_account': 1, 37 | 'filter_giveaways_missing_base_game': 1, 38 | 'filter_giveaways_level': 1} 39 | 40 | stlib.network.try_get_response('steamgifts', config_url, data=post_data) 41 | 42 | return None 43 | 44 | 45 | def get_user_points(html=None): 46 | if not html: 47 | html = stlib.network.try_get_html('steamgifts', stlib.steamgifts_check_page) 48 | 49 | points = html.find('span', class_="nav__points") 50 | return int(points.text) 51 | 52 | 53 | def get_user_level(html): 54 | level = html.find('span', class_=None) 55 | return int(''.join(filter(str.isdigit, level))) 56 | 57 | 58 | def get_pinned_giveaways(html): 59 | container = html.find('div', class_='widget-container') 60 | pinned_giveaways = [] 61 | 62 | try: 63 | pinned_widget = container.find('div', class_='pinned-giveaways__outer-wrap') 64 | pinned_giveaways = pinned_widget.findAll('div', class_='giveaway__row-outer-wrap') 65 | 66 | if not pinned_giveaways: 67 | raise AttributeError 68 | except AttributeError: 69 | stlib.logger.error('Cannot found any developer giveaways. Ignoring.') 70 | 71 | for pinned_giveaway in pinned_giveaways: 72 | yield pinned_giveaway 73 | 74 | 75 | def get_giveaways(html): 76 | container = html.find('div', class_='widget-container') 77 | head = container.find('div', class_='page__heading') 78 | giveaways = head.findAllNext('div', class_='giveaway__row-outer-wrap') 79 | 80 | for giveaway in giveaways: 81 | yield giveaway 82 | 83 | 84 | def get_giveaway_name(giveaway): 85 | head = giveaway.find('a', class_='giveaway__heading__name') 86 | return head.text 87 | 88 | 89 | def get_giveaway_query(giveaway): 90 | head = giveaway.find('a', class_='giveaway__heading__name') 91 | return head['href'] 92 | 93 | 94 | def get_giveaway_copies(giveaway): 95 | head = giveaway.find('span', class_='giveaway__heading__thin') 96 | 97 | if 'Copies' in head.text: 98 | copies = ''.join(filter(str.isdigit, head.text)) 99 | else: 100 | copies = 1 101 | 102 | return int(copies) 103 | 104 | 105 | def get_giveaway_points(giveaway): 106 | head = giveaway.find('span', class_='giveaway__heading__thin') 107 | 108 | # If the game have more than 1 copies, the head must be fixed 109 | if 'Copies' in head.text: 110 | head = head.findNext('span', class_='giveaway__heading__thin') 111 | 112 | points = ''.join(filter(str.isdigit, head.text)) 113 | 114 | return int(points) 115 | 116 | 117 | def get_giveaway_level(giveaway): 118 | try: 119 | level_column = giveaway.find('div', class_='giveaway__column--contributor-level') 120 | level = ''.join(filter(str.isdigit, level_column.text)) 121 | except AttributeError: 122 | level = 0 123 | 124 | return int(level) 125 | 126 | 127 | def join(giveaway): 128 | giveaway_points = get_giveaway_points(giveaway) 129 | giveaway_name = get_giveaway_name(giveaway) 130 | giveaway_copies = get_giveaway_copies(giveaway) 131 | query_url = 'https://steamgifts.com' + get_giveaway_query(giveaway) 132 | html = stlib.network.try_get_html('steamgifts', query_url) 133 | sidebar = html.find('div', class_='sidebar') 134 | form = sidebar.find('form') 135 | points_spent = 0 136 | 137 | try: 138 | data = dict([(inputs['name'], inputs['value']) for inputs in form.findAll('input')]) 139 | 140 | post_data = {'xsrf_token': data['xsrf_token'], 141 | 'do': 'entry_insert', 142 | 'code': data['code']} 143 | except (KeyError, AttributeError): 144 | stlib.logger.error('%s has expired. Ignoring.', giveaway_name) 145 | return points_spent 146 | 147 | stlib.network.try_get_response('steamgifts', 'https://www.steamgifts.com/ajax.php', data=post_data) 148 | points_spent = giveaway_points 149 | 150 | stlib.logger.info('Spent %d points in the giveaway of %s (Copies: %d)', 151 | giveaway_points, 152 | giveaway_name, 153 | giveaway_copies) 154 | 155 | return points_spent 156 | -------------------------------------------------------------------------------- /stlib/steamtrades_bump.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import os 20 | 21 | import bs4 22 | 23 | import stlib 24 | 25 | current_trade = 0 26 | 27 | 28 | def get_trade_page(trade_id): 29 | response = stlib.network.try_get_response('steamtrades', '{}/{}/'.format(stlib.steamtrades_trade_page, 30 | trade_id)) 31 | 32 | if not response: 33 | stlib.logger.warning('The trade ID %s is not valid.', trade_id) 34 | return None 35 | 36 | return response 37 | 38 | 39 | def get_trade_id(response): 40 | trade_id = response.url.split('/')[4] 41 | return trade_id 42 | 43 | 44 | def get_trade_title(response): 45 | trade_title = os.path.basename(response.url).replace('-', ' ') 46 | return trade_title 47 | 48 | 49 | def bump(response): 50 | trade_id = get_trade_id(response) 51 | trade_title = get_trade_title(response) 52 | html = bs4.BeautifulSoup(response.content, 'html.parser') 53 | form = html.find('form') 54 | data = dict([(inputs['name'], inputs['value']) for inputs in form.findAll('input')]) 55 | post_data = {'code': data['code'], 'xsrf_token': data['xsrf_token'], 'do': 'trade_bump'} 56 | 57 | post_response = stlib.network.try_get_response('steamtrades', 58 | 'https://www.steamtrades.com/ajax.php', 59 | data=post_data) 60 | 61 | if 'Please wait another' in post_response.content.decode('utf-8'): 62 | post_html = bs4.BeautifulSoup(post_response.content, 'html.parser') 63 | error = post_response.json()['popup_heading_h2'][0] 64 | minutes_left = int(error.split(' ')[3]) 65 | stlib.logger.warning('%s (%s) Already bumped. Waiting more %d minutes', 66 | trade_id, 67 | trade_title, 68 | minutes_left) 69 | return minutes_left 70 | else: 71 | response = stlib.network.try_get_response('steamtrades', stlib.steamtrades_trade_page[:-1] + 's') 72 | 73 | if trade_id in response.content.decode('utf-8'): 74 | stlib.logger.info('%s (%s) Bumped!', trade_id, trade_title) 75 | return True 76 | else: 77 | stlib.logger.critical('Something is wrong with %s (%s)', trade_id, trade_title) 78 | return False 79 | -------------------------------------------------------------------------------- /ui/__init__.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | import gevent 4 | 5 | from stlib import gui_mode 6 | from ui import console, version 7 | 8 | __all__ = ['console', 'version'] 9 | 10 | if len(sys.argv) == 1: 11 | import gi 12 | 13 | gi.require_version('Gtk', '3.0') 14 | 15 | from gi.repository import Gtk 16 | 17 | from ui import (main, 18 | signals, 19 | timers) 20 | 21 | __all__.extend(['main', 22 | 'signals', 23 | 'timers']) 24 | 25 | def update_main_loop(): 26 | gevent.sleep(0.001) 27 | 28 | if gui_mode: 29 | Gtk.main_iteration() 30 | 31 | main_window = None 32 | application = None 33 | selected_profile_id = 0 34 | 35 | card_farming_is_running = False 36 | card_farming_game_start_time = None 37 | fake_app_is_running = False 38 | fake_app_id = None 39 | steamtrades_bump_is_running = False 40 | steamtrades_bump_waiting = False 41 | steamgifts_join_is_running = False 42 | steamgifts_join_waiting = False 43 | steamgifts_join_giveaway_waiting = False 44 | -------------------------------------------------------------------------------- /ui/fix_std.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import os 20 | import sys 21 | import logging 22 | 23 | 24 | logging.STDERR = 55 25 | logging.addLevelName(logging.STDERR, 'STDERR') 26 | 27 | logger = logging.getLogger('SteamTools') 28 | logger.stderr = lambda msg, *args: logger._log(logging.STDERR, msg, args) 29 | 30 | 31 | if os.name is 'nt': 32 | import ctypes 33 | # noinspection PyUnresolvedReferences 34 | import psutil 35 | import tempfile 36 | import warnings 37 | 38 | 39 | class HoleToLogger(object): 40 | def write(self, text): 41 | logger.stderr(text) 42 | 43 | def flush(self): 44 | pass 45 | 46 | class HormHole(object): 47 | def write(self, text): 48 | pass 49 | 50 | def flush(self): 51 | pass 52 | 53 | interpreter = psutil.Process(os.getppid()) 54 | shell = interpreter.parent() 55 | 56 | # Running from Windows without terminal 57 | if not shell or shell.name() == 'svchost.exe': 58 | # Bypass py2exe BlackHole 59 | sys.stdout = HormHole() 60 | sys.stderr = HoleToLogger() 61 | 62 | # Hide console window 63 | console = ctypes.windll.kernel32.GetConsoleWindow() 64 | ctypes.windll.user32.ShowWindow(console, 0) 65 | ctypes.windll.kernel32.CloseHandle(console) 66 | -------------------------------------------------------------------------------- /ui/gtk_markup_substring.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Lara Maia 2015 ~ 2016 4 | # 5 | # The Steam Tools is free software: you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation, either version 3 of 8 | # the License, or (at your option) any later version. 9 | # 10 | # The Steam Tools is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see http://www.gnu.org/licenses/. 17 | # 18 | 19 | import gi 20 | 21 | gi.require_version('Gtk', '3.0') 22 | 23 | from gi.repository import Gtk 24 | 25 | 26 | def set_from_css(widget, styles, params): 27 | context = widget.get_style_context() 28 | 29 | markup = [] 30 | for style, param in zip(styles, params): 31 | context.save() 32 | context.add_class(style) 33 | foreground = context.get_color(Gtk.StateFlags.NORMAL) 34 | 35 | foreground_hex = '#' 36 | for color in foreground.to_string()[4:-1].split(','): 37 | foreground_hex += '{:02x}'.format(int(color)) 38 | 39 | markup.append('{} '.format(foreground_hex, param)) 40 | 41 | context.restore() 42 | 43 | widget.set_markup(''.join(markup)) 44 | -------------------------------------------------------------------------------- /ui/icons/Default/LICENSE: -------------------------------------------------------------------------------- 1 | Icons based on Meliae Icon Set 2 | Developed by Sora 3 | Meliae icons are all licensed under the GPL-2 4 | -------------------------------------------------------------------------------- /ui/icons/Default/actions/22/gtk-quit.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 23 | 27 | 31 | 32 | 34 | 38 | 42 | 43 | 46 | 50 | 51 | 60 | 69 | 70 | 90 | 92 | 93 | 95 | image/svg+xml 96 | 98 | 99 | 100 | 101 | 102 | 107 | 117 | 127 | 131 | 135 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /ui/icons/Default/actions/48/gtk-quit.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 23 | 27 | 31 | 32 | 34 | 38 | 42 | 43 | 46 | 50 | 51 | 60 | 69 | 70 | 90 | 92 | 93 | 95 | image/svg+xml 96 | 98 | 99 | 100 | 101 | 102 | 107 | 117 | 127 | 131 | 135 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /ui/icons/Default/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Steam Tools Minimal Icon Set 3 | Comment=A modern, professional icon theme for the GNOME Desktop Environment 4 | Directories=actions/22,animations/48 5 | 6 | [actions/22] 7 | Size=22 8 | Context=Actions 9 | Type=Scalable 10 | 11 | [animations/48] 12 | Size=48 13 | Context=Animations 14 | Type=Scalable 15 | -------------------------------------------------------------------------------- /ui/icons/steam-tools.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steam-tools.ico -------------------------------------------------------------------------------- /ui/icons/steam-tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steam-tools.png -------------------------------------------------------------------------------- /ui/icons/steam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steam.png -------------------------------------------------------------------------------- /ui/icons/steam_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steam_green.png -------------------------------------------------------------------------------- /ui/icons/steam_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steam_red.png -------------------------------------------------------------------------------- /ui/icons/steam_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steam_yellow.png -------------------------------------------------------------------------------- /ui/icons/steamcompanion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamcompanion.png -------------------------------------------------------------------------------- /ui/icons/steamcompanion_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamcompanion_green.png -------------------------------------------------------------------------------- /ui/icons/steamcompanion_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamcompanion_red.png -------------------------------------------------------------------------------- /ui/icons/steamcompanion_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamcompanion_yellow.png -------------------------------------------------------------------------------- /ui/icons/steamgifts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamgifts.png -------------------------------------------------------------------------------- /ui/icons/steamgifts_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamgifts_green.png -------------------------------------------------------------------------------- /ui/icons/steamgifts_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamgifts_red.png -------------------------------------------------------------------------------- /ui/icons/steamgifts_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamgifts_yellow.png -------------------------------------------------------------------------------- /ui/icons/steamtrades.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamtrades.png -------------------------------------------------------------------------------- /ui/icons/steamtrades_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamtrades_green.png -------------------------------------------------------------------------------- /ui/icons/steamtrades_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamtrades_red.png -------------------------------------------------------------------------------- /ui/icons/steamtrades_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calendulish/steam-tools/e4ef1972810696fc4838d0f61e15ff7b6486ec4c/ui/icons/steamtrades_yellow.png -------------------------------------------------------------------------------- /ui/interface.css: -------------------------------------------------------------------------------- 1 | entry { color: darkslategrey; } 2 | 3 | #auto_trade_tab { color: darkgrey; } 4 | #authenticator_tab { color: darkgrey; } 5 | 6 | #info_label { color: white; background: darkblue; } 7 | #warning_label { color: white; background: darkred; } 8 | 9 | #version_label { font-size: x-small; } 10 | #version_label.text { color: darkblue; } 11 | #version_label.version { color: darkgreen; } 12 | 13 | #browser_label { font-size: x-small; } 14 | #browser_label.text { color: darkblue; } 15 | #browser_label.browser { color: darkgreen; } 16 | 17 | #browser_profile { font-size: x-small; } 18 | #browser_profile.text { color: darkblue; } 19 | #browser_profile.account { color: darkgreen; } 20 | #browser_profile.profile { color: gray; } 21 | -------------------------------------------------------------------------------- /ui/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | File 7 |
8 | 9 | gtk-quit 10 | Quit 11 | app.quit 12 | 13 |
14 |
15 | 16 | Edit 17 |
18 | 19 | gtk-connect 20 | Browser Profile 21 | app.browser_profile 22 | 23 | 24 | gtk-apply 25 | Re-check logins 26 | app.recheck_logins 27 | 28 | 29 | gtk-properties 30 | Settings 31 | app.settings 32 | 33 |
34 |
35 | 36 | Help 37 |
38 | 39 | gtk-about 40 | About 41 | app.about 42 | 43 |
44 |
45 |
46 |
47 | -------------------------------------------------------------------------------- /ui/version.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import importlib.machinery 4 | 5 | __VERSION_MAJOR__ = '2' 6 | __VERSION_MINOR__ = '0' 7 | __VERSION_REVISION__ = '2' 8 | __VERSION_EXTRA__ = 'GIT' 9 | 10 | try: 11 | if hasattr(sys, "frozen") or not os.name == 'nt': 12 | __version_module_path__ = os.path.join(os.getcwd(), 'version.pyc') 13 | __version_class__ = importlib.machinery.SourcelessFileLoader('version', __version_module_path__) 14 | __version_module__ = __version_class__.load_module() 15 | 16 | for var in dir(__version_module__): 17 | locals()[var] = eval('__version_module__.' + var) 18 | except FileNotFoundError: 19 | pass 20 | 21 | __VERSION__ = '{}.{}.{} {}'.format(__VERSION_MAJOR__, 22 | __VERSION_MINOR__, 23 | __VERSION_REVISION__, 24 | __VERSION_EXTRA__) 25 | --------------------------------------------------------------------------------