Code Monkey home page Code Monkey logo

my-sutekh-test's Introduction

Sutekh: A VTES card manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Requirements
============

The Python modules required are:

* SQLObject [ https://pypi.org/project/sqlobject/, version 0.9.0
  or later]
* singledispatch [ https://pypi.org/project/singledispatch/ ]
* PLY (for parsing the query language) [ https://pypi.org/project/ply/ ]
* sqlite (or the module for whatever database one plans to use)
* PyGtk (for the GUI) [ https://pypi.org/project/pygtk/ ]
* librsvg2 for the sutekh icon
* configobj to manage the config file [ https://pypi.org/project/configobj/ ]
* keyring so the secret library plugin can store credentials in the system
  keyring [ https://pypi.org/project/keyring/ ]

Sutekh can download the official cardlist and rulings. If you have limited
connectivity, you will need to download the official cardlist from

* http://www.vekn.net/images/stories/downloads/cardlist.txt

to a local file and use that.

Getting Started
===============

These instructions assume you have run setup.py install or setup.py develop,
which creates the correct name for the scripts.

Most operations can be accomplished via the gui. You will be prompted
to load the WW cardlist the first time you run Sutekh. These instructions
cover the command line tool sutekh-cli, while help for the gui can be found
either by using the help menu, or in sutekh/docs/html_docs/

To get started with sutekh-cli, run:

::

  sutekh-cli --help
  sutekh-cli -c --fetch-files # download the cardlist and rulings

or

::

  sutekh-cli -c -r vtes_card_file.txt # local copy
  sutekh-cli --ruling-file vtes_ruling_file.html (optional)

The card list and card sets can be manipulated and examined via the gui

Its possible to query individual cards:::

 sutekh-cli --print-card='Aching Beauty'

Likewise, it's also possible to export and read in card sets.::

  sutekh-cli --save-cs "Toreador Deck" --cs-filename=deck.xml

saves the card set called "Toreador Deck" to the file "deck.xml", while::

  sutekh-cli --read-cs="vampires.xml"

loads the Card Set saved as vampires.xml

A card set can be printed to screen using:::

  sutekh-cli --print-cs='Toreador Deck'

The list of card sets can be seen using:::

  sutekh-cli --list-cs

A --reload option exists for when re-importing the official cardlists and
rulings.  This dumps and then reloads the card list and all the card sets.

Typically used as:::

  sutekh-cli -c --reload --fetch-files

The command line tool can be used to run filters:::

  sutekh-cli --filter='<Filter>'

will filter the WW card list using the given filter

The --filter-detailed will print the full details of all matching cards,
rather than just the names.

The filters can also be run on a card set, by using the --filter-cs option

So:
::

  sutekh-cli --filter="CardText='stealth' and CardType='Action Modifier'" \
  --filter-cs='Tzimisce deck' --filter-detailed

will list and print details of all action modifiers containing with 'stealth'
in their card text for the card set 'Tzimisce deck'

Windows Development Quickstart
==============================

The easiest method is to use the provided installer. This bundles the
required files from gtk, python and the required modules for running sutekh.
The installer currently uses python 3.8.

For development, we recommend using msys2 from https://www.msys2.org/ as that is
the recommended way of installing gtk3 on windows.

Install the following packages to have gtk3 available in the mingw64 enviroment
  - pacman -Ss mingw-w64-x86_64-gtk3 mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-gobject

Using the mingw64 bit enviroment, use pip to install the other dependencies
 * SQLObject
 * confiobj
 * ply
 * keyring

To runnt the tests, you will also need to install
 * pytest
 * mock

Run easy_install <Sutekh Egg File>.

Run <python install dir>/Scripts/sutekh

MacOS Development Quickstart
============================

MacOS support in sutekh is not currently well tested, but it should work.

You will need to install the following homebrew packages
  - [email protected]
  - gtk+3
  - gobject-introspection
  - librsvg
  - adwaita-icon-theme (or some other suitable icon theme)

The remaining required packages should be installed using pip3
  - keyring
  - ply
  - sqlobject
  - configobj
  - PyGObject
  - pycairo

sutekh can then be installed from source in a virtual environment.

Bundled Installers
==================

We have a windows installer that installs Sutekh and all the required
requirements as a standalone application. It can be downloaded from
sourceforge. You will need to add a security exception to run the
installer.

There is an experimental MacOS bundle available. Because of how this MacOS
bundle is built, it only supports MacOS version >= 10.15 . To use it, extract
the tarball and launch the extracted app from the file manager. You will need
to add a security exception for this to work.

Using Sutekh from the Python Interpreter
========================================

Sutekh also allows you to play around with the database from inside the Python
interpreter:

::

  python
  >>> from sutekh import *
  >>> start()

An example:

Print all Malkavian cards:

::

  >>> for oC in Clan.byName('Malkavian').cards:
  ...           print oC.name

  >>> oTony = AbstractCard.byName('Tony (Group 3)')
  >>> print oTony
  >>> for oP in oTony.discipline:
  ...     print oP.level, oP.discipline
  >>> print oTony.cardtype
  >>> print oTony.capacity
  >>> print oTony.clan
  >>> print oTony.group
  >>> print oTony.text
  >>> oMariel = list(AbstractCard.select(AbstractCard.q.name.startswith('Mariel')))[0]

Filtering:

::

  >>> aC = AbstractCard.select(CardTextFilter('Laibon').getExpression())
  >>> for oC in aC:
  ...     print oC.name, oC.cardtype

  >>> oF1 = DisciplineFilter('Dementation')
  >>> oF2 = CardTextFilter('bleed')
  >>> oF3 = CardTypeFilter('Action')
  >>> oF4 = CardTypeFilter('Action Modifier')
  >>> oF5 = FilterOrBox([oF3,oF4])
  >>> oF = FilterAndBox([oF1,oF2,oF5])
  >>> for oC in AbstractCard.select(oF.getExpression()):
  ...     print "---", oC.name, "---"
  ...     print oC.text

Database Notes
==============

Using other database backends
-----------------------------

Sutekh has been developed mainly with sqlite, but, since it uses SQLObject for
to manage the databases, it is possible to try other database backends by
specifying a suitable URI. For both sutekh and sutekh-cli, the -d
parameter specifies the database to use.

This can also be set for the gui using the "database url" parameter in the
config file.

Sutekh is frequently tested using MySQL and PostgresSQL.

To use a PostgresSQL database with Sutekh, specify:::

  sutekh -d postgres://username@host/database

With SQLObject 0.9, the url syntax for MySQL is somewhat complex, due
to the encoding issues involved. We have had good results using utf8 as the
encoding, specified as:

::

  mysql://username@host/database?sqlobject_encoding=utf8&charset=utf8

In our experience, utf8 is the most robust and portable choice.

When using sqlobject 0.10 or later, the sqlobjct_encoding parameter is no
longer needed, and the URI can be simplified to:

::

  mysql://username@host/database?charset=utf8

MySQL 4 or earlier will definitely NOT work. This is unlikely to ever change.

Other databases are untested.

To dump data between databases, you can use the zip file support. Something
like (assuming that the new database has already had the cardlist & rulings
imported):::

  sutekh-cli -d <old_database_uri> --dump-zip=zipfile.zip
  sutekh-cli -d <new_database_uti> --restore-zip=zipfile.zip

Disabling SQLObject caching
---------------------------

When using the default sqlite database, Sutekh disables SQLObject's internal
caching. As a number of the items SQLObject caches aren't important to Sutekh,
and, on large card set loads, the overhead of maintaining the cache is
significant, it can be beneficial to disable the cache with other database as
well. Disabling the cache is recommended with SQLObject 0.12 and later, where
changes to the cache culling algorithm have a more noticeable impact on
performance.

To disable the cache for the other databases, append '?cache=False' to
the database url:::

  sutekh -d postgres://username@host/database?cache=False

or::

  sutekh -d mysql://username@host/database?cache=False&charset=utf8

Clustering Plugin
=================

Sutekh has the ability to data mine card sets for related groups of
cards using the Cluster 3.0 [1] data clustering package. You'll need to download
a version of Cluster 3.0 (the command-line only version has the least
dependencies if you're looking to get up and running quickly on a Unix platform).
Once you've created a bunch of clusters of related cards, the clustering
plugin gives you the option of creating decks from whichever clusters look
promising.

You'll also need to obtain Pycluster (from the same page) which contains the
Python bindings for Cluster 3.0. Alternatively you can the Bio.Cluster version
of Pycluster.

You may also like to obtain a program for viewing the clustering output
although Sutekh doesn't currently support writing out the clusters. One
such viewer is TreeView (unfortunately Java-based) [2].

If you don't have any of these clustering packages, Sutekh will simply not
load the clustering plugin and run fine without it.

[1] http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/cluster/software.htm
[2] http://jtreeview.sourceforge.net/

If you're wanting to modify the clustering plugin, you can find some usage
examples at:

[3] http://www.dalkescientific.com/writings/NBN/clustering.html
[4] http://b-src.cbrc.jp/markup/Pycluster-1.29/python/test/test_Cluster.py

Philosophy
==========

Conceptually Sutekh is organised around two datatypes, AbstractCard
and PhysicalCard. AbstractCard models a conceptual card (e.g. ".44 Magnum")
while PhysicalCard stores information about an actual rectangular piece of
cardboard (e.g. My third copy of a .44 Magnum from the VTES expansion).

Other Notes
===========

Sutekh and gtk themes
---------------------

It is possible to customise the look and feel of Sutekh quite extensively
via gtk's theming mechanism. Sutekh uses "Sutekh" as the application name
for such purposes. All the dialogs use Sutekh.dialog.

Of specific note, the pane title's are named 'frame_title' when not selected
and 'selected_title' when the pane is selected. This allows customising
the look of panes when selected easily. For instance, by putting:

::

   style "title_selected" {
      fg[NORMAL] = "red"
   }

widget "Sutekh.*.selected_title" style "title_selected"

in your gtkrc file, the selected panes will use red text to mark selected panes.

The other specially named widgets are the card list widgets.

The various frames are named respectively:

"abstract card list", "physical card list", "physical card set card list",
"abstract card set card list", "card text", "abstract card sets list",
"physical card sets list"

The TreeView widgets used by the card lists (AbstractCard, PhysicalCard and card
sets) are named "normal_view", but, in editable mode, they are named
"editable_view".

User Documentation
==================

The user documentation is available under the sutekh/docs directory. The
Documentation is maintained as text files written using textile [1] Markup in
the sutekh/docs/textile directory, and using on pytextile [2] and the included
textile2html.py script to convert it to HTML for display in the gui.

[1] http://textile.thresholdstate.com/

[2] https://pypi.org/project/textile/

Testing Sutekh
==============

Sutekh has a test suite - see the tests directory.

The test suite requires pytest [1] to run.

By default, the tests will use an sqlite memory database, as being the
simplest, but, as it's often desirable to test against other databases,
the SUTEKH_TEST_DB environment variable can be used to provide an URI
to use instead. For example, to test against a postgres db:::

  export SUTEKH_TEST_DB="postres://username@host/test_database"
  pytest <test to run>

Note that the test suite creates and drops the tables several times, so it can
be quite slow. Also, DO NOT run the tests against your personal card database,
as you will lose data. Use a dedicated test database for this.

Setting SUTEKH_SAVE_DB to yes will preserve the database state at the end of
the last test run. This can be combined with the with-ids option for selecting
which test to run to save the state after a specific test.

[1] https://docs.pytest.org/en/stable/

Importing/Exporting to/from other VTES card management programs
===============================================================

Sutekh can read the inventory and deck files produced by both the "Anarch
Revolt Deck Builder" (http://code.google.com/ardb) and the "Fragment of the
Elder Library Deck Builder" (http://csillagbolcselet.hu/feldb/). Files will
be imported as card sets into Sutekh. Because of differences between the
programs, some concepts won't be transferred.

Sutekh can also export card sets to these formats, but this will probably
not work for all versions of ARDB or FELDB.

Sutekh has support for importing and exporting inventories and decks to and
from the Secret Library (http://www.secretlibrary.info/).

Sutekh also supports exporting card sets to the following VtES online
implementations:
* Lackey CCG
* JOL
* Tabletop Simulator (requires access to the VtES deck building TTS module)

Card Names
==========

Sutekh maintans a unique name for every card. For library cards, this is just the
card name, but for vampires, since there are both normal and advanced vampires, and
some vampires have multiple versions in different groups, Sutekh appends the group
number and the 'Advanced' status to the name.

For example, the different versions of 'Theo Bell', are stored as
* Theo Bell (Group 2)
* Theo Bell (Group 2) (Advanced)
* Theo Bell (Group 6)

If importing a vampire, Sutekh will default to using the first version issued, if
it can't work out the correct version, so 'Theo Bell' will be imported as
'Theo Bell (Group 2)'


Getting the current development code
====================================

Sutekh is hosted on sourceforge using git. See https://sourceforge.net/p/sutekh/sutekh/ for
details on how to clone the repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.