Compare commits
No commits in common. "7.0.0b15" and "main" have entirely different histories.
2
.github/workflows/mirror.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
mirror-to-codeberg:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: pixta-dev/repository-mirroring-action@v1
|
||||
|
||||
15
.gitignore
vendored
@ -1,13 +1,4 @@
|
||||
*.egg*
|
||||
tags
|
||||
__pycache__
|
||||
prio.otl
|
||||
bugs
|
||||
build/
|
||||
.ruff_cache/
|
||||
.pytest_cache/
|
||||
.mypy_cache/
|
||||
notes.otl
|
||||
uv.lock
|
||||
.coverage
|
||||
pyapp-latest/
|
||||
dist/
|
||||
pre-commit
|
||||
tests/
|
||||
|
||||
6
.gitmodules
vendored
@ -1,6 +0,0 @@
|
||||
[submodule "dzgui/lib/dayzquery"]
|
||||
path = dzgui/lib/dayzquery
|
||||
url = https://github.com/Yepoleb/dayzquery.git
|
||||
[submodule "dzgui/lib/a2s"]
|
||||
path = dzgui/lib/a2s
|
||||
url = https://github.com/Yepoleb/python-a2s.git
|
||||
@ -1,20 +0,0 @@
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.6
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.18.2
|
||||
hooks:
|
||||
- id: mypy
|
||||
args: [--strict, --ignore-missing-imports]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: copy-clog
|
||||
name: Copy CHANGELOG.md to package data dir
|
||||
entry: python scripts/copy_changelog.py
|
||||
language: system
|
||||
- id: untracked
|
||||
name: Check for untracked files not present in .gitignore
|
||||
entry: python scripts/untracked.py
|
||||
language: system
|
||||
94
CHANGELOG.md
@ -1,99 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## Added
|
||||
- Setup wizard
|
||||
- Changelog text wrapping and formatting
|
||||
- Changelog ships with source
|
||||
- Documentation ships with source
|
||||
- Decouple UI components into modules
|
||||
- Choose from kilometer or miles distance display
|
||||
- More granular haversine calculation
|
||||
- Parse XDG data dirs with fallbacks
|
||||
- Dedicated mods page
|
||||
- Dedicated thanks page
|
||||
- Rearrange menus/breadcrumbs
|
||||
- Open filepicker when generating system log
|
||||
- Developers page (and -d flag)
|
||||
- Redact API key in log table
|
||||
- Integrate add/connect widgets into main menu
|
||||
- Favorite/connect/LAN panels integrated with server views
|
||||
- Abort on first LAN server found
|
||||
- Colorized IP/ID validation fields
|
||||
- Copy favorite server IP to clipboard
|
||||
- Set favorite server from tables
|
||||
- Detailed/copyable trace in critical error dialogs
|
||||
- Visual icons
|
||||
- Integrated server notebook
|
||||
- Propagate width changes to all tables
|
||||
- Remember tree position in menus
|
||||
- Show hidden server count after filtering
|
||||
- Atomic map filters per server context
|
||||
- Use concurrency when checking stale mods (performance uplift)
|
||||
- Copy version by clicking label
|
||||
- Add server name to server mod dialogs
|
||||
- Lazy load ping cell data func
|
||||
- Refresh servers button
|
||||
- Early load alerts button
|
||||
- Preconnect dialog
|
||||
- Preconnect warnings/failsafes like filesize
|
||||
- Save filters per server context between sessions
|
||||
- Preboot progress dialog
|
||||
- Choose to jump into splash screen instead of server
|
||||
- Collapsible connection panel
|
||||
- Play offline (load mods directly)
|
||||
|
||||
## Changed
|
||||
- Conform to PEP 440 versioning for beta versions
|
||||
- Reduce padding on keys button
|
||||
- Boldface breadcrumbs
|
||||
- Bold labels inside frames
|
||||
- Sidebar buttons do not steal focus
|
||||
- Copy IP copies IP:queryport only instead of IP:gameport:queryport, mimics syntax needed by add by ip method
|
||||
- Load new model into view without flushing
|
||||
- Cull servers with abnormal queue values (integer overflow: 2147483647)
|
||||
- Packaging structure
|
||||
- Suppress log messages from imported modules
|
||||
- Embed Workshop link in Options menu
|
||||
- Disable overlay scrollbars on server tables
|
||||
- Reduce size of geolocation DB on disk (~100MB)
|
||||
- Enable LAN page Empty/Full filters on first run of app
|
||||
- Propagate subscribed mods to Steam client
|
||||
|
||||
## Dropped
|
||||
- Debug mode
|
||||
- Branch switching
|
||||
- Manual mod install mode (describe rationale)
|
||||
- Force update mods
|
||||
|
||||
## Fixed
|
||||
- Longstanding issue with left clicks not registering as tree selection changes after spamming keyboard input
|
||||
- Center server title text on server dialogs
|
||||
- Rare segfaults when changing maps (threading)
|
||||
- Moved dialogs out of threads
|
||||
|
||||
## Unreleased
|
||||
- Load offline mods
|
||||
- Local documentation
|
||||
- Raw debug command in context menu
|
||||
|
||||
## Developer-facing
|
||||
- Add pyproject.toml file
|
||||
- Show deprecation warnings
|
||||
- Options -> Dev page
|
||||
|
||||
## [6.0.5] 2026-05-17
|
||||
## Changed
|
||||
- Update symlink hash logic to align with DZGUI 7 beta
|
||||
- Update A2S helper to latest commit
|
||||
|
||||
## [6.0.4] 2026-04-13
|
||||
## Fixed
|
||||
- Update A2S module checksums to support servers with missing description field
|
||||
|
||||
## [6.0.3] 2026-04-12
|
||||
## Fixed
|
||||
- Use GLibUnix namespace where available when setting up SIGINT callback
|
||||
|
||||
## [6.0.2] 2026-01-26
|
||||
## Fixed
|
||||
- Explicitly use Python 3.13 when calling subprocesses
|
||||
|
||||
71
CONTRIBUTING.md
Normal file
@ -0,0 +1,71 @@
|
||||
# Introduction
|
||||
|
||||
Thank you for your interest in DZGUI!
|
||||
|
||||
This guide goes over development conventions and best practices for contributors.
|
||||
If you are a developer, you can skip to the end.
|
||||
|
||||
# Requesting help
|
||||
|
||||
If you encounter a problem with DZGUI, you can submit tickets on the GitHub
|
||||
(issue tracker)[https://github.com/aclist/dzgui-devel/issues] under the
|
||||
`troubleshooting` tag.
|
||||
|
||||
# How can I help the project?
|
||||
|
||||
There are several ways to help this project.
|
||||
1. Report bugs that you find
|
||||
2. Request features that you would like
|
||||
3. Contribute features and fixes to the codebase
|
||||
4. Contribute documentation to the project
|
||||
|
||||
Before making any contribution, please read the `CODE_OF_CONDUCT.md` and act
|
||||
accordingly.
|
||||
|
||||
## Submitting a ticket
|
||||
|
||||
Navigate to the GitHub (issue tracker)[https://github.com/aclist/dzgui-devel/issues].
|
||||
From there, follow the onscreen prompts. You will be asked questions such as:
|
||||
|
||||
- What version are you using?
|
||||
- What distribution are you using?
|
||||
- What is the issue that you found?
|
||||
- How can we reproduce the issue?
|
||||
|
||||
You can also attach screenshots, logs, or other data that can help us.
|
||||
|
||||
## Requesting a feature
|
||||
|
||||
You can also request features via the same issue tracker. It is good practice to
|
||||
first search for your idea to see if a similar one has already been posted.
|
||||
If not, open a ticket where you describe your feature and its possible benefits.
|
||||
|
||||
Please note that this is a community project, so it takes time for us to develop
|
||||
features. Putting in a feature request does not mean that it will be implemented,
|
||||
but we will do our best to support as many cool ideas as possible.
|
||||
|
||||
## Contributing code or documentation
|
||||
|
||||
If you would like to take ownership or assist with an issue on the issue tracker, or
|
||||
contribute a new change, please follow the guidelines below.
|
||||
|
||||
Fork this repository and check out the code up to `prerelease/<latest-version>`.
|
||||
If there is no pending prerelease PR, you can base your changes off of
|
||||
the `testing` branch. You may later be asked to retarget your PR to the prerelease
|
||||
branch once a new one is made. This is because out-of-band PRs are consolidated into
|
||||
the next release before merging.
|
||||
|
||||
The following naming conventions apply for PRs:
|
||||
- fix/<your-fix> - patch/hotfix branches
|
||||
- feat/<your-feature> - feature branches
|
||||
- doc/<your-doc-branch> - documentation branches
|
||||
- infra/<your-infra-branch> - infrastructure branches
|
||||
|
||||
Implement your changes and test them locally. If they work you may
|
||||
open a merge request, and then we review your changes. If everything is OK, it
|
||||
will be merged to `prerelease/<latest-version>`, then `testing`, and after a live
|
||||
testing phase, to `stable` as well.
|
||||
|
||||
It is recommended to follow
|
||||
(Conventional Commits)[https://www.conventionalcommits.org/en/v1.0.0/], as this
|
||||
integrates well with tooling and helps the project review your code.
|
||||
@ -1,30 +0,0 @@
|
||||
# TODO: link to here from sphinx docs
|
||||
|
||||
## Installing from source
|
||||
|
||||
### Fetch submodules
|
||||
git submodule update --recursive --init
|
||||
|
||||
### Install with dev dependencies
|
||||
uv pip install -e '.[dev]'
|
||||
|
||||
This includes all dependencies for building, linting, testing, and checking in code.
|
||||
If you optionally want to install only a subset of dev tools, replace 'dev' with the following flag:
|
||||
|
||||
build: package release deps
|
||||
docs: documentation tools
|
||||
lint: code linting, fixing, and type checking
|
||||
test: unit and integration tests
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
### Setting up precommit hooks
|
||||
pre-commit install
|
||||
|
||||
### Building documentation
|
||||
sphinx-build -M html source build -a
|
||||
|
||||
### Building standalone release binaries
|
||||
1. Set up the build target: `rustup target add x86_64-unknown-linux-musl`
|
||||
2. Run `python3 scripts/release.py`
|
||||
3. Generate a release and tag against the resulting tarfile generated in `dist`
|
||||
37
README.md
@ -1,37 +1,34 @@
|
||||
## What this is
|
||||
DZGUI is a turnkey browser and mod manager for DayZ on Linux. It allows you to connect to both official and modded/community DayZ servers on Linux via a graphical user interface (GUI).
|
||||
DZGUI allows you to connect to both official and modded/community DayZ servers on Linux and provides a graphical interface for doing so.
|
||||
|
||||
This overcomes certain limitations in the Linux client and helps prepare the game to launch by providing features like:
|
||||
|
||||
- Search for and display global and LAN servers via an interactive table
|
||||
- Supports official, third-party, and modded DayZ servers
|
||||
- Automatically find and prepare mods being requested by servers
|
||||
- Search for and display server metadata in a table (server name, player count, ping, queue size, current gametime, distance, IP)
|
||||
- Add/delete/manage favorite servers by IP or ID
|
||||
- Quick-connect to favorite/recent servers
|
||||
- Manage local mods and symlinks
|
||||
- Prepare launch options to pass to Steam
|
||||
- Find and prepare mods being requested by servers (choose from manual or automatic installation)
|
||||
- Bulk delete/update local mods
|
||||
- Concatenate launch options to pass to Steam
|
||||
- Connect to mod-enabled LAN servers
|
||||
|
||||
## Design philosophy
|
||||
|
||||
DZGUI follows a specific set of guidelines, enumerated below:
|
||||
|
||||
- Provide a free and open-source tool under GPL
|
||||
- Do not use undocumented, third-party servers to aggregate data; no central "DZGUI" server
|
||||
- All connections go to Steam and DayZ servers directly; the tool should function in perpetuity without intermediary endpoints
|
||||
- Target Linux desktop and Steam deck specifically; not a cross-platform tool
|
||||
|
||||
## Setup and usage
|
||||
|
||||
Please refer to the documentation for installation and setup instructions:
|
||||
Refer to the documentation for installation and setup instructions:
|
||||
|
||||
- [GitHub](https://aclist.github.io/dzgui/index.html)
|
||||
- [Codeberg (Mirror)](https://aclist.codeberg.page)
|
||||
- [Mirror (Codeberg)](https://aclist.codeberg.page)
|
||||
|
||||

|
||||
|
||||
## Attribution
|
||||
|
||||
Geolocation records from [DB-IP](https://db-ip.com) under [CC 4.0 license](https://creativecommons.org/licenses/by/4.0/)
|
||||
|
||||
This tool uses [python-a2s](https://github.com/Yepoleb/python-a2s) and [dayzquery](https://github.com/Yepoleb/dayzquery) as submodules; licenses for these submodules can be found in the LICENSES file
|
||||
of the project root.
|
||||
|
||||
Both the geolocation records and submodules listed above are not shipped with the source code, but are retrieved and assembled at runtime.
|
||||
|
||||
Finally, executable versions of DZGUI shipped as release binaries are thin wrappers around the Python interpreter, and also retrieve and assemble the above dependencies at runtime on the end-user's
|
||||
machine, rather than using pre-compiled source code. Users wishing to review these dependencies can inspect the 'pyproject.toml' manifest in the project root.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
DZGUI is beta-quality software and is provided as-is.
|
||||
|
||||
674
docs/LICENSE
@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@ -1,20 +0,0 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -a
|
||||
@ -1,22 +0,0 @@
|
||||
## Dependencies:
|
||||
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Setup:
|
||||
|
||||
1. Modify `source/conf.py`.
|
||||
2. Add .rst pages to `source` tree.
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
$ mkdir build
|
||||
$ sphinx-build -M html source build -a
|
||||
```
|
||||
|
||||
## Publish
|
||||
Export contents of `build/html` to host.
|
||||
|
||||
N.B. For GitHub, touch `.nojekyll` file on the root of the branch.
|
||||
@ -1,502 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@ -1,48 +0,0 @@
|
||||
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||
--------------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||
otherwise using this software ("Python") in source or binary form and
|
||||
its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF
|
||||
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
||||
license to reproduce, analyze, test, perform and/or display publicly,
|
||||
prepare derivative works, distribute, and otherwise use Python
|
||||
alone or in any derivative version, provided, however, that PSF's
|
||||
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
|
||||
2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved"
|
||||
are retained in Python alone or in any derivative version prepared
|
||||
by Licensee.
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python.
|
||||
|
||||
4. PSF is making Python available to Licensee on an "AS IS"
|
||||
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between PSF and
|
||||
Licensee. This License Agreement does not grant permission to use PSF
|
||||
trademarks or trade name in a trademark sense to endorse or promote
|
||||
products or services of Licensee, or any third party.
|
||||
|
||||
8. By copying, installing or otherwise using Python, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Gabriel Huber
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@ -1,176 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2009, Jay Loden, Dave Daeschler, Giampaolo Rodola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the psutil authors nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Gabriel Huber
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@ -1,175 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@ -1,35 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.https://www.sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
||||
@ -1,2 +0,0 @@
|
||||
sphinx-rtd-theme
|
||||
sphinx-copybutton
|
||||
@ -1,60 +0,0 @@
|
||||
Submitting a ticket
|
||||
==========================
|
||||
|
||||
Tickets are tracked at the `DZGUI issue tracker <https://github.com/aclist/dztui/issues>`_.
|
||||
|
||||
You will need to `register for a GitHub account <https://github.com/signup>`_ in order to submit one.
|
||||
|
||||
If have checked the :doc:`kb` and `closed issues <https://github.com/aclist/dztui/issues?q=is%3Aissue+is%3Aclosed>`_ area and did not find a solution, three ticket types are provided for your
|
||||
convenience:
|
||||
|
||||
- **Bug report**: for unexpected, breaking behavior in the application
|
||||
- **Feature request**: to propose new functionality
|
||||
- **Troubleshooting**: if all else fails, you can request help here
|
||||
|
||||
Reports by example
|
||||
--------------------------
|
||||
|
||||
Below are some examples of how to format a constructive report that will ensure your problem can be resolved in a timely fashion.
|
||||
|
||||
A non-actionable report
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Subject: add button
|
||||
|
||||
hi, you must add a button to show how long I have to wait to join a full server, the app is useless without this...do your job, guys!!! ;-)
|
||||
|
||||
|
||||
This report exhibits a number of problems:
|
||||
|
||||
- Vague title and summary: in addition to being unclear, this will slow down filing the incoming report.
|
||||
- Problem space is poorly defined: it is not clear where the issue lies, where the feature is supposed to be implemented, nor why.
|
||||
- Lack of context: the feature may already exist, but there is not enough information to go on. Alternatively, the feature may be technically impossible to implement, but there is not enough
|
||||
information to go on.
|
||||
- Incorrect report type: this is a feature request filed as a bug report.
|
||||
- Unprofessional tone: the message is disrespectful towards project members and inserts the user's subjective opinion.
|
||||
|
||||
An actionable report
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Subject: Version 5.5.0-beta.2 crashes when selecting multiple table rows via Ctrl-click
|
||||
|
||||
This occurs specifically on version 5.5.0-beta.2 if the setting ALLOW_MULTI is set to ON. I was able to reproduce it using the following steps:
|
||||
|
||||
Distribution: Fedora
|
||||
|
||||
- Ensure that ALLOW_MULTI is set to ON
|
||||
- Open the application and immediately navigate to the Server Browser
|
||||
- Uses the Ctrl-click binding to select multiple rows in the table
|
||||
- After >1 row is selected, the application crashes to the desktop with the following traceback (see attached dump)
|
||||
|
||||
Thanks for looking into this.
|
||||
|
||||
|
||||
This report is actionable because it is objective, specific, and detailed:
|
||||
|
||||
- The subject is clearly defined: specific details ensure it will be filed in a timely manner.
|
||||
- Scope is explicit: the specific version, settings, and conditions under which the problem occur were given.
|
||||
- Ample context: the user gave steps to reproduce the problem and clarified each one.
|
||||
- Courteous tone: the user interacted with project members in a professional manner.
|
||||
- Supporting information: the user provided a crash dump to expedite resolution of the issue.
|
||||
@ -1,40 +0,0 @@
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# For the full list of built-in configuration values, see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||
|
||||
project = 'DZGUI'
|
||||
author = 'aclist'
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||
|
||||
extensions = []
|
||||
|
||||
templates_path = ['_templates']
|
||||
exclude_patterns = []
|
||||
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
#html_theme = 'alabaster'
|
||||
extensions = [
|
||||
'sphinx_rtd_theme',
|
||||
'sphinx_copybutton',
|
||||
"sphinx.ext.autosectionlabel",
|
||||
"sphinx.ext.githubpages"
|
||||
]
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
#html_static_path = ['_static']
|
||||
html_show_sphinx = False
|
||||
html_show_copyright = False
|
||||
html_show_sourcelink = False
|
||||
|
||||
today_fmt = "%Y-%m-%d"
|
||||
release = "6.x.x - 7.x.x"
|
||||
version = "6.x.x - 7.x.x"
|
||||
@ -1,19 +0,0 @@
|
||||
Developers
|
||||
===========
|
||||
|
||||
This project is open source under the GPLv3 license. You can find the source code on
|
||||
`GitHub <https://github.com/aclist/dztui>`_. If you wish to contribute to
|
||||
development, you will find further help in the
|
||||
`CONTRIBUTING.md <https://github.com/aclist/dztui/blob/main/CONTRIBUTING.md>`_
|
||||
file.
|
||||
|
||||
All contributors are expected to act in accordance with the project's
|
||||
`code of conduct <https://github.com/aclist/dztui/blob/main/CODE_OF_CONDUCT.md>`_,
|
||||
and follow the project's standards and guidelines.
|
||||
|
||||
To install DZGUI and related dependencies for linting, testing, and version control,
|
||||
invoke the command ``uv pip install .[dev]``.
|
||||
|
||||
After this process, install the applicable pre-commit hooks by invoking the command ``pre-commit install``.
|
||||
|
||||
These pre-commit hooks enforce code checks that prevent making commits unless the relevant tests pass.
|
||||
@ -1,110 +0,0 @@
|
||||
Installation (DZGUI 6 legacy)
|
||||
==================
|
||||
|
||||
Basic runtime dependencies
|
||||
---------------------------------
|
||||
|
||||
If not already installed, the below can be found in your system’s package manager.
|
||||
|
||||
If any dependencies are missing when the application starts, it will warn you, so you need not take any preemptive measures here.
|
||||
|
||||
- curl
|
||||
- jq
|
||||
- steam
|
||||
- wmctrl or xdotool
|
||||
- zenity
|
||||
|
||||
.. note::
|
||||
All dependencies are installed out of the box on Steam Deck.
|
||||
|
||||
UI dependencies (Python and PyGObject)
|
||||
---------------------------------------
|
||||
.. important::
|
||||
As of version 6.0.0, you must have a valid Python 3.13 and matching PyGObject environment.
|
||||
Depending on your distribution, this may require additional manual intervention.
|
||||
|
||||
Arch Linux (vanilla variants)
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
You will need the ``python3.13`` package, if it is not already installed.
|
||||
|
||||
Install the following build dependencies:
|
||||
|
||||
.. code:: console
|
||||
|
||||
sudo pacman -S cmake gcc pkgconf python-cairo
|
||||
|
||||
.. include:: venv.rst
|
||||
|
||||
CachyOS (Arch)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Refer to the build instructions for Arch Linux first.
|
||||
The ``python3.13`` package is not available on CachyOS, so it is recommended to
|
||||
use ``uv`` to manage Python versions.
|
||||
|
||||
.. code:: console
|
||||
|
||||
sudo pacman -S uv
|
||||
|
||||
.. include:: venv.rst
|
||||
|
||||
Manjaro 26 (Arch)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
If Python 3.13 is not already available out of the box, refer to the build instructions for :ref:`Arch Linux (vanilla variants)`.
|
||||
|
||||
Debian 13 variants
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Python 3.13 and PyGObject are available out of the box. No additional steps are necessary.
|
||||
You can proceed to the :ref:`Installscript`.
|
||||
|
||||
Fedora 43 variants
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Fedora 43 ships with a newer version of Python (3.14), so you must set up Python 3.13 in its own
|
||||
virtual environment (venv) to prevent it from conflicting with the system package.
|
||||
|
||||
Install the following build dependencies:
|
||||
|
||||
.. code:: console
|
||||
|
||||
sudo dnf install cairo cairo-devel cairo-gobject-devel gcc python3.13 python3.13-devel
|
||||
|
||||
.. include:: venv.rst
|
||||
|
||||
Ubuntu 24 variants
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
Ubuntu ships with an older version of Python (3.12). You must install additional dependencies.
|
||||
Add the PPA below to add Python 3.13 to your sources:
|
||||
|
||||
.. code:: console
|
||||
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
|
||||
Install the following build dependencies:
|
||||
|
||||
.. code:: console
|
||||
|
||||
sudo apt install python3.13 python3.13-venv python3.13-dev build-essential python3-gi-cairo pkg-config libgirepository-2.0-dev libcairo2-dev
|
||||
|
||||
.. include:: venv.rst
|
||||
|
||||
Installscript
|
||||
-----------------------
|
||||
|
||||
Invoke the command below from a terminal. This script fetches the main DZGUI script from the repository,
|
||||
makes it executable, and launches DZGUI's first-time setup. After running this installscript, you will
|
||||
have the file ``dzgui.sh`` wherever you invoked the command.
|
||||
|
||||
.. code:: console
|
||||
|
||||
curl -s "https://codeberg.org/aclist/dztui/raw/branch/dzgui/install.sh" | bash
|
||||
|
||||
nixOS installation
|
||||
----------------------
|
||||
Two packages are independently maintained by other contributors. Each takes a slightly different approach.
|
||||
nixOS packages are standalone and do not require cloning the git repository.
|
||||
|
||||
- https://github.com/lelgenio/dzgui-nix
|
||||
- https://github.com/jiriks74/dzgui.flake
|
||||
|
||||
Next steps
|
||||
---------------
|
||||
Proceed to the :doc:`setup` section for setup instructions.
|
||||
@ -1,33 +0,0 @@
|
||||
Installation (DZGUI 7 beta)
|
||||
==================
|
||||
|
||||
In order to make the first-time setup experience easier for end-users, DZGUI 7 no longer requires
|
||||
the tool to be installed from source code into a working Python environment. All necessary dependencies and the
|
||||
runtime environment are built-in.
|
||||
|
||||
Turnkey installer
|
||||
------------------------
|
||||
|
||||
- Visit the project's `Releases page <https://github.com/aclist/dztui/releases>`_.
|
||||
- Extract the DZGUI tarball from the top of the **Assets** list.
|
||||
- From a terminal, run the command ``./dzgui`` or double click on the extracted file in
|
||||
a file explorer.
|
||||
- Once the setup wizard opens, follow the steps at the bottom of this page.
|
||||
|
||||
UI dependencies (Python and PyGObject)
|
||||
---------------------------------------
|
||||
On most major distributions, GObject introspection libraries should be available by default.
|
||||
|
||||
If you receive an error about a missing ``libgirepository-2.0`` dependency, install it via your system's package manager.
|
||||
|
||||
On Debian-based distributions (Ubuntu, etc.), this package is not explicitly installed on the system.
|
||||
You can install it via the following set of commands:
|
||||
|
||||
.. code:: console
|
||||
|
||||
sudo apt update
|
||||
sudo apt install libgirepository-2.0-0
|
||||
|
||||
Next steps
|
||||
---------------
|
||||
Proceed to the :doc:`setup` section for setup instructions.
|
||||
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 608 KiB |
|
Before Width: | Height: | Size: 569 KiB |
|
Before Width: | Height: | Size: 417 KiB |
|
Before Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 31 KiB |
@ -1,69 +0,0 @@
|
||||
.. DZGUI documentation master file, created by
|
||||
sphinx-quickstart on Thu Dec 12 13:12:14 2024.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
DZGUI documentation (|release|)
|
||||
=================================
|
||||
|
||||
Last update: |today|
|
||||
|
||||
What this is
|
||||
----------------
|
||||
|
||||
A DayZ server browser/mod manager for Linux. Used to list official and community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically.
|
||||
|
||||
Source code:
|
||||
|
||||
- `GitHub <https://www.github.com/aclist/dztui>`_
|
||||
- `Codeberg (mirror) <https://codeberg.org/aclist/dztui>`_
|
||||
|
||||
Installation
|
||||
-------------
|
||||
- Step 1: :doc:`installation`
|
||||
- Step 2: :doc:`setup`
|
||||
|
||||
Usage
|
||||
------
|
||||
See: :doc:`usage`.
|
||||
|
||||
Uninstallation
|
||||
---------------
|
||||
See: :doc:`uninstallation`.
|
||||
|
||||
Troubleshooting
|
||||
----------------
|
||||
See: :doc:`kb` or :ref:`Submitting a ticket`.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:hidden:
|
||||
|
||||
self
|
||||
|
||||
.. toctree::
|
||||
:caption: Setup
|
||||
:maxdepth: 3
|
||||
:hidden:
|
||||
|
||||
installation
|
||||
setup
|
||||
usage
|
||||
uninstallation
|
||||
|
||||
.. toctree::
|
||||
:caption: Advanced usage
|
||||
:maxdepth: 3
|
||||
:hidden:
|
||||
|
||||
steam
|
||||
locale
|
||||
|
||||
.. toctree::
|
||||
:caption: Help
|
||||
:maxdepth: 3
|
||||
:hidden:
|
||||
|
||||
kb
|
||||
bugs
|
||||
development
|
||||
@ -1,28 +0,0 @@
|
||||
Installation
|
||||
==================
|
||||
|
||||
As of this writing, you have a choice of two DZGUI versions:
|
||||
|
||||
- DZGUI 6: Legacy stable version, more complicated to install
|
||||
- DZGUI 7: Unstable beta version, much easier to install
|
||||
|
||||
DZGUI 6
|
||||
--------------------
|
||||
This version is no longer receiving feature updates, but will receive security updates until it is replaced by DZGUI 7.
|
||||
|
||||
DZGUI 6 must be installed from the source code and has many more package dependencies and prerequisites for it to function correctly.
|
||||
If you are looking for a one-click, self-contained installer, use :ref:`DZGUI 7` instead.
|
||||
|
||||
To install **DZGUI 6**, visit :doc:`dzgui6`.
|
||||
|
||||
|
||||
DZGUI 7
|
||||
--------------------
|
||||
This version is currently in beta testing and has all of the features found in DZGUI 6, but may be unstable.
|
||||
|
||||
DZGUI 7 has an all-in-one installer and setup wizard, and many new features not found in DZGUI 6.
|
||||
However, this codebase is newer and is provided as a pre-release beta candidate.
|
||||
|
||||
If you want the simplest installer and don't mind experiencing the occasional bug, use this version.
|
||||
|
||||
To install **DZGUI 7**, visit :doc:`dzgui7`.
|
||||
@ -1,82 +0,0 @@
|
||||
Knowledge Base
|
||||
==================
|
||||
|
||||
.. _DZG-001:
|
||||
|
||||
DZG-001: Periodically getting dropped from servers, or servers time out in DZGUI
|
||||
------------------------------------------------------------------------------------
|
||||
DayZ opens a large number of connections while querying/connected to servers.
|
||||
|
||||
In addition, packets sent from server responses are expected to be a standard size (see warning below).
|
||||
|
||||
If your network does not have enough headroom or has settings departing from defaults, this may lead to getting dropped from servers,
|
||||
unresponsiveness, or a timeout.
|
||||
|
||||
If you are on Wi-Fi, try switching to a wired connection and see if the problem resolves itself. Consumer Wi-Fi routers
|
||||
tend to have less headroom than their wired counterparts.
|
||||
|
||||
.. important::
|
||||
Ensure that MTU (maximum tranmission unit) on your network is set to the standard size of 1,500 bytes.
|
||||
If your network preferences or router have "jumbo" frames enabled, packets may be dropped, causing server queries to time out.
|
||||
|
||||
.. _DZG-002:
|
||||
|
||||
DZG-002: Some servers appear locked in the official DayZ client, and are unreachable in DZGUI
|
||||
-----------------------------------------------------------------------------------------------
|
||||
This is a variant of :ref:`DZG-001`.
|
||||
|
||||
.. _DZG-003:
|
||||
|
||||
DZG-003: On Steam Deck, DayZ becomes unresponsive/sluggish over time
|
||||
---------------------------------------------------------------------------------------------
|
||||
When DayZ is open for 1+ hours, a gradual loss in performance and FPS may occur on the Steam Deck.
|
||||
|
||||
A solution that seems to work for most users is to install `Cryo Utilities <https://github.com/CryoByte33/steam-deck-utilities>`_, a third-party performance management application.
|
||||
|
||||
.. _DZG-004:
|
||||
|
||||
DZG-004: On Steam Deck, some mods in the Workshop show a black screen when DZGUI attempts to open them
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
This is a bug in the Steam client that is being tracked at Valve's Steam for Linux issue tracker here: https://github.com/ValveSoftware/steam-for-linux/issues/9598.
|
||||
|
||||
To resolve this issue, manually intervene in the Steam client by selecting a different context (e.g., Store, Library), waiting for it to load, then navigating back to the Workshop context. This should
|
||||
clear the blockage and allow the contents to render.
|
||||
|
||||
.. _DZG-005:
|
||||
|
||||
DZG-005: Rendering problems with objects in the Winter Chernarus v2 mod
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
This mod has LOD (level of detail) bugs that may cause objects near the player, such as leaves, to render incorrectly, or cause distant trees to pop in abruptly. This is an acknowledged issue with the mod itself, not with DayZ or DZGUI.
|
||||
|
||||
There is no user-side fix for this issue; it is a problem solely on the mod side.
|
||||
|
||||
.. _DZG-006:
|
||||
|
||||
DZG-006: After moving DayZ to another drive, DZGUI fails to locate it on initial setup
|
||||
----------------------------------------------------------------------------------------
|
||||
If you recently moved the location of DayZ using Steam's internal dialogs, it may take some time for this information to update internally on Steam's side.
|
||||
|
||||
Steam stores the location of installed games in a unified file, and DZGUI checks this file during initial setup to determine where Steam claims DayZ is installed.
|
||||
|
||||
If you recently moved DayZ to a different drive or partition but did not restart Steam, this information may be out of date, causing Steam to report the wrong location.
|
||||
|
||||
Try restarting the Steam client and starting the DZGUI initial setup again.
|
||||
|
||||
.. _DZG-007:
|
||||
|
||||
DZG-007: Why do I need a Steam Web API key? Is it safe?
|
||||
----------------------------------------------------------
|
||||
In order to provide a server browser showing a searchable list of all available servers, DZGUI utilizes the Steam Web API.
|
||||
|
||||
Actual connections and queries to individual servers are performed directly between the computer and the DayZ server.
|
||||
|
||||
DZGUI gets its server information directly from the most authoritative source: Steam. It does this by letting the user be solely in control of their own API key and the application in an authenticated way. Users explicitly get permission to use a Web API key instead of scraping DayZ server info from third-party sites.
|
||||
|
||||
Everything that happens between DZGUI and the Steam Web API endpoint takes place solely on the user's computer, using a GET request (fetch server list), and no information gets sent back to the developer. DZGUI does not scrape third party DayZ APIs without permission.
|
||||
|
||||
There is some misconception that a Steam Web API key could be used to gain information about a user's account or control their account. Not only is this not possible, but the Web API key is used solely by the user on their own computer and is protected by Steam Guard.
|
||||
|
||||
A Steam Web API key is the most strict way of getting authentic, reliable, and consistent server information in a zero-trust model.
|
||||
|
||||
You are responsible for the creation, storage, management, and revocation of your Web API key.
|
||||
@ -1,12 +0,0 @@
|
||||
Locale support
|
||||
==================
|
||||
|
||||
For internationalization purposes, DZGUI will inherit the default locale setting on the system when displaying numbers.
|
||||
|
||||
This is used for thousands separators in long numbers and decimal separators in fractional numbers.
|
||||
|
||||
If you wish to use a specific regional numbering preference while retaining a different base system language (e.g., English language with German-style numbering), pass the desired locale as a variable before launching DZGUI:
|
||||
|
||||
``LC_ALL=de_DE.UTF-8 ./dzgui``
|
||||
|
||||
If you intend to use this frequently, you could wrap the above in a script or alias.
|
||||
@ -1,53 +0,0 @@
|
||||
Setup
|
||||
=========
|
||||
|
||||
DayZ license
|
||||
-----------------
|
||||
|
||||
Prepare a Steam account with a DayZ license (i.e., own the game). From Steam's right-click menu for the game options, under ``Compatibility``, enable a Proton version ≥ ``6.8`` (or use Proton
|
||||
Experimental for the latest version).
|
||||
|
||||
As of this writing, any recent version of Proton should work, and it is encouraged to use the most recent one.
|
||||
|
||||
|
||||
API keys
|
||||
-------------
|
||||
|
||||
You will need at a minimum a :ref:`Steam Web API key<steam_api>` in order to browse the server index.
|
||||
|
||||
.. _steam_api:
|
||||
|
||||
Steam Web API key
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**This step is required**.
|
||||
|
||||
Register for a `Steam Web API key <https://steamcommunity.com/dev/apikey>`_ (free) using your Steam account. You will be asked for a unique URL for your app when registering.
|
||||
|
||||
Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1" or some other name that is meaningful to you.
|
||||
|
||||
Once configured, you can insert this key in the app when launching it for the first time.
|
||||
|
||||
.. note::
|
||||
If you are confused about this requirement, please refer to DZGUI Knowledge Base article :ref:`DZG-007<DZG-007>` for additional information.
|
||||
|
||||
Battlemetrics API key
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
**This step is optional, but recommended**. Using this key lets you also connect to and query servers by their shorthand ID instead of by IP.
|
||||
|
||||
Register for an API key at `BattleMetrics <https://www.battlemetrics.com/account/register?after=%2Fdevelopers>`_ (free).
|
||||
|
||||
From the ``Personal Access Tokens area``, select ``New Token``.
|
||||
|
||||
Give the token any name in the field at the top.
|
||||
|
||||
Leave **all options unchecked** and scroll to the bottom. Select ``Create Token``.
|
||||
|
||||
Once configured, you can insert this key in the app when launching it for the first time (optional), or later on when using the connect/query by ID methods in the app.
|
||||
|
||||
.. tip::
|
||||
Each server has a unique ID. This is the string of numbers at the end of the URL. For example, in the URL ``https://www.battlemetrics.com/servers/dayz/8039514``, the ID is ``8039514``.
|
||||
|
||||
Next steps
|
||||
--------------
|
||||
Proceed to the next section for usage instructions.
|
||||
@ -1,90 +0,0 @@
|
||||
Steam integration
|
||||
====================
|
||||
|
||||
DZGUI can be added to Steam as a "non-Steam game" in order to facilitate integration with Steam Deck or desktop environments.
|
||||
|
||||
First, launch Steam in the **Large** (default) view.
|
||||
|
||||
.. attention::
|
||||
Steam Deck users: Gaming Mode has limited support for configuration of custom games. You will need to switch to **Desktop Mode** in order to add a non-Steam game.
|
||||
|
||||
.. figure:: images/01.png
|
||||
:scale: 70%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
Select **Add a Game** > **Add a Non-Steam Game** from the bottom left corner of the Steam client.
|
||||
|
||||
Navigate to ``$HOME/.local/share/applications`` and select ``dzgui.desktop``.
|
||||
|
||||
Select **Add Selected Programs** to add a shortcut to DZGUI.
|
||||
|
||||
Artwork
|
||||
^^^^^^^^^^
|
||||
|
||||
DZGUI ships with custom artwork that provides various cover/splash images to allow it to integrate with the rest of your games library.
|
||||
|
||||
.. figure:: images/02.png
|
||||
:scale: 70%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
From the main library view, navigate to the app’s details page and right-click the blank image header at the top.
|
||||
|
||||
.. figure:: images/03.png
|
||||
:scale: 70%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
|
||||
Select **Set Custom Background**
|
||||
|
||||
Select to display **All Files** from the **File type** dropdown
|
||||
|
||||
Navigate to ``$HOME/.local/share/dzgui`` and select ``hero.png``.
|
||||
|
||||
.. figure:: images/04.png
|
||||
:scale: 70%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
Next, right-click the image background and select **Set Custom Logo**.
|
||||
|
||||
Navigate to ``$HOME/.local/share/dzgui`` and select ``logo.png``.
|
||||
|
||||
.. figure:: images/05.png
|
||||
:scale: 70%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
Notice that this removes the redundant app name that occluded the image, as seen above.
|
||||
|
||||
.. figure:: images/06.png
|
||||
:scale: 70%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
Next, navigate to your Library index (looks like a bookshelf of cover art) and find the DZGUI app.
|
||||
|
||||
Right-click its cover and select **Manage** > **Set custom artwork**.
|
||||
|
||||
Navigate to ``$HOME/.local/share/dzgui`` and select ``grid.png``.
|
||||
|
||||
.. figure:: images/07.png
|
||||
:scale: 70%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
The final result will create box art looking like the above.
|
||||
|
||||
.. figure:: images/08.png
|
||||
:scale: 100%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
Next, right-click the DZGUI entry in your Library and select **Properties** to open the properties dialog. Next to the **Shortcut** field, you will see a small square box which represents the game’s
|
||||
icon. Click this to open a file explorer, navigate to ``$HOME/.local/share/dzgui``, and select ``icon.png``. This will add a small icon to the list view.
|
||||
|
||||
Finally, after you launch DZGUI for the first time, you should quit the application and return to the Library view. Select the **Recent Games** dropdown on the right-hand side.
|
||||
|
||||
Steam shows a collection of box art based on categories like "Play Next", "Recent Games", etc. Look for a **downward-pointing caret icon** and click it, then select the **Recent Games** category.
|
||||
|
||||
.. figure:: images/09.png
|
||||
:scale: 100%
|
||||
:alt: Adding a non-Steam game
|
||||
|
||||
If DZGUI was the last item played, it will be shown with a landscape, rather than portrait, orientation cover, which is initially blank.
|
||||
|
||||
To customize this cover, right click it and select **Manage** > **Set custom artwork**, navigate to ``$HOME/.local/share/dzgui``, then select ``hero.png``.
|
||||
@ -1,12 +0,0 @@
|
||||
Uninstallation
|
||||
==================
|
||||
|
||||
To uninstall DZGUI and its associated files, invoke ``./dzgui.sh`` with the ``-u`` or ``--uninstall`` flag.
|
||||
|
||||
Follow the prompts to choose from:
|
||||
|
||||
- **Full uninstall** -- removes the application and all user-defined configuration files
|
||||
- **Partial uninstall** -- removes the application, but keeps user-defined configuration files
|
||||
|
||||
.. tip::
|
||||
If you intend to reinstall DZGUI again, keeping your configuration files is recommended.
|
||||
@ -1,25 +0,0 @@
|
||||
Usage
|
||||
=========
|
||||
|
||||
It is always advised to have Steam running in the background. DZGUI is meant to run "on top of" Steam.
|
||||
|
||||
DZGUI can be launched in one of three ways.
|
||||
|
||||
From a terminal
|
||||
------------------
|
||||
|
||||
Invoke the command ``./dzgui.sh`` from wherever you downloaded the DZGUI script to.
|
||||
|
||||
Launching from a terminal may give more verbose information in the event of a crash, and can be a good way of troubleshooting problems.
|
||||
|
||||
From the shortcut shipped with the application
|
||||
--------------------------------------------------
|
||||
|
||||
On most distributions, if you are using a desktop environment based on the Freedesktop specification, shortcuts will be installed for you.
|
||||
|
||||
- One shortcut is located under the ``Games`` category of your system’s applications list/start menu.
|
||||
- The other is accessed via the ``DZGUI`` desktop icon (Steam Deck only)
|
||||
|
||||
From Steam
|
||||
--------------
|
||||
See :doc:`steam`.
|
||||
@ -1,43 +0,0 @@
|
||||
After satisfying the dependencies above, create a virtual environment (venv) and install PyGObject:
|
||||
|
||||
If you have ``uv`` as your Python version manager, invoke the following:
|
||||
|
||||
.. code:: console
|
||||
|
||||
uv venv --python 3.13 $HOME/.virtualenvs/dzgui
|
||||
source $HOME/.virtualenvs/dzgui/bin/activate
|
||||
uv pip install PyGObject
|
||||
|
||||
If you installed the ``python3.13`` package directly instead of ``uv``, use the below:
|
||||
|
||||
.. code:: console
|
||||
|
||||
python3.13 -m venv $HOME/.virtualenvs/dzgui
|
||||
source $HOME/.virtualenvs/dzgui/bin/activate
|
||||
pip install PyGObject
|
||||
|
||||
You can now proceed to the :ref:`Installscript`.
|
||||
After installation, refer to the additional remarks below.
|
||||
|
||||
.. important::
|
||||
Since PyGObject is localized to a venv, it is advisable to create a wrapper script to ensure
|
||||
the venv is activated on subsequent invocations of DZGUI.
|
||||
|
||||
.. code:: console
|
||||
|
||||
#!/usr/bin/env bash
|
||||
source $HOME/.virtualenvs/dzgui/bin/activate
|
||||
<insert your path to dzgui.sh>
|
||||
|
||||
Make sure to update the placeholder path on the last line. For example, if you ran the
|
||||
installscript from your home directory, the wrapper script would look like:
|
||||
|
||||
.. code:: console
|
||||
|
||||
#!/usr/bin/env bash
|
||||
source $HOME/.virtualenvs/dzgui/bin/activate
|
||||
$HOME/dzgui.sh
|
||||
|
||||
Save this wrapper script in a location of your choice, e.g., ``mywrapper.sh`` and set the
|
||||
executable bit: ``chmod +x mywrapper.sh`` This script will be your entrypoint for
|
||||
future invocations of DZGUI, so you should launch it, not ``dzgui.sh``
|
||||
@ -1,96 +0,0 @@
|
||||
import re
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
from warnings import deprecated
|
||||
|
||||
|
||||
@deprecated("Use dzgui.api.steam.unsubscribe()")
|
||||
class WorkshopACF:
|
||||
def __init__(self, file: str) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.dict: dict[str, Any]
|
||||
self.load(file)
|
||||
|
||||
def as_dict(self) -> dict[str, Any]:
|
||||
return self.dict
|
||||
|
||||
def load(self, file: str) -> None:
|
||||
delimiter = r"\t\t"
|
||||
lines = []
|
||||
with open(file, "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
els = re.split(delimiter, line, maxsplit=1)
|
||||
lines.append(els)
|
||||
self.dict = self.parse(iter(lines))
|
||||
|
||||
def parse(self, lines: Iterator[list[str]]) -> dict[str, str]:
|
||||
acf: dict[str, Any] = {}
|
||||
try:
|
||||
while True:
|
||||
line = next(lines)
|
||||
if len(line) == 1:
|
||||
key = line[0]
|
||||
if key == "{":
|
||||
continue
|
||||
return acf
|
||||
elif key == "}":
|
||||
return acf
|
||||
else:
|
||||
key = self.dequote(key)
|
||||
acf[key] = self.parse(lines)
|
||||
elif len(line) == 2:
|
||||
k, v = line
|
||||
k = self.dequote(k)
|
||||
v = self.dequote(v)
|
||||
try:
|
||||
n = list(acf.keys())[-1]
|
||||
acf[n][k] = v
|
||||
except Exception:
|
||||
acf[k] = v
|
||||
except StopIteration:
|
||||
return acf
|
||||
|
||||
def unpack(self, d: dict, lines: list[Any] = []) -> str:
|
||||
t1 = "AppWorkshop"
|
||||
t2 = ("WorkshopItemsInstalled", "WorkshopItemDetails")
|
||||
for k, v in d.items():
|
||||
if type(v) is dict:
|
||||
if k in t1:
|
||||
self.indent = 0
|
||||
elif k in t2:
|
||||
self.indent = 1
|
||||
else:
|
||||
self.indent = 2
|
||||
pref = "\t" * self.indent
|
||||
lines.append(pref + self.enquote(k))
|
||||
lines.append(pref + "{")
|
||||
self.unpack(v, lines)
|
||||
lines.append(pref + "}")
|
||||
else:
|
||||
pref = "\t" * (self.indent + 1)
|
||||
lines.append(pref + self.enquote(k) + "\t\t" + self.enquote(v))
|
||||
s = ""
|
||||
for line in lines:
|
||||
s += line + "\n"
|
||||
return s
|
||||
|
||||
def to_file(self, file: str) -> None:
|
||||
s = self.unpack(self.dict)
|
||||
with open(file, "w") as f:
|
||||
f.write(s)
|
||||
|
||||
@classmethod
|
||||
def enquote(cls, s: str) -> str:
|
||||
return f'"{s}"'
|
||||
|
||||
@classmethod
|
||||
def dequote(cls, s: str) -> str:
|
||||
return s.rstrip('"').lstrip('"')
|
||||
|
||||
def delete(self, modid: int) -> None:
|
||||
del self.dict["AppWorkshop"]["WorkshopItemsInstalled"][modid]
|
||||
del self.dict["AppWorkshop"]["WorkshopItemDetails"][modid]
|
||||
@ -1,40 +0,0 @@
|
||||
import logging
|
||||
import requests
|
||||
from typing import Any, Optional, TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.const.endpoints import BM_SERVERS
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.api.servers import Record
|
||||
|
||||
|
||||
def get_attributes(key: str, uid: int) -> Any:
|
||||
# TODO: handle if key is not set
|
||||
# TODO: tests for malformed IDs/values
|
||||
|
||||
hdr = {"Authorization": "Bearer " + key}
|
||||
payload: dict[str, str] = {
|
||||
"filter[game]": "dayz",
|
||||
"sort": "-players",
|
||||
"filter[ids][whitelist]": str(uid),
|
||||
}
|
||||
res = requests.get(BM_SERVERS, params=payload, headers=hdr)
|
||||
res.raise_for_status()
|
||||
j = res.json()["data"][0]["attributes"]
|
||||
return j
|
||||
|
||||
|
||||
def map_id_to_record(key: str, uid: int) -> Optional["Record"]:
|
||||
from dzgui.api.servers import Record
|
||||
|
||||
try:
|
||||
record = get_attributes(key, uid)
|
||||
ip = record["ip"]
|
||||
port = int(record["port"])
|
||||
qport = int(record["portQuery"])
|
||||
return Record(ip, port, qport)
|
||||
except Exception:
|
||||
return None
|
||||
@ -1,224 +0,0 @@
|
||||
import hashlib
|
||||
import logging
|
||||
import re
|
||||
|
||||
from concurrent.futures import wait
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import dzgui.api.pefile as PeFile
|
||||
from dzgui.api.servers import get_rules, fqip_to_record
|
||||
from dzgui.const.constants import (
|
||||
APP_NAME,
|
||||
APPID_DAYZ,
|
||||
DAYZ_COMMUNITY_ROOT,
|
||||
LIBRARYFOLDERS_PATH,
|
||||
WORKSHOP_PATH,
|
||||
)
|
||||
|
||||
from dzgui.config.query import lookup
|
||||
from dzgui.const.enum import Preferences
|
||||
|
||||
from typing import Any
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ModMeta:
|
||||
protocol: str
|
||||
published_id: str
|
||||
name: str
|
||||
timestamp: str
|
||||
|
||||
|
||||
def get_local_mod_ids(steam_path: Path) -> list[int]:
|
||||
workshop_path = get_local_mod_path(steam_path)
|
||||
mods = get_local_mods(workshop_path)
|
||||
return [int(mod.name) for mod in mods]
|
||||
|
||||
|
||||
def get_local_mod_path(steam_path: Path) -> Path:
|
||||
p = PeFile.get_app_path(steam_path / Path(LIBRARYFOLDERS_PATH), APPID_DAYZ)
|
||||
workshop_path = p / WORKSHOP_PATH
|
||||
return workshop_path
|
||||
|
||||
|
||||
def get_local_mods(workshop_path: Path) -> list[Path]:
|
||||
mods = [file for file in workshop_path.iterdir() if file.is_dir()]
|
||||
return mods
|
||||
|
||||
|
||||
def is_mission(path: Path) -> bool:
|
||||
# TODO: parse integrity of other files
|
||||
parent = path.parent.name
|
||||
if parent != DAYZ_COMMUNITY_ROOT:
|
||||
return False
|
||||
file = path / "init.c"
|
||||
return file.exists()
|
||||
|
||||
|
||||
def tokenize(mod: Path) -> dict[str, Any] | None:
|
||||
file = mod.joinpath("meta.cpp")
|
||||
delimiter = r"\s*=\s*"
|
||||
modmeta = {}
|
||||
try:
|
||||
with open(file, "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
line = line.strip().rstrip(";")
|
||||
if not line:
|
||||
continue
|
||||
els = re.split(delimiter, line, maxsplit=1)
|
||||
if len(els) == 2:
|
||||
key, value = els
|
||||
modmeta[key.strip()] = value.strip('"')
|
||||
return modmeta
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
return None
|
||||
|
||||
|
||||
def get_mod_size(path: Path) -> float:
|
||||
s = 0
|
||||
for f in path.rglob("*"):
|
||||
s += f.stat().st_size
|
||||
size = round(s / (1024**2), 3)
|
||||
return size
|
||||
|
||||
|
||||
def get_custom_mods(path: Path) -> list[Any]:
|
||||
# TODO: rename this function for clarity ("get local vs. get custom")
|
||||
mods = get_local_mods(path)
|
||||
# TODO: error handling
|
||||
return parse_mods(mods, use_custom=True)
|
||||
|
||||
|
||||
def parse_mods(mods: list[Path], use_custom: bool = False) -> list[Any]:
|
||||
clean = []
|
||||
for mod in mods:
|
||||
mod_dir = mod.name
|
||||
symlink = _hash(mod_dir, use_custom)
|
||||
meta = tokenize(mod)
|
||||
if meta is None:
|
||||
continue
|
||||
size = get_mod_size(mod)
|
||||
# NOTE: final col is cell renderer highlight toggle
|
||||
clean.append([meta["name"], symlink, mod_dir, size, False])
|
||||
clean.sort(key=lambda row: str(row[0]).casefold())
|
||||
return clean
|
||||
|
||||
|
||||
def get_delimited_mods(steam_path: Path) -> list[Any]:
|
||||
workshop_path = get_local_mod_path(steam_path)
|
||||
mods = get_local_mods(workshop_path)
|
||||
return parse_mods(mods)
|
||||
|
||||
|
||||
def get_missing_mods(local: list, remote: list) -> list:
|
||||
return [mod for mod in remote if mod not in local]
|
||||
|
||||
|
||||
def _hash(uid: str, use_custom: bool = False) -> str:
|
||||
md5 = hashlib.md5()
|
||||
md5.update(uid.encode("ascii"))
|
||||
prefix = "@C" if use_custom else "@"
|
||||
return prefix + md5.hexdigest()[:8]
|
||||
|
||||
|
||||
def remove_stale_signatures(
|
||||
config: Path, versions: Path, ids: list[int] | None = None
|
||||
) -> None:
|
||||
if versions.is_file() is False:
|
||||
logger.warning("Creating new version signatures file")
|
||||
versions.touch()
|
||||
return
|
||||
|
||||
path = lookup(config, Preferences.DEFAULT)
|
||||
steam_path = Path(path)
|
||||
if ids is None:
|
||||
local_ids = get_local_mod_ids(steam_path)
|
||||
|
||||
with open(versions, "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
if ids is None:
|
||||
lines = [line for line in lines if int(line.split(",")[0]) in local_ids]
|
||||
else:
|
||||
lines = [line for line in lines if int(line.split(",")[0]) not in ids]
|
||||
|
||||
with open(versions, "w") as f:
|
||||
for line in lines:
|
||||
f.write(line)
|
||||
|
||||
|
||||
def find_stale_mods(config: Path) -> list[int]:
|
||||
def push_record(rec: str) -> list:
|
||||
record = fqip_to_record(rec)
|
||||
if record is None:
|
||||
return []
|
||||
try:
|
||||
mods = get_rules(record)
|
||||
except Exception:
|
||||
return []
|
||||
return [mod.workshop_id for mod in mods]
|
||||
|
||||
steam = lookup(config, Preferences.DEFAULT)
|
||||
steam_path = Path(steam)
|
||||
|
||||
local = get_local_mod_ids(steam_path)
|
||||
records = lookup(config, Preferences.IP_LIST)
|
||||
|
||||
remote_mods = []
|
||||
|
||||
with ThreadPoolExecutor() as executor:
|
||||
futures = [executor.submit(push_record, record) for record in records]
|
||||
wait(futures)
|
||||
for future in futures:
|
||||
res = future.result()
|
||||
remote_mods.extend(res)
|
||||
|
||||
unique_mods = set(remote_mods)
|
||||
stale = [mod for mod in local if mod not in unique_mods]
|
||||
return stale
|
||||
|
||||
|
||||
def get_mod_dir_size(path: Path) -> int:
|
||||
"""
|
||||
This is not a guarantee of parity, as user may adjusted contents of local mods,
|
||||
so upstream epoch time is still used
|
||||
"""
|
||||
size = 0
|
||||
for i in Path(path).iterdir():
|
||||
if i.is_file():
|
||||
size += i.stat().st_size
|
||||
elif i.is_dir():
|
||||
size += get_mod_dir_size(i)
|
||||
return size
|
||||
|
||||
|
||||
def version_file_to_dict(file: Path) -> dict[str, str]:
|
||||
versions = file.read_text().splitlines()
|
||||
d: dict[str, str] = {}
|
||||
for version in versions:
|
||||
line = version.split(",")
|
||||
mod = line[0]
|
||||
stamp = line[1]
|
||||
d[mod] = stamp
|
||||
return d
|
||||
|
||||
|
||||
def update_signatures(
|
||||
mods: list[tuple[str, str, int, int]], version_file: Path
|
||||
) -> None:
|
||||
d = version_file_to_dict(version_file)
|
||||
for _title, mod, stamp, size in mods:
|
||||
d[mod] = str(stamp)
|
||||
versions: list[str] = []
|
||||
for k, v in d.items():
|
||||
row = ",".join([k, v])
|
||||
versions.append(row)
|
||||
|
||||
with open(version_file, "w") as f:
|
||||
for version in versions:
|
||||
f.write(f"{version}\n")
|
||||
@ -1,63 +0,0 @@
|
||||
import logging
|
||||
import requests
|
||||
|
||||
from typing import Union, TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import APPID_DAYZ, APP_NAME, REQUEST_TIMEOUT
|
||||
from dzgui.const import endpoints
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from requests import Response
|
||||
|
||||
|
||||
def test_steam_api(key: str) -> bool:
|
||||
appid = APPID_DAYZ
|
||||
payload: dict[str, Union[int, str]] = {
|
||||
"filter": r"\appid" + rf"\{appid}",
|
||||
"limit": 10,
|
||||
"key": key,
|
||||
}
|
||||
try:
|
||||
res = requests.get(
|
||||
endpoints.STEAM_SERVERS, params=payload, timeout=REQUEST_TIMEOUT
|
||||
)
|
||||
return is_remote_up(res)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
# TODO: pass exception text into dialog
|
||||
return False
|
||||
|
||||
|
||||
# TODO: consolidate is_remote_up and exception logic into one function
|
||||
def test_ipdb() -> bool:
|
||||
try:
|
||||
res = requests.get(endpoints.DB_IP, timeout=REQUEST_TIMEOUT)
|
||||
return is_remote_up(res)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
return False
|
||||
|
||||
|
||||
def test_bm_api(key: str) -> bool:
|
||||
payload: dict[str, str] = {
|
||||
"filter[game]": "dayz",
|
||||
}
|
||||
hdr = {"Authorization": "Bearer " + key}
|
||||
try:
|
||||
res = requests.get(
|
||||
endpoints.BM_SERVERS, params=payload, headers=hdr, timeout=REQUEST_TIMEOUT
|
||||
)
|
||||
return is_remote_up(res)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
return False
|
||||
|
||||
|
||||
def is_remote_up(res: "Response") -> bool:
|
||||
if res.status_code == 200:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@ -1,277 +0,0 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import requests
|
||||
import subprocess
|
||||
from typing import Union
|
||||
from warnings import deprecated
|
||||
|
||||
from shlex import shlex
|
||||
from pathlib import Path
|
||||
|
||||
from dzgui.init.prereqs import has_steam_client
|
||||
from dzgui.const.constants import (
|
||||
APPID_DAYZ,
|
||||
APP_NAME,
|
||||
DEBIAN_STEAM_PATH,
|
||||
DEFAULT_STEAM_PATH,
|
||||
FLATPAK_STEAM_PATH,
|
||||
UBUNTU_STEAM_PATH,
|
||||
REQUEST_TIMEOUT,
|
||||
VDF_PATH,
|
||||
)
|
||||
from dzgui.const.endpoints import SUB_ENDPOINT, STEAM_PUBLISHED_FILES, UNSUB_ENDPOINT
|
||||
from dzgui.strings import wizard
|
||||
from dzgui.util.bash import concat_bash_args
|
||||
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def get_steam_paths() -> list[tuple[Path, str]]:
|
||||
paths = []
|
||||
if has_steam_client():
|
||||
HOME = Path.home()
|
||||
env = os.environ.get("XDG_DATA_HOME")
|
||||
if env is not None:
|
||||
XDG_DATA_HOME = env
|
||||
else:
|
||||
XDG_DATA_HOME = DEFAULT_STEAM_PATH
|
||||
|
||||
DEFAULT_PATH = HOME.joinpath(XDG_DATA_HOME)
|
||||
FLATPAK_PATH = HOME.joinpath(FLATPAK_STEAM_PATH)
|
||||
UBUNTU_PATH = HOME.joinpath(UBUNTU_STEAM_PATH)
|
||||
DEBIAN_PATH = HOME.joinpath(DEBIAN_STEAM_PATH)
|
||||
|
||||
human = {
|
||||
DEFAULT_PATH: wizard.desc_default_path,
|
||||
FLATPAK_PATH: wizard.desc_flatpak_path,
|
||||
UBUNTU_PATH: wizard.desc_ubuntu_path,
|
||||
DEBIAN_PATH: wizard.desc_debian_path,
|
||||
}
|
||||
|
||||
for path in DEFAULT_PATH, FLATPAK_PATH, UBUNTU_PATH, DEBIAN_PATH:
|
||||
if path.joinpath(VDF_PATH).is_file():
|
||||
paths.append((path, human[path]))
|
||||
return paths
|
||||
|
||||
|
||||
def concat_mods(mods: list[str]) -> str:
|
||||
# TODO: circular import workaround
|
||||
from dzgui.api.mods import _hash
|
||||
|
||||
hashes = []
|
||||
for mod in mods:
|
||||
md5sum = _hash(mod)
|
||||
hashes.append(md5sum)
|
||||
return ";".join(hashes)
|
||||
|
||||
|
||||
def get_local_signatures(version_file: Path) -> dict[str, int]:
|
||||
hashes: dict[str, int] = {}
|
||||
lines = version_file.read_text().splitlines()
|
||||
for line in lines:
|
||||
data = line.split(",")
|
||||
_id = data[0]
|
||||
mod_hash = int(data[1])
|
||||
hashes[_id] = mod_hash
|
||||
return hashes
|
||||
|
||||
|
||||
def get_needs_update(
|
||||
version_file: Path, remote_hashes: list[tuple[str, str, int, int]]
|
||||
) -> list[tuple[str, str, int, int]]:
|
||||
local_stamps = get_local_signatures(version_file)
|
||||
needs_update: list[tuple[str, str, int, int]] = []
|
||||
for title, _id, stamp, size in remote_hashes:
|
||||
if _id not in local_stamps:
|
||||
needs_update.append((title, _id, stamp, size))
|
||||
elif stamp != local_stamps[_id]:
|
||||
needs_update.append((title, _id, stamp, size))
|
||||
else:
|
||||
continue
|
||||
return needs_update
|
||||
|
||||
|
||||
def get_remote_signatures(mods: list[str]) -> list[tuple[str, str, int, int]]:
|
||||
"""
|
||||
Attempts to continue connecting even if signatures are empty
|
||||
"""
|
||||
payload: dict[str, str | int] = {}
|
||||
payload["itemcount"] = len(mods)
|
||||
for i, mod in enumerate(mods):
|
||||
payload[f"publishedfileids[{i}]"] = mod
|
||||
try:
|
||||
r = requests.post(STEAM_PUBLISHED_FILES, payload)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
return []
|
||||
if r.status_code != 200:
|
||||
return []
|
||||
|
||||
hashes: list[tuple[str, str, int, int]] = []
|
||||
j = r.json()
|
||||
rows = j["response"]["publishedfiledetails"]
|
||||
for row in rows:
|
||||
title = str(row["title"])
|
||||
_id = str(row["publishedfileid"])
|
||||
time = int(row["time_updated"])
|
||||
size = int(row["file_size"])
|
||||
hashes.append((title, _id, time, size))
|
||||
return hashes
|
||||
|
||||
|
||||
# TODO: set config to name=user, use official server and no mods,
|
||||
# ensure that formatted string is identical to fixture with same hash
|
||||
def connect(client: str, addr: str, appid: int, name: str, mods: list[str]) -> int:
|
||||
concat = concat_mods(mods)
|
||||
client_args = concat_bash_args(client)
|
||||
# TODO: test flatpak arg expansion
|
||||
params = [
|
||||
"-applaunch",
|
||||
str(appid),
|
||||
f"-connect={addr}",
|
||||
"-nolauncher",
|
||||
"-nosplash",
|
||||
"-skipintro",
|
||||
f"-name={name}",
|
||||
f"-mod={concat}",
|
||||
]
|
||||
proc = subprocess.run([*client_args, *params])
|
||||
return proc.returncode
|
||||
|
||||
|
||||
def load_to_menu(client: str, appid: int, name: str, mods: list[str]) -> int:
|
||||
"""Loads to the menu screen with the selected mods; used for AFK/pre-joining"""
|
||||
concat = concat_mods(mods)
|
||||
client_args = concat_bash_args(client)
|
||||
params = [
|
||||
"-applaunch",
|
||||
str(appid),
|
||||
"-nolauncher",
|
||||
"-nosplash",
|
||||
"-skipintro",
|
||||
f"-name={name}",
|
||||
f"-mod={concat}",
|
||||
]
|
||||
proc = subprocess.run([*client_args, *params])
|
||||
return proc.returncode
|
||||
|
||||
|
||||
def launch_offline(
|
||||
client: str, appid: int, name: str, mods: list[str], mission: str
|
||||
) -> int:
|
||||
"""Launch offline with specific mods/missions"""
|
||||
symlinks = ";".join(mods)
|
||||
client_args = concat_bash_args(client)
|
||||
params = [
|
||||
"-applaunch",
|
||||
str(appid),
|
||||
"-nolauncher",
|
||||
"-nosplash",
|
||||
"-skipintro",
|
||||
f"-name={name}",
|
||||
f"-mod={symlinks}",
|
||||
]
|
||||
if len(mission) > 0:
|
||||
arg = f"-mission={mission}"
|
||||
params.append(arg)
|
||||
proc = subprocess.run([*client_args, *params])
|
||||
return proc.returncode
|
||||
|
||||
|
||||
def find_user_id(path: Path) -> str | None:
|
||||
resolved_path = path / "config" / "loginusers.vdf"
|
||||
try:
|
||||
vdf = vdf2json(resolved_path)
|
||||
j = json.loads(vdf)
|
||||
for user in j["users"]:
|
||||
if j["users"][user]["MostRecent"] == "1":
|
||||
return str(user)
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
return None
|
||||
|
||||
|
||||
def vdf2json(path: Path) -> str:
|
||||
def _istr(indent: int, string: str) -> str:
|
||||
return (indent * " ") + string
|
||||
|
||||
jbuf = "{\n"
|
||||
indent = 1
|
||||
|
||||
with open(path, "r") as f:
|
||||
st = f.read()
|
||||
lex = shlex(st)
|
||||
|
||||
while True:
|
||||
tok = lex.get_token()
|
||||
if not tok:
|
||||
return jbuf + "}\n"
|
||||
if tok == "}":
|
||||
indent -= 1
|
||||
jbuf += _istr(indent, "}")
|
||||
ntok = lex.get_token()
|
||||
if ntok is not None:
|
||||
lex.push_token(ntok)
|
||||
if ntok and ntok != "}":
|
||||
jbuf += ","
|
||||
jbuf += "\n"
|
||||
else:
|
||||
ntok = lex.get_token()
|
||||
if ntok == "{":
|
||||
jbuf += _istr(indent, tok + ": {\n")
|
||||
indent += 1
|
||||
else:
|
||||
if ntok is not None:
|
||||
jbuf += _istr(indent, tok + ": " + ntok)
|
||||
ntok = lex.get_token()
|
||||
if ntok is not None:
|
||||
lex.push_token(ntok)
|
||||
if ntok != "}":
|
||||
jbuf += ","
|
||||
jbuf += "\n"
|
||||
|
||||
|
||||
def update_workshop(key: str, mod: int, endpoint: str) -> None:
|
||||
payload: dict[str, Union[int, str]] = {
|
||||
"publishedfileid": mod,
|
||||
"appid": APPID_DAYZ,
|
||||
"key": key,
|
||||
"list_type": 1,
|
||||
"notify_client": 1,
|
||||
}
|
||||
try:
|
||||
res = requests.post(endpoint, params=payload, timeout=REQUEST_TIMEOUT)
|
||||
res.raise_for_status()
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
|
||||
|
||||
def subscribe(key: str, mod: int) -> None:
|
||||
update_workshop(key, mod, SUB_ENDPOINT)
|
||||
|
||||
|
||||
def unsubscribe(key: str, mod: int) -> None:
|
||||
update_workshop(key, mod, UNSUB_ENDPOINT)
|
||||
|
||||
|
||||
def gen_shortcut() -> None:
|
||||
# TODO:
|
||||
"""
|
||||
during setup, prompt user to select matching user id from loginusers
|
||||
show user account name, select outer steam id
|
||||
steam/userdata/<steamid_32>/config/shortcuts.vdf
|
||||
"""
|
||||
# STEAMID_MAGIC = 76561197960265728
|
||||
# STEAMID_64 - STEAMID_MAGIC = STEAMID32
|
||||
# or get right-most 32 bits
|
||||
# STEAMID_64 & 0xFFFFFFFF
|
||||
pass
|
||||
|
||||
|
||||
@deprecated("Use subscribe()")
|
||||
def enqueue_mod(client: str, mod: str, appid: int) -> None:
|
||||
client_args = concat_bash_args(client)
|
||||
subprocess.Popen([*client_args, "+workshop_download_item", str(appid), mod])
|
||||
@ -1,152 +0,0 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
|
||||
from dzgui.const.constants import APP_NAME, APP_NAME_LOWER
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.config.query import lookup
|
||||
from dzgui.config.userprefs import UserPrefs
|
||||
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
||||
from dzgui.init.migrate import (
|
||||
has_new_config,
|
||||
copy_state_files,
|
||||
migrate_cols_file,
|
||||
)
|
||||
from dzgui.init.flock import lock_acquire
|
||||
from dzgui.init.prereqs import has_steam_client
|
||||
from dzgui.strings import boot
|
||||
|
||||
# from dzgui.util.map_count import get_map_count
|
||||
from dzgui.util.deck import is_steam_deck, is_game_mode
|
||||
from dzgui.util.localize import set_locale
|
||||
from dzgui.util.strings import init
|
||||
|
||||
from dzgui.views.base import App
|
||||
from dzgui.views.dialogs.boot import BootWindow
|
||||
from dzgui.views.dialogs.early_alert import EarlyAlertDialog
|
||||
from dzgui.views.dialogs.wizard import SetupWizard
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
# TODO: profile load time
|
||||
def make_parents(path: "Path") -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def setup_logger(log_path: "Path") -> None:
|
||||
_format = (
|
||||
"%(asctime)s␞%(levelname)s␞%(filename)s::%(funcName)s::%(lineno)s␞%(message)s"
|
||||
)
|
||||
fh = logging.FileHandler(log_path)
|
||||
formatter = logging.Formatter(_format)
|
||||
fh.setFormatter(formatter)
|
||||
fh.setLevel(logging.DEBUG)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.addHandler(fh)
|
||||
|
||||
|
||||
def copy_bare_configs(config: "Path", resolution: "Path") -> tuple[bool, bool]:
|
||||
# NOTE: temporary workaround for #375
|
||||
conf = "config.json"
|
||||
state = [
|
||||
"dzg.history",
|
||||
"dzg.versions",
|
||||
"dzg.res.json",
|
||||
"dzg.filters.json",
|
||||
"dzg.columns.json",
|
||||
"dzg.notes.json",
|
||||
"ips.csv",
|
||||
".month",
|
||||
]
|
||||
config_changed = False
|
||||
state_changed = False
|
||||
if config.parent.exists() is False:
|
||||
new_file = config
|
||||
old_file = config.parent.parent / conf
|
||||
if old_file.is_file():
|
||||
try:
|
||||
make_parents(new_file)
|
||||
shutil.copy(old_file, new_file)
|
||||
config_changed = True
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
if resolution.parent.exists() is False:
|
||||
state_path = resolution.parent
|
||||
for state_file in state:
|
||||
old_file = state_path.parent / state_file
|
||||
if old_file.is_file():
|
||||
try:
|
||||
new_file = state_path / state_file
|
||||
make_parents(new_file)
|
||||
shutil.copy(old_file, new_file)
|
||||
state_changed = True
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
return (config_changed, state_changed)
|
||||
|
||||
|
||||
def load_gui(version: str, is_debug: bool) -> None:
|
||||
lock = lock_acquire() # noqa
|
||||
|
||||
set_locale()
|
||||
# NOTE: consider aborting this check if steam deck
|
||||
xdg_paths = get_xdg_paths()
|
||||
XDG = parse_filepaths(xdg_paths)
|
||||
|
||||
copy_bare_configs(XDG.config, XDG.resolution)
|
||||
|
||||
if XDG.resolution.parent.is_dir() is False:
|
||||
make_parents(XDG.resolution)
|
||||
|
||||
if XDG.debug.is_file() is False:
|
||||
make_parents(XDG.debug)
|
||||
|
||||
_is_steam_deck = is_steam_deck()
|
||||
_is_game_mode = is_game_mode() if _is_steam_deck else False
|
||||
if _is_game_mode:
|
||||
# NOTE: this may no longer be necessary on newer versions of SteamOS
|
||||
del os.environ["GTK_IM_MODULE"]
|
||||
|
||||
if has_new_config(XDG.config) is False:
|
||||
migrate_cols_file(XDG.columns)
|
||||
copy_state_files(xdg_paths["XDG_STATE_HOME"])
|
||||
# TODO: add logging inside wizard
|
||||
SetupWizard(_is_steam_deck, XDG.config)
|
||||
|
||||
# NOTE: implies that setup wizard failed or was closed
|
||||
if has_new_config(XDG.config) is False:
|
||||
return
|
||||
|
||||
setup_logger(XDG.debug)
|
||||
with open(XDG.debug, "w") as f:
|
||||
f.truncate(0)
|
||||
|
||||
if _is_steam_deck is False:
|
||||
# TODO: sudo escalation dialog
|
||||
# count = get_map_count()
|
||||
# TODO: move into module
|
||||
if has_steam_client() is False:
|
||||
EarlyAlertDialog(init.requires_steam)
|
||||
|
||||
bootwin = BootWindow(XDG, version)
|
||||
local_coords, latest_release = bootwin.get_results()
|
||||
|
||||
use_miles = lookup(XDG.config, Preferences.DIST)
|
||||
prefs = UserPrefs(
|
||||
is_steam_deck=_is_steam_deck,
|
||||
is_game_mode=_is_game_mode,
|
||||
is_debug=is_debug,
|
||||
coords=local_coords,
|
||||
version=version,
|
||||
paths=XDG,
|
||||
latest_release=latest_release,
|
||||
use_miles=use_miles,
|
||||
)
|
||||
print(boot.all_ok)
|
||||
App(prefs)
|
||||
@ -1,98 +0,0 @@
|
||||
import json
|
||||
import shlex
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from dzgui.const.boilerplate import config_boilerplate
|
||||
|
||||
|
||||
"""
|
||||
Convert legacy dztuirc to config.json
|
||||
"""
|
||||
|
||||
|
||||
class UnsupportedKey(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def str2bool(string: str) -> bool:
|
||||
s = string.lower()
|
||||
match s:
|
||||
case "":
|
||||
return False
|
||||
case "0":
|
||||
return False
|
||||
case "1" | "2":
|
||||
return True
|
||||
case "false":
|
||||
return False
|
||||
case "true":
|
||||
return True
|
||||
case _:
|
||||
raise UnsupportedKey(f"The key {s} is not a valid config key.")
|
||||
|
||||
|
||||
def rc2json(file: Path) -> str:
|
||||
with open(file, "r") as f:
|
||||
lex = shlex.shlex(f.read())
|
||||
lex.whitespace += "="
|
||||
|
||||
keys: dict[str, Any] = {}
|
||||
ips: list[str] = []
|
||||
|
||||
toggles = ["fullscreen"]
|
||||
deprecated = [
|
||||
"staging_dir",
|
||||
"src_path",
|
||||
"steam_path",
|
||||
"debug",
|
||||
"branch",
|
||||
"auto_install",
|
||||
]
|
||||
|
||||
while True:
|
||||
tok = lex.get_token()
|
||||
ntok = lex.get_token()
|
||||
value: str | bool
|
||||
|
||||
if ntok is not None:
|
||||
ntok = ntok.strip('""')
|
||||
value = ntok
|
||||
|
||||
if tok in deprecated:
|
||||
continue
|
||||
elif tok in toggles:
|
||||
if ntok is not None:
|
||||
value = str2bool(ntok)
|
||||
elif tok == "preferred_client":
|
||||
tok = "client"
|
||||
elif tok == "api_key":
|
||||
tok = "bm_api"
|
||||
elif tok == "ip_list":
|
||||
while True:
|
||||
ntok = lex.get_token()
|
||||
if ntok is not None:
|
||||
ntok = ntok.strip('""')
|
||||
value = ntok
|
||||
if ntok == ")":
|
||||
break
|
||||
# TODO: make test for this
|
||||
# NOTE: strip malformed records from ancient config file versions
|
||||
if ntok is not None:
|
||||
if len(ntok.split(":")) == 3 and ntok.split(":")[2] != "":
|
||||
ips.append(ntok)
|
||||
continue
|
||||
|
||||
if not tok:
|
||||
break
|
||||
|
||||
keys[tok] = value
|
||||
|
||||
keys["ip_list"] = ips
|
||||
keys["use_miles"] = False
|
||||
keys["start_tab"] = 0
|
||||
# NOTE: workaround for DZGUI 6 logic (see #375)
|
||||
for key in config_boilerplate.keys():
|
||||
if key not in keys:
|
||||
keys[key] = config_boilerplate[key]
|
||||
return json.dumps(keys, indent=2)
|
||||
@ -1,18 +0,0 @@
|
||||
import textwrap
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def write_desktop_file(share_path: Path) -> None:
|
||||
template = f"""\
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Exec={share_path}/launch.sh
|
||||
Name=DZGUI
|
||||
Comment=dzgui
|
||||
Icon={share_path}/dzgui
|
||||
Categories=Game"""
|
||||
|
||||
file = share_path / "dzgui.desktop"
|
||||
file.write_text(textwrap.dedent(template))
|
||||
@ -1,110 +0,0 @@
|
||||
import gzip
|
||||
import logging
|
||||
import re
|
||||
import requests
|
||||
import shutil
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from dzgui.const.constants import APP_NAME, REQUEST_TIMEOUT
|
||||
from dzgui.const.endpoints import DB_IP
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def find_download_url(url: str) -> str | None:
|
||||
res = requests.get(url, timeout=REQUEST_TIMEOUT)
|
||||
res.raise_for_status()
|
||||
reg = r'ref=[\'"]([^\'">]+.csv.gz)'
|
||||
urls = re.findall(reg, res.text)
|
||||
if len(urls) < 1:
|
||||
return None
|
||||
return str(urls[0])
|
||||
|
||||
|
||||
def get_ipdb(ips_path: Path) -> None:
|
||||
try:
|
||||
url = find_download_url(DB_IP)
|
||||
if url is None:
|
||||
return
|
||||
|
||||
date = find_date(url)
|
||||
month_file = ips_path.parent / ".month"
|
||||
if ips_path.exists() and month_file.exists():
|
||||
old_date = month_file.read_text().rstrip("\n")
|
||||
if old_date == date:
|
||||
logger.info(f"IP DB date matches: {date}")
|
||||
return
|
||||
|
||||
# TODO: log additional output
|
||||
logger.info(f"Fetching IPDB for {date} from {url}")
|
||||
tmp = serialize(url)
|
||||
logger.info(f"Extracting {tmp}")
|
||||
unzip(tmp, ips_path)
|
||||
|
||||
logger.info("Stripping IPv6 records")
|
||||
strip_ipv6(ips_path)
|
||||
|
||||
with open(month_file, "w") as f:
|
||||
f.write(date)
|
||||
logger.info(f"Wrote {date} to {month_file}")
|
||||
except Exception as e:
|
||||
# NOTE: in the event of failure, geolocation calc is simply not performed
|
||||
logger.critical(e)
|
||||
return
|
||||
|
||||
|
||||
def find_date(url: str) -> str:
|
||||
date = re.sub(r"(dbip-city-lite-)(.*)(.csv.gz)", r"\2", url)
|
||||
date = date.split("/")[-1]
|
||||
return date
|
||||
|
||||
|
||||
def unzip(tmp: Path, ips_path: Path) -> None:
|
||||
with gzip.open(tmp, "rb") as f:
|
||||
with open(ips_path, "wb") as outfile:
|
||||
shutil.copyfileobj(f, outfile)
|
||||
tmp.unlink()
|
||||
|
||||
|
||||
def serialize(url: str) -> Path:
|
||||
with requests.get(url, stream=True) as r:
|
||||
r.raise_for_status()
|
||||
filename = "ips.csv.gz"
|
||||
tmp = Path("/tmp") / filename
|
||||
with open(tmp, "wb") as f:
|
||||
shutil.copyfileobj(r.raw, f)
|
||||
return tmp
|
||||
|
||||
|
||||
def strip_ipv6(path: Path) -> None:
|
||||
"""Can be IO intensive and cause visual lag on UI frames
|
||||
running in the main thread even when run in its own thread;
|
||||
lines are batched into memory-manageable chunks to reduce
|
||||
disk writes. Raw file can be 8M+ records long, so it is
|
||||
not read into memory at once.
|
||||
|
||||
Relative size is reduced by ~100MB by pruning unwanted columns
|
||||
"""
|
||||
# NOTE: "^::," is the boundary line between IPv4 and IPv6
|
||||
# NOTE: deprecated regex matching (slower by 5s)
|
||||
# reg = r"^\d{1,3}\..*"
|
||||
alt_path = path.parent.joinpath("ips_stripped.csv")
|
||||
merged = ""
|
||||
its = 0
|
||||
with open(path, "r") as f, open(alt_path, "w") as out:
|
||||
for line in f:
|
||||
els = line.split(",")
|
||||
if "." not in els[0]:
|
||||
break
|
||||
final = ",".join([els[0], els[1], els[-2], els[-1]])
|
||||
merged += final
|
||||
its += 1
|
||||
if its == 500:
|
||||
out.write(merged)
|
||||
its = 0
|
||||
merged = ""
|
||||
if its > 0:
|
||||
out.write(merged)
|
||||
path.unlink()
|
||||
alt_path.rename(path)
|
||||
@ -1,62 +0,0 @@
|
||||
from typing import Any
|
||||
from pathlib import Path
|
||||
|
||||
from dzgui.util._json import read_json
|
||||
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.const.constants import STEAM_CMD, FLATPAK_RUN_CMD, FLATPAK_SANDBOX
|
||||
|
||||
|
||||
class ConfigFileError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def lookup(path: Path, enum: Preferences) -> Any:
|
||||
if path.is_file() is False:
|
||||
raise ConfigFileError("Not a valid file")
|
||||
|
||||
key = enum_to_key(enum)
|
||||
config = get_config(path)
|
||||
try:
|
||||
return config[key]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
|
||||
def get_config(path: Path) -> Any:
|
||||
# TODO: is this being called multiple times?
|
||||
try:
|
||||
json = read_json(path)
|
||||
return json
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
|
||||
def get_favorites(path: Path) -> list[str]:
|
||||
try:
|
||||
conf = get_config(path)
|
||||
except Exception:
|
||||
pass
|
||||
return list(conf["ip_list"])
|
||||
|
||||
|
||||
# def is_in_favs(record: str, path: Path) -> bool:
|
||||
# favs = get_favorites(path)
|
||||
# if record in favs:
|
||||
# return True
|
||||
# return False
|
||||
|
||||
|
||||
def enum_to_key(enum: Preferences) -> str:
|
||||
return str(enum.dict["key"])
|
||||
|
||||
|
||||
def get_client_index(client: str) -> int:
|
||||
if client == STEAM_CMD:
|
||||
return 0
|
||||
elif client == FLATPAK_RUN_CMD:
|
||||
return 1
|
||||
elif client == FLATPAK_SANDBOX:
|
||||
return 2
|
||||
else:
|
||||
return 0
|
||||
@ -1,12 +0,0 @@
|
||||
# import shutil
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def uninstall(path: Path) -> None:
|
||||
pass
|
||||
# TODO: use xdg object?
|
||||
# partial/full (keep config?)
|
||||
# -u removes state, log
|
||||
# XDG_SHARE_HOME/dzgui
|
||||
# XDG_STATE_HOME/dzgui
|
||||
# XDG_DATA_HOME/dzgui
|
||||
@ -1,29 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.config.query import get_config, enum_to_key
|
||||
from dzgui.util._json import write_json
|
||||
|
||||
# TODO: drop deprecated
|
||||
|
||||
|
||||
# TEST: parametrize writing config values and checking config output in test
|
||||
def toggle_config(path: Path, key: Preferences) -> None:
|
||||
real_key = enum_to_key(key)
|
||||
try:
|
||||
conf = get_config(path)
|
||||
cur_val = conf[real_key]
|
||||
conf[real_key] = not cur_val
|
||||
write_json(conf, path)
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
|
||||
def write_config(path: Path, key: Preferences, value: str) -> None:
|
||||
real_key = enum_to_key(key)
|
||||
try:
|
||||
conf = get_config(path)
|
||||
conf[real_key] = value
|
||||
write_json(conf, path)
|
||||
except Exception as e:
|
||||
raise e
|
||||
@ -1,19 +0,0 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Union
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.config.xdg import Xdg
|
||||
from dzgui.util.ip import Coords
|
||||
|
||||
|
||||
# NOTE: mutable dataclass, 'use_miles' key changes on demand
|
||||
@dataclass(slots=True)
|
||||
class UserPrefs:
|
||||
is_steam_deck: bool
|
||||
is_game_mode: bool
|
||||
is_debug: bool
|
||||
coords: Union["Coords", None]
|
||||
version: str
|
||||
paths: "Xdg"
|
||||
latest_release: str | None
|
||||
use_miles: bool
|
||||
@ -1,95 +0,0 @@
|
||||
import os
|
||||
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass
|
||||
|
||||
from dzgui.const.constants import APP_NAME_LOWER, DEBUG_LOG, SYSTEM_LOG
|
||||
|
||||
|
||||
@dataclass
|
||||
class Xdg:
|
||||
config: Path
|
||||
columns: Path
|
||||
notes: Path
|
||||
resolution: Path
|
||||
history: Path
|
||||
version: Path
|
||||
system: Path
|
||||
debug: Path
|
||||
ips: Path
|
||||
filters: Path
|
||||
|
||||
|
||||
def is_writeable(path_str: str) -> bool:
|
||||
if path_str is None:
|
||||
return False
|
||||
|
||||
path = Path(path_str)
|
||||
|
||||
if not path.exists():
|
||||
try:
|
||||
path.mkdir(parents=True)
|
||||
path.unlink()
|
||||
except OSError:
|
||||
return False
|
||||
return True
|
||||
|
||||
try:
|
||||
file = Path(path / "temp")
|
||||
with open(file, "w") as f:
|
||||
f.write("")
|
||||
except Exception:
|
||||
return False
|
||||
file.unlink()
|
||||
return True
|
||||
|
||||
|
||||
def get_xdg_paths() -> dict:
|
||||
home = Path.home()
|
||||
xdg_paths = {
|
||||
"XDG_CONFIG_HOME": home / ".config",
|
||||
"XDG_STATE_HOME": home / ".local" / "state",
|
||||
"XDG_DATA_HOME": home / ".local" / "share",
|
||||
"XDG_CACHE_HOME": home / ".cache",
|
||||
}
|
||||
|
||||
resolved_paths = {}
|
||||
for path in xdg_paths:
|
||||
real_path = os.environ.get(path)
|
||||
if real_path is not None and is_writeable(real_path):
|
||||
new_path = Path(real_path)
|
||||
else:
|
||||
new_path = xdg_paths[path]
|
||||
resolved_paths[path] = new_path / APP_NAME_LOWER
|
||||
return resolved_paths
|
||||
|
||||
|
||||
def parse_filepaths(xdg: dict) -> Xdg:
|
||||
config = xdg["XDG_CONFIG_HOME"]
|
||||
state = xdg["XDG_STATE_HOME"]
|
||||
|
||||
config = config / "config.json"
|
||||
|
||||
system = state / "logs" / SYSTEM_LOG
|
||||
debug = state / "logs" / DEBUG_LOG
|
||||
|
||||
columns = state / "dzg.columns.json"
|
||||
notes = state / "dzg.notes.json"
|
||||
resolution = state / "dzg.res.json"
|
||||
history = state / "dzg.history"
|
||||
versions = state / "dzg.versions"
|
||||
ips = state / "ips.csv"
|
||||
filters = state / "dzg.filters.json"
|
||||
|
||||
return Xdg(
|
||||
config,
|
||||
columns,
|
||||
notes,
|
||||
resolution,
|
||||
history,
|
||||
versions,
|
||||
system,
|
||||
debug,
|
||||
ips,
|
||||
filters
|
||||
)
|
||||
@ -1,16 +0,0 @@
|
||||
"""
|
||||
Generic defaults used when initializing a config file from scratch
|
||||
"""
|
||||
config_boilerplate = {
|
||||
"bm_api": "",
|
||||
"fav_server": "",
|
||||
"fav_label": "",
|
||||
"name": "",
|
||||
"fullscreen": False,
|
||||
"steam_api": "",
|
||||
"default_steam_path": "",
|
||||
"client": "",
|
||||
"ip_list": [],
|
||||
"use_miles": False,
|
||||
"start_tab": 0,
|
||||
}
|
||||
@ -1,89 +0,0 @@
|
||||
APPID_DAYZ = 221100
|
||||
APPID_DAYZ_EXP = 1024020
|
||||
UDP_PORT = 27016
|
||||
VM_FILE = "/proc/sys/vm/max_map_count"
|
||||
MIN_COUNT = 1048576
|
||||
|
||||
API_RATE_LIMIT = 1
|
||||
CLIENT_RATE_LIMIT = 3
|
||||
REQUEST_TIMEOUT = 10
|
||||
|
||||
APPNAME_DAYZ = "DayZ"
|
||||
APPNAME_DAYZ_EXP = "DayZ Exp"
|
||||
APPNAME_DAYZ_EXP_HUMAN = "DayZ Experimental"
|
||||
DAYZ_BINARY = "DayZ_x64.exe"
|
||||
|
||||
LIBRARYFOLDERS_PATH = "steamapps/libraryfolders.vdf"
|
||||
WORKSHOP_PATH = "steamapps/workshop/content/" + str(APPID_DAYZ)
|
||||
|
||||
STEAM_CMD = "steam"
|
||||
FLATPAK_CMD = "flatpak"
|
||||
FLATPAK_APPID = "com.valvesoftware.Steam"
|
||||
FLATPAK_RUN_CMD = "flatpak run " + FLATPAK_APPID
|
||||
FLATPAK_SANDBOX = "flatpak-spawn --host flatpak run " + FLATPAK_APPID
|
||||
|
||||
AUTHOR = "aclist"
|
||||
STABLE_REPO = "stable"
|
||||
BETA_REPO = "testing"
|
||||
|
||||
APP_NAME = "DZGUI"
|
||||
APP_NAME_LOWER = "dzgui"
|
||||
APP_NAME_ABBR = "dzg"
|
||||
|
||||
HEX_GREEN = "#32CD32"
|
||||
HEX_RED = "#FF0000"
|
||||
HEX_ORANGE = "#FFAC1C"
|
||||
|
||||
# FIXME: normalize icon names
|
||||
CARET_DOWN = "go-down-symbolic"
|
||||
CARET_UP = "go-up-symbolic"
|
||||
CLIPBOARD = "edit-copy-symbolic"
|
||||
FOLDER = "folder-symbolic"
|
||||
EDIT_DELETE = "edit-delete-symbolic"
|
||||
ERROR = "dialog-error-symbolic"
|
||||
HELP_BUBBLE = "help-about-symbolic"
|
||||
INPUT_KEYBOARD = "input-keyboard-symbolic"
|
||||
LIST_ADD = "list-add-symbolic"
|
||||
REFRESH_ICON = "view-refresh-symbolic"
|
||||
SEARCH_ICON = "system-search-symbolic"
|
||||
STEAM_ICON = "steam_tray_mono"
|
||||
VIEW_CONCEAL = "view-conceal-symbolic"
|
||||
VIEW_REVEAL = "view-reveal-symbolic"
|
||||
WARNING = "dialog-warning-symbolic"
|
||||
WEB_BROWSER = "web-browser-symbolic"
|
||||
|
||||
SEPARATOR = "SEPARATOR"
|
||||
|
||||
# TODO: drop
|
||||
NO_PADDING = 0
|
||||
NO_EXPAND = False
|
||||
NO_FILL = False
|
||||
EXPAND = True
|
||||
FILL = True
|
||||
|
||||
SCROLL_INCREMENT = 50
|
||||
WINDOW_DEFAULT_X = 1400
|
||||
WINDOW_DEFAULT_Y = 800
|
||||
|
||||
LEGACY_CONFIG_PATH = ".config/dztui/dztuirc"
|
||||
LEGACY_COLS_PATH = ".local/state/dzgui/dzg.cols.json"
|
||||
LEGACY_IPS_PATH = ".local/share/dzgui/helpers/ips.csv"
|
||||
|
||||
DEBUG_LOG = f"{APP_NAME}_DEBUG.LOG"
|
||||
SYSTEM_LOG = f"{APP_NAME}_SYSTEM.LOG"
|
||||
CHANGELOG_PATH = "data/CHANGELOG.md"
|
||||
HERO_PATH = "data/images/hero.png"
|
||||
CSS_PATH = "data/app.css"
|
||||
VDF_PATH = "steamapps/libraryfolders.vdf"
|
||||
DEFAULT_STEAM_PATH = ".local/share/Steam"
|
||||
FLATPAK_STEAM_PATH = ".var/app/com.valvesoftware.Steam/data/Steam"
|
||||
UBUNTU_STEAM_PATH = ".steam/steam"
|
||||
DEBIAN_STEAM_PATH = ".steam/debian-installation"
|
||||
|
||||
LOG_FILTERS = ("CRITICAL", "WARNING", "INFO", "DEBUG")
|
||||
|
||||
TMP_PATH = "/tmp"
|
||||
TMP_TARBALL = "/tmp/dzgui.tar.gz"
|
||||
TMP_EXE = "/tmp/dzgui/dzgui"
|
||||
|
||||
DAYZ_COMMUNITY_ROOT = "Missions"
|
||||
@ -1,30 +0,0 @@
|
||||
# internal
|
||||
STEAM_PUBLISHED_FILES = (
|
||||
"https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1"
|
||||
)
|
||||
STEAM_SERVERS = "https://api.steampowered.com/IGameServersService/GetServerList/v1"
|
||||
SUB_ENDPOINT = "https://api.steampowered.com/IPublishedFileService/Subscribe/v1"
|
||||
UNSUB_ENDPOINT = "https://api.steampowered.com/IPublishedFileService/Unsubscribe/v1"
|
||||
|
||||
BM_SERVERS = "https://api.battlemetrics.com/servers?"
|
||||
GITHUB = "https://github.com/aclist"
|
||||
GITHUB_RELEASES = "https://api.github.com/repos/aclist/dztui/releases/latest"
|
||||
CODEBERG_RELEASES = "https://codeberg.org/api/v1/repos/aclist/dzgui/releases/latest"
|
||||
GITHUB_USER_RELEASES = "https://github.com/aclist/dztui/releases"
|
||||
DB_IP = "https://db-ip.com/db/download/ip-to-city-lite"
|
||||
IP_ECHO = "https://ipecho.net/plain"
|
||||
COORDS_API = "http://ip-api.com/json"
|
||||
|
||||
# steam URIs
|
||||
WORKSHOP = "steam://url/CommunityFilePage/"
|
||||
OPEN_URL = "steam://openurl/"
|
||||
|
||||
# user facing
|
||||
GITHUB_PAGES = "https://aclist.github.io/dzgui/index"
|
||||
CODEBERG_PAGES = "https://aclist.codeberg.page"
|
||||
GITHUB_ISSUES = "https://github.com/aclist/dzgui/issues"
|
||||
FORUM = "https://old.reddit.com/r/dzgui"
|
||||
SPONSORS = "https://github.com/sponsors/aclist"
|
||||
STEAM_API_SETUP = "https://steamcommunity.com/dev/apikey"
|
||||
BM_API_SETUP = "https://www.battlemetrics.com/developers"
|
||||
BM_BROWSE = "https://www.battlemetrics.com/servers/dayz"
|
||||
@ -1,303 +0,0 @@
|
||||
from enum import Enum
|
||||
from typing import Any, Self
|
||||
|
||||
from dzgui.util import strings
|
||||
|
||||
|
||||
class Port(Enum):
|
||||
DEFAULT = 1
|
||||
CUSTOM = 2
|
||||
|
||||
|
||||
class ServerTab(Enum):
|
||||
BROWSER = 0
|
||||
SAVED = 1
|
||||
RECENT = 2
|
||||
LAN = 3
|
||||
|
||||
|
||||
class Popup(Enum):
|
||||
WAIT = 1
|
||||
NOTIFY = 2
|
||||
CONFIRM = 3
|
||||
ENTRY = 4
|
||||
MODLIST = 6
|
||||
DETAILS = 7
|
||||
QUIT = 8
|
||||
|
||||
|
||||
class VAdjustment(Enum):
|
||||
UP = 1
|
||||
DOWN = 2
|
||||
TOP = 3
|
||||
BOTTOM = 4
|
||||
|
||||
|
||||
class CursorPosition(Enum):
|
||||
UP = 1
|
||||
DOWN = 2
|
||||
TOP = 3
|
||||
BOTTOM = 4
|
||||
|
||||
|
||||
class FilterMode(Enum):
|
||||
INITIAL = 1
|
||||
TOGGLE_OFF = 2
|
||||
TOGGLE_ON = 3
|
||||
|
||||
|
||||
class EnumWithAttrs(Enum):
|
||||
def __new__(cls, *args: Any, **kwargs: Any) -> Self:
|
||||
value = len(cls.__members__) + 1
|
||||
obj = object.__new__(cls)
|
||||
obj._value_ = value
|
||||
return obj
|
||||
|
||||
def __init__(self, d: dict):
|
||||
self.dict = d
|
||||
|
||||
|
||||
class Preferences(EnumWithAttrs):
|
||||
STEAM = {
|
||||
"key": "steam_api",
|
||||
}
|
||||
BM = {
|
||||
"key": "bm_api",
|
||||
}
|
||||
CLIENT = {
|
||||
"key": "client",
|
||||
}
|
||||
WINDOW = {
|
||||
"key": "fullscreen",
|
||||
}
|
||||
DIST = {
|
||||
"key": "use_miles",
|
||||
}
|
||||
NAME = {
|
||||
"key": "name",
|
||||
}
|
||||
INSTALL = {
|
||||
"key": "auto_install",
|
||||
}
|
||||
DEBUG = {
|
||||
"key": "debug",
|
||||
}
|
||||
DEFAULT = {
|
||||
"key": "default_steam_path",
|
||||
}
|
||||
FAV_LBL = {
|
||||
"key": "fav_label",
|
||||
}
|
||||
FAV_SRV = {
|
||||
"key": "fav_server",
|
||||
}
|
||||
IP_LIST = {
|
||||
"key": "ip_list",
|
||||
}
|
||||
BRANCH = {
|
||||
"key": "branch",
|
||||
}
|
||||
START_TAB = {
|
||||
"key": "start_tab",
|
||||
}
|
||||
|
||||
|
||||
class NotebookPage(EnumWithAttrs):
|
||||
OFFLINE = {"crumbs": strings.crumbs.offline, "statusbar": True}
|
||||
CHANGELOG = {"crumbs": strings.crumbs.changelog, "statusbar": True}
|
||||
DEVELOPERS = {"crumbs": strings.crumbs.developers, "statusbar": False}
|
||||
HELP = {"crumbs": strings.crumbs._help, "statusbar": True}
|
||||
KEYS = {"crumbs": strings.crumbs.keys, "statusbar": True}
|
||||
LOG = {"crumbs": strings.crumbs.log, "statusbar": True}
|
||||
MODS = {"crumbs": strings.crumbs.mods, "statusbar": True}
|
||||
OPTIONS = {"crumbs": strings.crumbs.options, "statusbar": False}
|
||||
SERVERS = {"crumbs": strings.crumbs.servers, "statusbar": True}
|
||||
THANKS = {"crumbs": strings.crumbs.thanks, "statusbar": True}
|
||||
CONNECTION = {"crumbs": "Connect", "statusbar": True}
|
||||
|
||||
|
||||
class RowType(EnumWithAttrs):
|
||||
# TODO: strings
|
||||
CHANGELOG = {
|
||||
"label": "View changelog",
|
||||
"tooltip": "Opens the DZGUI changelog",
|
||||
}
|
||||
SHOW_LOG = {
|
||||
"label": "Show debug log",
|
||||
"tooltip": "Read the DZGUI log generated since startup",
|
||||
}
|
||||
SEPARATOR = {
|
||||
"label": "SEPARATOR",
|
||||
"tooltip": "",
|
||||
}
|
||||
DUMP_LOG = {
|
||||
"label": "Output system info to log file",
|
||||
"tooltip": "Dump diagnostic data for troubleshooting",
|
||||
}
|
||||
DOCS = {
|
||||
"label": "Documentation/help files (GitHub) ⧉",
|
||||
"tooltip": "Open the DZGUI documentation in a browser",
|
||||
}
|
||||
DOCS_FALLBACK = {
|
||||
"label": "Documentation/help files (Codeberg mirror) ⧉",
|
||||
"tooltip": "Open the DZGUI documentation in a browser",
|
||||
}
|
||||
BUGS = {
|
||||
"label": "Report a bug (GitHub) ⧉",
|
||||
"tooltip": "Open the DZGUI issue tracker in a browser",
|
||||
}
|
||||
FORUM = {
|
||||
"label": "DZGUI Subreddit ⧉",
|
||||
"tooltip": "Open the DZGUI discussion forum in a browser",
|
||||
}
|
||||
SPONSOR = {
|
||||
"label": "Sponsor (GitHub) ⧉",
|
||||
"tooltip": "Sponsor development of the DZGUI project",
|
||||
}
|
||||
THANKS = {
|
||||
"label": "Special thanks",
|
||||
"tooltip": "A list of contributors, testers, and sponsors",
|
||||
}
|
||||
|
||||
|
||||
# TODO: rename to ContextMenuItem
|
||||
class ContextMenu(EnumWithAttrs):
|
||||
ADD_NOTE = {"label": strings.add_note}
|
||||
ADD_SERVER = {"label": strings.add}
|
||||
CONNECT = {"label": strings.connect}
|
||||
COPY_LOG_CLIPBOARD = {"label": strings.copy_log}
|
||||
COPY_SERVER_IP = {"label": strings.copy_ip}
|
||||
COPY_SERVER_NAME = {"label": strings.copy_name}
|
||||
UNSUB_MOD = {"label": strings.unsub_mod}
|
||||
OPEN_WORKSHOP = {"label": strings.open_workshop}
|
||||
REFRESH_PLAYERS = {"label": strings.refresh_players}
|
||||
REMOVE_HISTORY = {"label": strings.remove_history}
|
||||
REMOVE_SERVER = {"label": strings.remove}
|
||||
SET_FAV = {"label": strings.add_fav}
|
||||
SHOW_DETAILS = {"label": strings.show_details}
|
||||
SHOW_MODS = {"label": strings.show_mods}
|
||||
|
||||
|
||||
class ContextMenuGroup(Enum):
|
||||
"""
|
||||
Groupings of context menu items
|
||||
"""
|
||||
|
||||
SERVER_MOD = (ContextMenu.OPEN_WORKSHOP,)
|
||||
MOD = (ContextMenu.OPEN_WORKSHOP, ContextMenu.UNSUB_MOD)
|
||||
MOD_OFFLINE = (None,)
|
||||
LOG = (ContextMenu.COPY_LOG_CLIPBOARD,)
|
||||
SERVER_BROWSER = (
|
||||
ContextMenu.CONNECT,
|
||||
ContextMenu.ADD_SERVER,
|
||||
ContextMenu.SET_FAV,
|
||||
ContextMenu.COPY_SERVER_NAME,
|
||||
ContextMenu.COPY_SERVER_IP,
|
||||
ContextMenu.ADD_NOTE,
|
||||
ContextMenu.SHOW_MODS,
|
||||
ContextMenu.SHOW_DETAILS,
|
||||
ContextMenu.REFRESH_PLAYERS,
|
||||
)
|
||||
SCAN_LAN = (
|
||||
ContextMenu.CONNECT,
|
||||
ContextMenu.SET_FAV,
|
||||
ContextMenu.COPY_SERVER_NAME,
|
||||
ContextMenu.COPY_SERVER_IP,
|
||||
ContextMenu.ADD_NOTE,
|
||||
ContextMenu.SHOW_MODS,
|
||||
ContextMenu.SHOW_DETAILS,
|
||||
ContextMenu.REFRESH_PLAYERS,
|
||||
)
|
||||
SAVED = (
|
||||
ContextMenu.CONNECT,
|
||||
ContextMenu.SET_FAV,
|
||||
ContextMenu.REMOVE_SERVER,
|
||||
ContextMenu.COPY_SERVER_NAME,
|
||||
ContextMenu.COPY_SERVER_IP,
|
||||
ContextMenu.ADD_NOTE,
|
||||
ContextMenu.SHOW_MODS,
|
||||
ContextMenu.SHOW_DETAILS,
|
||||
ContextMenu.REFRESH_PLAYERS,
|
||||
)
|
||||
RECENT = (
|
||||
ContextMenu.CONNECT,
|
||||
ContextMenu.ADD_SERVER,
|
||||
ContextMenu.SET_FAV,
|
||||
ContextMenu.REMOVE_HISTORY,
|
||||
ContextMenu.COPY_SERVER_NAME,
|
||||
ContextMenu.COPY_SERVER_IP,
|
||||
ContextMenu.ADD_NOTE,
|
||||
ContextMenu.SHOW_MODS,
|
||||
ContextMenu.SHOW_DETAILS,
|
||||
ContextMenu.REFRESH_PLAYERS,
|
||||
)
|
||||
|
||||
|
||||
class ModButton(EnumWithAttrs):
|
||||
SELECT_ALL = {
|
||||
"label": strings.mod_panel.select_all,
|
||||
"tooltip": strings.mod_panel.select_all_tooltip,
|
||||
}
|
||||
UNSELECT_ALL = {
|
||||
"label": strings.mod_panel.unselect_all,
|
||||
"tooltip": strings.mod_panel.unselect_all_tooltip,
|
||||
}
|
||||
HIGHLIGHT_STALE = {
|
||||
"label": strings.mod_panel.highlight_stale,
|
||||
"tooltip": strings.mod_panel.highlight_stale_tooltip,
|
||||
}
|
||||
UNHIGHLIGHT_STALE = {
|
||||
"label": strings.mod_panel.unhighlight_stale,
|
||||
"tooltip": strings.mod_panel.unhighlight_stale_tooltip,
|
||||
}
|
||||
UNSUB_SELECTED = {
|
||||
"label": strings.mod_panel.unsub_selected,
|
||||
"tooltip": strings.mod_panel.unsub_selected_tooltip,
|
||||
}
|
||||
SELECT_STALE = {
|
||||
"label": strings.mod_panel.select_stale,
|
||||
"tooltip": strings.mod_panel.select_stale_tooltip,
|
||||
}
|
||||
|
||||
|
||||
class ButtonType(EnumWithAttrs):
|
||||
SERVERS = {
|
||||
"label": strings.buttons.servers_label,
|
||||
"tooltip": strings.buttons.servers_tooltip,
|
||||
"opens": NotebookPage.SERVERS,
|
||||
}
|
||||
MODS = {
|
||||
"label": strings.buttons.mods_label,
|
||||
"tooltip": strings.buttons.mods_tooltip,
|
||||
"opens": NotebookPage.MODS,
|
||||
}
|
||||
OPTIONS = {
|
||||
"label": strings.buttons.options_label,
|
||||
"tooltip": strings.buttons.options_tooltip,
|
||||
"opens": NotebookPage.OPTIONS,
|
||||
}
|
||||
HELP = {
|
||||
"label": strings.buttons.help_label,
|
||||
"tooltip": strings.buttons.help_tooltip,
|
||||
"opens": NotebookPage.HELP,
|
||||
}
|
||||
EXIT = {
|
||||
"label": strings.buttons.exit_label,
|
||||
"tooltip": strings.buttons.exit_tooltip,
|
||||
"opens": None,
|
||||
}
|
||||
|
||||
|
||||
HELP_MENU_ROWS = (
|
||||
RowType.CHANGELOG,
|
||||
RowType.SHOW_LOG,
|
||||
RowType.DUMP_LOG,
|
||||
RowType.SEPARATOR,
|
||||
RowType.DOCS,
|
||||
RowType.DOCS_FALLBACK,
|
||||
RowType.BUGS,
|
||||
RowType.FORUM,
|
||||
RowType.SPONSOR,
|
||||
RowType.SEPARATOR,
|
||||
RowType.THANKS,
|
||||
)
|
||||
@ -1,13 +0,0 @@
|
||||
"""
|
||||
This file is intended to be patched by package maintainers
|
||||
repackaging DZGUI for use in different distributions.
|
||||
|
||||
If DZGUI is going to be installed globally via a package manager
|
||||
or other means and will reside in an immutable location, or needs to be
|
||||
explicitly bound to a certain version, set the flag below to False.
|
||||
|
||||
This will disable the ability for the application to self-manage and
|
||||
will suppress the "Updates available" button in the gutter.
|
||||
"""
|
||||
|
||||
ALLOW_UPDATES = True
|
||||
@ -1,178 +0,0 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository.Gtk import ListStore # noqa E402
|
||||
from gi.repository import Gdk, GObject # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.const.enum import NotebookPage, ServerTab
|
||||
from dzgui.model.model_factory import FastInsertListStore
|
||||
from dzgui.views.pages.offline import FolderHBox
|
||||
|
||||
|
||||
# TODO: if servers fail to load, may leave dangling widgets waiting for a signal
|
||||
|
||||
|
||||
class Emitter(GObject.GObject):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
# TODO: rename signals to e.g. maps_keybinding_pressed
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def request_keyword_focus(self) -> None:
|
||||
"""User invoked Ctrl-f keybinding from ServerTreeView"""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def saved_servers_changed(self) -> None:
|
||||
"""Record was added/removed from Saved Servers model"""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def request_maps_focus(self) -> None:
|
||||
"""User invoked Ctrl-m keybinding from ServerTreeView"""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def request_ip_entry_focus(self) -> None:
|
||||
"""User invoked Ctrl-i keybinding from ServerTreeView"""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def request_custom_port_focus(self) -> None:
|
||||
"""User invoked Ctrl-n keybinding from ServerTreeView"""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def request_default_port_focus(self) -> None:
|
||||
"""user invoked ctrl-d keybinding from servertreeview"""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def request_button_box_focus(self) -> None:
|
||||
"""User invoked right movement keybinding from ServerTreeView"""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(str, str))
|
||||
def fav_server_changed(self, name: str, addr: str) -> None:
|
||||
"""Change favorite server via context menu"""
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(int,))
|
||||
def check_button_pressed(self, keyval: int) -> None:
|
||||
"""User toggled filter panel check button via keyboard"""
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object,))
|
||||
def server_page_changed(self, keyval: int) -> None:
|
||||
"""Triggered on 'switch-page' signal within tabs of NotebookPage.SERVERS."""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(bool,))
|
||||
def server_page_toggled(self, keyval: int) -> None:
|
||||
"""Triggered on map/unmap signal from NotebookPage.SERVERS. Shows/hides grid panels."""
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def statusbar_loaded(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def distcalc_started(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(bool, int))
|
||||
def mod_page_toggled(self, state: bool, mods: int) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(bool,))
|
||||
def lan_tab_toggled(self, state: bool) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(
|
||||
flags=GObject.SignalFlags.RUN_LAST,
|
||||
arg_types=(
|
||||
object,
|
||||
object,
|
||||
),
|
||||
)
|
||||
def distcalc_ended(
|
||||
self, dist: str | None, context: "ServerTab | NotebookPage"
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(
|
||||
flags=GObject.SignalFlags.RUN_LAST,
|
||||
arg_types=(
|
||||
str,
|
||||
bool,
|
||||
),
|
||||
)
|
||||
def check_toggled(self, label: str, state: bool) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object,))
|
||||
def servers_loaded(self, tag: "ServerTab") -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def servers_loaded_init(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(str,))
|
||||
def map_selection_changed(self, map: str) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object,))
|
||||
def load_maps(self, store: ListStore) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(
|
||||
flags=GObject.SignalFlags.RUN_LAST,
|
||||
arg_types=(
|
||||
str,
|
||||
int,
|
||||
),
|
||||
)
|
||||
def mods_updated(self, msg: str, mods: int) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def mods_highlighted(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def api_change_failed(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def already_saved_server(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(str,))
|
||||
def keyword_set(self, keyword: str) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def lan_page_initialized(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object, str))
|
||||
def custom_mods_loaded(self, store: "FastInsertListStore", folder: str) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object,))
|
||||
def custom_mods_unloaded(self, widget: "FolderHBox") -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(str, bool))
|
||||
def custom_mission_loaded(self, folder: str, is_valid: bool) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def invalid_custom_mods(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
def all_mods_synched(self) -> None:
|
||||
pass
|
||||
@ -1,555 +0,0 @@
|
||||
import logging
|
||||
import threading
|
||||
|
||||
from typing import Any, TYPE_CHECKING, Union
|
||||
|
||||
import dzgui.util._json as JSON # noqa
|
||||
|
||||
|
||||
from dzgui.const.enum import (
|
||||
FilterMode,
|
||||
Preferences,
|
||||
NotebookPage,
|
||||
ButtonType,
|
||||
ContextMenu,
|
||||
)
|
||||
|
||||
from dzgui.config.userprefs import UserPrefs
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.controllers.emitter import Emitter
|
||||
from dzgui.managers.config import ConfigManager
|
||||
from dzgui.managers.connection import ConnectionManager
|
||||
from dzgui.managers.contextmenu import ContextMenuManager
|
||||
from dzgui.managers.notes import NoteManager
|
||||
from dzgui.model.servers import ServerModelManager
|
||||
from dzgui.util.diag import write_diagnostic
|
||||
from dzgui.util.format import format_exception, format_player_count
|
||||
from dzgui.util.open_links import open_user_workshop, open_workshop_page
|
||||
from dzgui.views.dialogs.filepicker import FilePicker
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, GLib, GObject # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.api.servers import Record
|
||||
from dzgui.const.enum import ServerTab
|
||||
from dzgui.managers.connection import Prerequisites
|
||||
from dzgui.managers.filter import FilterManager
|
||||
from dzgui.util.dist import Haversine
|
||||
from dzgui.views.base import Notebook, Grid, OuterWindow
|
||||
from dzgui.views.components.buttonbox import ContextualButton
|
||||
from dzgui.views.components.filter_panel import FilterPanel
|
||||
from dzgui.views.components.right_panel import RightPanel
|
||||
from dzgui.views.components.statusbar import Statusbar
|
||||
from dzgui.views.pages.offline import OfflineLoader
|
||||
from dzgui.views.pages.options import Options
|
||||
from dzgui.views.pages.preconnect import PreConnectionAssistant
|
||||
from dzgui.views.pages.servers import ServerNotebook
|
||||
from dzgui.views.trees.tree_log import LogTreeView
|
||||
from dzgui.views.trees.tree_menu import MenuTreeView
|
||||
from dzgui.views.trees.tree_mods import ModTreeView, OfflineModTreeView
|
||||
from dzgui.views.trees.tree_servers import ServerTreeView
|
||||
|
||||
|
||||
class AppNavigation:
|
||||
window: "OuterWindow"
|
||||
grid: "Grid"
|
||||
right_panel: "RightPanel"
|
||||
statusbar: "Statusbar"
|
||||
notebook: "Notebook"
|
||||
modtreeview: "ModTreeView"
|
||||
menu: "MenuTreeView"
|
||||
servers: "ServerNotebook"
|
||||
saved: "ServerTreeView"
|
||||
recent: "ServerTreeView"
|
||||
lan: "ServerTreeView"
|
||||
logtreeview: "LogTreeView"
|
||||
filters: "FilterPanel"
|
||||
preconnect: "PreConnectionAssistant"
|
||||
options: "Options"
|
||||
offline_loader: "OfflineLoader"
|
||||
|
||||
|
||||
class Controller(GObject.GObject):
|
||||
def __init__(self) -> None:
|
||||
self.dist_cache: dict[str, "Haversine"] = {}
|
||||
self.mediator = AppNavigation()
|
||||
|
||||
self.prefs: UserPrefs
|
||||
|
||||
self.emitter = Emitter()
|
||||
self.emitter.connect("map_selection_changed", self._on_map_selection_changed)
|
||||
self.emitter.connect("check_toggled", self._on_check_toggled)
|
||||
|
||||
# NOTE: suppress requests until entire UI is loaded
|
||||
self.loaded = False
|
||||
self.pending_jobs = 1
|
||||
|
||||
self.exit_event = threading.Event()
|
||||
self.cancel_event = threading.Event()
|
||||
self.connection_man: ConnectionManager
|
||||
|
||||
def get_emitter(self) -> Emitter:
|
||||
return self.emitter
|
||||
|
||||
def register_widget(self, attr: str, widget: Gtk.Widget) -> None:
|
||||
try:
|
||||
setattr(self.mediator, attr, widget)
|
||||
except AttributeError:
|
||||
logger.critical(f"{attr} is not a valid AppNavigation attribute.")
|
||||
|
||||
def get_prefs(self) -> UserPrefs:
|
||||
return self.prefs
|
||||
|
||||
def set_prefs(self, prefs: UserPrefs) -> None:
|
||||
self.config_man = ConfigManager(prefs, self)
|
||||
self.notes_man = NoteManager(self, prefs.paths.notes)
|
||||
|
||||
self.prefs = prefs
|
||||
|
||||
def query_config(self, key: Preferences) -> Any:
|
||||
return self.config_man.lookup(key)
|
||||
|
||||
def is_auto_install(self) -> bool:
|
||||
return bool(self.query_config(Preferences.INSTALL))
|
||||
|
||||
def suppress_signal(
|
||||
self, owner: Any, child: Any, func_name: str, state: bool
|
||||
) -> None:
|
||||
|
||||
func = getattr(owner, func_name)
|
||||
if state:
|
||||
child.handler_block_by_func(func)
|
||||
else:
|
||||
child.handler_unblock_by_func(func)
|
||||
|
||||
def get_active_context(self) -> "ServerTab":
|
||||
return self.get_active_treeview().get_enum()
|
||||
|
||||
def get_active_treeview(self) -> "ServerTreeView":
|
||||
return self.mediator.notebook.servers.get_active_treeview()
|
||||
|
||||
def grab_active_treeview(self) -> None:
|
||||
self.get_active_treeview().grab_focus()
|
||||
|
||||
def save_res_and_quit(self, *args: Any) -> None:
|
||||
treeview = self.get_active_treeview()
|
||||
window = self.get_window()
|
||||
self.config_man.save_res_and_quit(treeview, window)
|
||||
|
||||
def set_statusbar(self, enum: "NotebookPage | ServerTab", text: str) -> None:
|
||||
self.mediator.statusbar.set_by_context(enum, text)
|
||||
|
||||
def remove_statusbar(self, context: "NotebookPage | ServerTab") -> None:
|
||||
self.mediator.statusbar.pop(context)
|
||||
|
||||
def set_statusbar_dist(
|
||||
self, haversine: Union["Haversine", None], enum: "ServerTab"
|
||||
) -> None:
|
||||
"""
|
||||
NOTE: prevents race condition when server tab changed,
|
||||
but allows caching the distance in the background
|
||||
"""
|
||||
context = self.get_active_context()
|
||||
page = self.mediator.notebook.get_page_by_enum()
|
||||
if page != NotebookPage.SERVERS:
|
||||
self.emitter.emit("distcalc_ended", None, context)
|
||||
return
|
||||
if enum != context:
|
||||
self.emitter.emit("distcalc_ended", None, context)
|
||||
return
|
||||
|
||||
if haversine is None:
|
||||
self.emitter.emit("distcalc_ended", None, context)
|
||||
return
|
||||
dist = haversine.get_rounded(self.prefs.use_miles)
|
||||
self.emitter.emit("distcalc_ended", dist, context)
|
||||
|
||||
def toggle_config(self, key: Preferences) -> None:
|
||||
# NOTE: Preferences.DIST is dynamic
|
||||
if key == Preferences.DIST:
|
||||
self.prefs.use_miles = not self.prefs.use_miles
|
||||
self.config_man.toggle_config(key)
|
||||
|
||||
def update_config(self, key: Preferences, value: str) -> None:
|
||||
self.config_man.update_config(key, value)
|
||||
|
||||
def open_keybindings(self) -> None:
|
||||
notebook = self.mediator.grid.notebook
|
||||
notebook.toggle_keybindings()
|
||||
|
||||
def focus_notebook(self) -> None:
|
||||
notebook = self.mediator.grid.notebook
|
||||
notebook.focus_current()
|
||||
|
||||
def show_developers_page(self) -> None:
|
||||
self.open_page(NotebookPage.DEVELOPERS)
|
||||
|
||||
def open_page(self, page: NotebookPage) -> None:
|
||||
self.mediator.grid.notebook.set_page_by_enum(page)
|
||||
|
||||
def open_page_by_button(self, button: "ContextualButton") -> None:
|
||||
# TODO: consolidate methods with set_page_by_enum
|
||||
match button.context:
|
||||
case ButtonType.EXIT:
|
||||
self.save_res_and_quit()
|
||||
return
|
||||
case ButtonType.OPTIONS:
|
||||
try:
|
||||
# TODO: where to put config file check
|
||||
self.mediator.grid.notebook.settings.populate_settings()
|
||||
except Exception as e:
|
||||
msg = format_exception(e)
|
||||
logger.critical(msg)
|
||||
return
|
||||
case ButtonType.MODS:
|
||||
self.load_mods()
|
||||
|
||||
self.open_page(button.opens)
|
||||
|
||||
def get_help_row(self) -> str:
|
||||
return self.mediator.menu.get_row_enum()
|
||||
|
||||
def open_user_workshop(self, uid: str) -> None:
|
||||
# NOTE: uid may contain leading zeroes, not a real integer
|
||||
client = self.query_config(Preferences.CLIENT)
|
||||
open_user_workshop(uid, client)
|
||||
|
||||
def load_mods(self) -> None:
|
||||
self.mediator.modtreeview.load_mods()
|
||||
|
||||
def uncolorize_mods(self) -> None:
|
||||
mod_man = self.mediator.modtreeview.get_mod_man()
|
||||
mod_man.uncolorize_mods()
|
||||
|
||||
def highlight_stale(self) -> None:
|
||||
mod_man = self.mediator.modtreeview.get_mod_man()
|
||||
mod_man.highlight_stale()
|
||||
|
||||
def toggle_mod_selection(self, state: bool) -> None:
|
||||
mod_man = self.mediator.modtreeview.get_mod_man()
|
||||
mod_man.toggle_mod_selection(state)
|
||||
|
||||
def unsub_mods(
|
||||
self, treeview: Union["ModTreeView", "OfflineModTreeView", None] = None
|
||||
) -> None:
|
||||
if treeview is None:
|
||||
view = self.mediator.modtreeview
|
||||
else:
|
||||
view = treeview
|
||||
mod_man = view.get_mod_man()
|
||||
mod_man.unsub_mods()
|
||||
|
||||
def get_mod_store(self) -> Gtk.TreeModel | None:
|
||||
return self.mediator.modtreeview.get_model()
|
||||
|
||||
def set_fav(self, name: str, record: str, simple_ip: str) -> None:
|
||||
try:
|
||||
self.config_man.set_fav(name, record)
|
||||
self.emitter.emit("fav_server_changed", name, simple_ip)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
return
|
||||
|
||||
def menu_action(self, action: ContextMenu, tree: "ServerTreeView") -> None:
|
||||
context_man = ContextMenuManager(tree, self)
|
||||
context_man.process(action)
|
||||
|
||||
def populate_log(self) -> None:
|
||||
log = self.prefs.paths.debug
|
||||
try:
|
||||
self.mediator.logtreeview.populate_log(log)
|
||||
self.open_page(NotebookPage.LOG)
|
||||
except Exception as e:
|
||||
dialog = ExceptionDialog(self, str(e))
|
||||
dialog.run()
|
||||
|
||||
def select_colorized(self) -> None:
|
||||
mod_man = self.mediator.modtreeview.get_mod_man()
|
||||
mod_man.select_colorized()
|
||||
|
||||
def get_all_tree_filters(self) -> dict[str, dict[str, bool]]:
|
||||
servers = self.get_servers()
|
||||
all_filters: dict[str, dict[str, bool]] = {}
|
||||
trees = (
|
||||
servers.get_browser(),
|
||||
servers.get_saved(),
|
||||
servers.get_recent(),
|
||||
servers.get_lan(),
|
||||
)
|
||||
for tree in trees:
|
||||
enum = str(tree.get_enum())
|
||||
filters = tree.get_filter_man().get_filters()
|
||||
all_filters[enum] = filters
|
||||
return all_filters
|
||||
|
||||
def get_filter_man(self) -> "FilterManager":
|
||||
"""Each ServerTreeView has an atomic FilterManager"""
|
||||
return self.get_active_treeview().get_filter_man()
|
||||
|
||||
def dump_diagnostics(self) -> None:
|
||||
picker = FilePicker(self.mediator.window)
|
||||
file = picker.pick_file()
|
||||
if file is not None:
|
||||
try:
|
||||
write_diagnostic(self.prefs.paths.config, file)
|
||||
except Exception as e:
|
||||
dialog = ExceptionDialog(self, str(e))
|
||||
dialog.run()
|
||||
|
||||
def update_api_key(self, key: Preferences, text: str) -> None:
|
||||
self.config_man.update_api_key(key, text)
|
||||
|
||||
def set_resolution(self, window: "OuterWindow") -> None:
|
||||
self.config_man.set_resolution(window)
|
||||
|
||||
def propagate_column_width(self, col: Gtk.TreeViewColumn) -> None:
|
||||
GLib.idle_add(self.mediator.servers.update_tab_widths, col)
|
||||
|
||||
def refresh_tree(self) -> None:
|
||||
treeview = self.get_active_treeview()
|
||||
treeview.set_loaded(False)
|
||||
ServerModelManager(self, treeview).refresh()
|
||||
|
||||
def get_player_count(self) -> str:
|
||||
treeview = self.get_active_treeview()
|
||||
model, control = treeview.get_model_and_control_model()
|
||||
count = format_player_count(model, control)
|
||||
return count
|
||||
|
||||
def get_statusbar(self) -> "Statusbar":
|
||||
return self.mediator.statusbar
|
||||
|
||||
def populate_model(self, tv: "ServerTreeView") -> None:
|
||||
# NOTE: skip on previously loaded tabs
|
||||
if tv.is_loaded():
|
||||
self.emitter.emit("servers_loaded", tv.get_enum())
|
||||
return
|
||||
self.mediator.statusbar.set_by_context(tv.get_enum(), "")
|
||||
self.mediator.filters.button_grid.block_toggles(True)
|
||||
self.populate_filter_prefs()
|
||||
self.mediator.filters.button_grid.block_toggles(False)
|
||||
self.emitter.emit("lan_page_initialized")
|
||||
ServerModelManager(self, tv).load()
|
||||
|
||||
def populate_filter_prefs(self) -> None:
|
||||
tv = self.get_active_treeview()
|
||||
filters = self.config_man.get_filters(tv)
|
||||
if filters is None:
|
||||
return
|
||||
filter_man = self.get_filter_man()
|
||||
for filt, state in filters.items():
|
||||
filter_man.set_filter(filt, state)
|
||||
self.mediator.filters.set_filters(filters)
|
||||
|
||||
def get_dist_cache(self) -> dict[str, "Haversine"]:
|
||||
return self.dist_cache
|
||||
|
||||
def set_dist_cache(self, addr: str, haversine: "Haversine") -> None:
|
||||
self.dist_cache[addr] = haversine
|
||||
|
||||
def get_map_store(self) -> Gtk.ListStore:
|
||||
filter_man = self.get_filter_man()
|
||||
return filter_man.get_map_store()
|
||||
|
||||
def get_enabled_filters(self) -> dict:
|
||||
filter_man = self.get_filter_man()
|
||||
return filter_man.get_filters()
|
||||
|
||||
# FIXME: wipe maps store when changing tabs if model is none
|
||||
|
||||
def has_server_model(self) -> bool:
|
||||
treeview = self.get_active_treeview()
|
||||
proxy_man = treeview.get_proxy_man()
|
||||
control = proxy_man.get_control()
|
||||
if control is None:
|
||||
return False
|
||||
if len(control) < 1:
|
||||
return False
|
||||
return True
|
||||
|
||||
def _on_check_toggled(self, emitter: Emitter, label: str, state: bool) -> None:
|
||||
filter_man = self.get_filter_man()
|
||||
filter_man.set_filter(label, state)
|
||||
|
||||
mode = FilterMode.TOGGLE_ON if state else FilterMode.TOGGLE_OFF
|
||||
ServerModelManager(self, self.get_active_treeview()).refilter(mode)
|
||||
|
||||
def _on_map_selection_changed(self, emitter: Emitter, selection: str) -> None:
|
||||
smm = ServerModelManager(self, self.get_active_treeview())
|
||||
smm.refilter(FilterMode.TOGGLE_ON)
|
||||
|
||||
def get_notebook(self) -> "Notebook":
|
||||
return self.mediator.notebook
|
||||
|
||||
def get_prior_page(self) -> NotebookPage:
|
||||
return self.mediator.notebook.get_prior_page()
|
||||
|
||||
def get_servers(self) -> "ServerNotebook":
|
||||
return self.mediator.servers
|
||||
|
||||
def get_server_notebook(self) -> Gtk.Notebook:
|
||||
return self.mediator.servers.notebook
|
||||
|
||||
def get_window(self) -> "OuterWindow":
|
||||
return self.mediator.window
|
||||
|
||||
def get_menu(self) -> "MenuTreeView":
|
||||
return self.mediator.menu
|
||||
|
||||
def has_favorites(self) -> bool:
|
||||
favs = self.config_man.get_favorites()
|
||||
if len(favs) < 1:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_config_man(self) -> ConfigManager:
|
||||
return self.config_man
|
||||
|
||||
def add_by_str(self, addr: str) -> None:
|
||||
saved_tree = self.get_servers().get_saved()
|
||||
ServerModelManager(self, saved_tree).add_by_str(addr)
|
||||
|
||||
def add_by_record(self, record: "Record") -> None:
|
||||
saved_tree = self.get_servers().get_saved()
|
||||
ServerModelManager(self, saved_tree).add_by_record(record)
|
||||
|
||||
def remove_by_record(self, record: "Record") -> None:
|
||||
saved_tree = self.get_servers().get_saved()
|
||||
ServerModelManager(self, saved_tree).remove_by_record(record)
|
||||
|
||||
def add_to_history(self, row: dict[str, Any], record: "Record") -> None:
|
||||
tv = self.get_servers().get_recent()
|
||||
ServerModelManager(self, tv).add_to_history((row, record))
|
||||
|
||||
# def append_to_history(self, record: "Record") -> None:
|
||||
# self.config_man.append_to_history_file(record)
|
||||
|
||||
def remove_from_history(self, record: "Record") -> None:
|
||||
# NOTE: remove action is only possible from history tree context menu,
|
||||
# i.e., the active tree
|
||||
tv = self.get_active_treeview()
|
||||
ServerModelManager(self, tv).remove_from_history(record)
|
||||
|
||||
def connect_by_str(self, addr: str) -> None:
|
||||
if addr.isdigit():
|
||||
config_man = self.get_config_man()
|
||||
key = config_man.lookup(Preferences.BM)
|
||||
self.connection_man = ConnectionManager(self)
|
||||
self.connection_man.connect_by_id(int(addr), key)
|
||||
else:
|
||||
self.connection_man = ConnectionManager(self)
|
||||
self.connection_man.connect_by_ip(addr)
|
||||
|
||||
def connect_by_record(self, record: "Record") -> None:
|
||||
self.connection_man = ConnectionManager(self)
|
||||
self.connection_man.connect_by_record(record)
|
||||
|
||||
def get_details(self, record: "Record") -> None:
|
||||
ConnectionManager(self).query_details(record)
|
||||
|
||||
def get_modlist(self, record: "Record") -> None:
|
||||
ConnectionManager(self).query_modlist_and_present(record)
|
||||
|
||||
def get_server_name(self) -> str:
|
||||
tv = self.get_active_treeview()
|
||||
return tv.get_name()
|
||||
|
||||
def open_workshop_page(self, mod: str) -> None:
|
||||
cmd = self.query_config(Preferences.CLIENT)
|
||||
open_workshop_page(mod, cmd)
|
||||
|
||||
def has_note(self) -> bool:
|
||||
note = self.get_note()
|
||||
if len(note) > 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_note_by_record(self, record: str) -> str:
|
||||
return self.notes_man.get_note(record)
|
||||
|
||||
def get_note(self) -> str:
|
||||
tv = self.get_active_treeview()
|
||||
record = tv.get_record_string()
|
||||
return self.notes_man.get_note(record)
|
||||
|
||||
def add_note(self, note: str) -> None:
|
||||
tv = self.get_active_treeview()
|
||||
record = tv.get_record_string()
|
||||
self.notes_man.add_note(record, note)
|
||||
|
||||
def delete_note(self) -> None:
|
||||
tv = self.get_active_treeview()
|
||||
record = tv.get_record_string()
|
||||
self.notes_man.delete_note(record)
|
||||
|
||||
def refresh_players(self, record: "Record") -> None:
|
||||
treeview = self.get_active_treeview()
|
||||
model, treeiter = treeview.get_selection().get_selected()
|
||||
ServerModelManager(self, treeview).update_playercount(treeiter, record)
|
||||
|
||||
def get_active_keyword(self) -> str:
|
||||
return self.get_filter_man().get_active_keyword()
|
||||
|
||||
def set_active_keyword(self, keyword: str) -> None:
|
||||
self.get_filter_man().set_active_keyword(keyword)
|
||||
|
||||
def get_modtreeview(self) -> "ModTreeView":
|
||||
return self.mediator.modtreeview
|
||||
|
||||
def get_exit_event(self) -> threading.Event:
|
||||
return self.exit_event
|
||||
|
||||
def set_exit_event(self) -> None:
|
||||
self.exit_event.set()
|
||||
|
||||
def set_cancel_event(self) -> None:
|
||||
self.cancel_event.set()
|
||||
|
||||
def get_cancel_event(self) -> threading.Event:
|
||||
return self.cancel_event
|
||||
|
||||
def clear_cancel_event(self) -> None:
|
||||
self.cancel_event.clear()
|
||||
|
||||
def open_connection_assistant(self, prereqs: "Prerequisites") -> None:
|
||||
self.open_page(NotebookPage.CONNECTION)
|
||||
self.mediator.preconnect.populate(prereqs)
|
||||
|
||||
def set_start_tab(self) -> None:
|
||||
ind = self.config_man.get_start_tab()
|
||||
self.get_servers().notebook.set_current_page(ind)
|
||||
|
||||
def update_and_load_to_menu(self) -> None:
|
||||
self.connection_man.update_and_connect(menu_only=True)
|
||||
|
||||
def update_and_connect(self) -> None:
|
||||
self.connection_man.update_and_connect()
|
||||
|
||||
def update_status(self) -> None:
|
||||
self.mediator.preconnect.mark_finished()
|
||||
|
||||
def get_steam_client_name(self) -> str:
|
||||
return self.mediator.options.get_client_name()
|
||||
|
||||
def present_window(self) -> None:
|
||||
self.mediator.window.present_with_time(Gdk.CURRENT_TIME)
|
||||
|
||||
def is_cancel_pending(self) -> bool:
|
||||
if self.get_exit_event().is_set():
|
||||
return True
|
||||
if self.get_cancel_event().is_set():
|
||||
self.clear_cancel_event()
|
||||
return True
|
||||
return False
|
||||
|
||||
def open_offline(self) -> None:
|
||||
self.open_page(NotebookPage.OFFLINE)
|
||||
mod_man = self.mediator.modtreeview.get_mod_man()
|
||||
store = mod_man.store
|
||||
self.mediator.offline_loader.populate(store)
|
||||
@ -1,862 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## Added
|
||||
- Setup wizard
|
||||
- Changelog text wrapping and formatting
|
||||
- Changelog ships with source
|
||||
- Documentation ships with source
|
||||
- Decouple UI components into modules
|
||||
- Choose from kilometer or miles distance display
|
||||
- More granular haversine calculation
|
||||
- Parse XDG data dirs with fallbacks
|
||||
- Dedicated mods page
|
||||
- Dedicated thanks page
|
||||
- Rearrange menus/breadcrumbs
|
||||
- Open filepicker when generating system log
|
||||
- Developers page (and -d flag)
|
||||
- Redact API key in log table
|
||||
- Integrate add/connect widgets into main menu
|
||||
- Favorite/connect/LAN panels integrated with server views
|
||||
- Abort on first LAN server found
|
||||
- Colorized IP/ID validation fields
|
||||
- Copy favorite server IP to clipboard
|
||||
- Set favorite server from tables
|
||||
- Detailed/copyable trace in critical error dialogs
|
||||
- Visual icons
|
||||
- Integrated server notebook
|
||||
- Propagate width changes to all tables
|
||||
- Remember tree position in menus
|
||||
- Show hidden server count after filtering
|
||||
- Atomic map filters per server context
|
||||
- Use concurrency when checking stale mods (performance uplift)
|
||||
- Copy version by clicking label
|
||||
- Add server name to server mod dialogs
|
||||
- Lazy load ping cell data func
|
||||
- Refresh servers button
|
||||
- Early load alerts button
|
||||
- Preconnect dialog
|
||||
- Preconnect warnings/failsafes like filesize
|
||||
- Save filters per server context between sessions
|
||||
- Preboot progress dialog
|
||||
- Choose to jump into splash screen instead of server
|
||||
- Collapsible connection panel
|
||||
- Play offline (load mods directly)
|
||||
|
||||
## Changed
|
||||
- Conform to PEP 440 versioning for beta versions
|
||||
- Reduce padding on keys button
|
||||
- Boldface breadcrumbs
|
||||
- Bold labels inside frames
|
||||
- Sidebar buttons do not steal focus
|
||||
- Copy IP copies IP:queryport only instead of IP:gameport:queryport, mimics syntax needed by add by ip method
|
||||
- Load new model into view without flushing
|
||||
- Cull servers with abnormal queue values (integer overflow: 2147483647)
|
||||
- Packaging structure
|
||||
- Suppress log messages from imported modules
|
||||
- Embed Workshop link in Options menu
|
||||
- Disable overlay scrollbars on server tables
|
||||
- Reduce size of geolocation DB on disk (~100MB)
|
||||
- Enable LAN page Empty/Full filters on first run of app
|
||||
- Propagate subscribed mods to Steam client
|
||||
|
||||
## Dropped
|
||||
- Debug mode
|
||||
- Branch switching
|
||||
- Manual mod install mode (describe rationale)
|
||||
- Force update mods
|
||||
|
||||
## Fixed
|
||||
- Longstanding issue with left clicks not registering as tree selection changes after spamming keyboard input
|
||||
- Center server title text on server dialogs
|
||||
- Rare segfaults when changing maps (threading)
|
||||
- Moved dialogs out of threads
|
||||
|
||||
## Unreleased
|
||||
- Load offline mods
|
||||
- Local documentation
|
||||
- Raw debug command in context menu
|
||||
|
||||
## Developer-facing
|
||||
- Add pyproject.toml file
|
||||
- Show deprecation warnings
|
||||
- Options -> Dev page
|
||||
|
||||
## [6.0.5] 2026-05-17
|
||||
## Changed
|
||||
- Update symlink hash logic to align with DZGUI 7 beta
|
||||
- Update A2S helper to latest commit
|
||||
|
||||
## [6.0.4] 2026-04-13
|
||||
## Fixed
|
||||
- Update A2S module checksums to support servers with missing description field
|
||||
|
||||
## [6.0.3] 2026-04-12
|
||||
## Fixed
|
||||
- Use GLibUnix namespace where available when setting up SIGINT callback
|
||||
|
||||
## [6.0.2] 2026-01-26
|
||||
## Fixed
|
||||
- Explicitly use Python 3.13 when calling subprocesses
|
||||
- Raise error correctly from module
|
||||
- Do not spawn dialogs from inside of thread when fetching prereqs
|
||||
## Changed
|
||||
- Optimize time complexity of startup checks
|
||||
- Optimize coordinate calculation by using local records first
|
||||
- Rename some internal functions
|
||||
- Wrap entire startup process in dialog
|
||||
|
||||
## [6.0.1] 2026-01-16
|
||||
## Fixed
|
||||
- Explicitly use Python 3.13 when calling subprocesses
|
||||
|
||||
## [6.0.0] 2026-01-14
|
||||
## Added
|
||||
- Support DayZ Experimental
|
||||
- Ping display on server tables
|
||||
- Save descriptive text notes on a per-server basis
|
||||
- Speed up load time and navigation of server tables
|
||||
- More robust threading and cache system when filtering servers
|
||||
- Show additional DayZ client information in Options menu
|
||||
- Warn user of DayZ client version mismatches
|
||||
- Support clickable hyperlinks in dialogs
|
||||
- Rich server metadata details dialog (right-click on server table)
|
||||
- Filter by modded servers
|
||||
- Breadcrumbs showing current menu context
|
||||
- Dedicated changelog page
|
||||
- Dedicated keybindings page
|
||||
- Dedicated settings page ("Options")
|
||||
- Support sandboxed version of Flatpak
|
||||
- Vim-style navigation keybindings
|
||||
- Added "Return to main menu" button to dialog windows when failing to load server table
|
||||
- Dynamic context menus for modded servers
|
||||
- Additional keybindings for new filter toggles
|
||||
- If a server is locked, prompt user when connecting
|
||||
- Internal flag to allow distro-packaged releases to disable in-app updates
|
||||
- Pre-boot checks to test whether script was invoked directly
|
||||
- Commandline usage help text (GaryBlackbourne)
|
||||
- More descriptive help dialogs when initial dependencies are missing
|
||||
|
||||
## Fixed
|
||||
- Script failing to start when remote endpoints are unavailable (GaryBlackbourne)
|
||||
- Key stickiness when quickly navigating through entries in tables
|
||||
- Servers returning malformed A2S_INFO blocking server browser from loading
|
||||
- Normalized buttons in dialogs and restored proper padding
|
||||
- GTK errors being emitted to stdout when inserting debug table
|
||||
- Entry dialog sensitivity when validating API keys
|
||||
- Additional validation on entry dialogs to prevent submitting empty text
|
||||
- Suppress errors during pre-boot checks when mods are not installed
|
||||
- Centered filter checkboxes within panel
|
||||
- Do not pop unhighlight/select stale buttons if no stale mods exist
|
||||
- Improved keybinding interaction with side panels
|
||||
- Suppress typeahead search in mod dialogs
|
||||
- Do not trigger global API cooldown if no LAN/favorite servers are found
|
||||
- Fix table column expansion in server mod dialogs
|
||||
- Missing parameters when closing application via window decorations
|
||||
- Statusbar contents not updating on certain pages
|
||||
- Prevent debug button from activating when in certain input fields
|
||||
- Window size not updating correctly when unmaximizing window after changing "fullscreen at boot" setting
|
||||
- Branch toggle signal being emitted when entering Options menu from other contexts
|
||||
- Mods rarely not appearing in local mod list if download completed too quickly
|
||||
- Statusbar not updating when clicking a row after spamming keyboard input
|
||||
- Extraneous logs being generated when subscribing to mods
|
||||
- Narrow width of columns in modlist dialogs occluding text
|
||||
- Newline terminators in history file
|
||||
- Floating point number calculation
|
||||
- Window resizing too small if no prior resolution was set
|
||||
- ESC key destroying wait dialogs while a thread is pending
|
||||
- Tooltip signals being erroneously emitted on main menu
|
||||
- UI not being constructed correctly if CHANGELOG.md was missing
|
||||
- Config file erroneously getting updated when populating settings menu
|
||||
- Leaky variable name in dialog titles
|
||||
- Prevent extraneous signals from propagating when column width is adjusted
|
||||
- Server filter panel not being hidden when entering other page contexts
|
||||
- Path to remote changelog being constructed incorrectly
|
||||
- Dialogs with newlines breaking output in log table
|
||||
- Path discovery during first-time setup when parsing filepaths with whitespaces
|
||||
- First-time setup dialog continuously triggering when DayZ install path had whitespaces in it
|
||||
|
||||
## Changed
|
||||
- Require Python 3.13
|
||||
- Reduced global API cooldown from 60s to 30s
|
||||
- Clarify dialog messages when DayZ path could not be found
|
||||
- Auto-focus first item when opening context menus
|
||||
- Opacity setting on side buttons when in a different context
|
||||
- Refactored BM API key validation to account for new key format
|
||||
- State file serialization methods
|
||||
- Optimize time complexity of pre-boot checks (GaryBlackbourne)
|
||||
- Rewrote distance calculation module (GaryBlackbourne)
|
||||
- Changed preferred client setting from radio toggle to combobox
|
||||
|
||||
## Dropped
|
||||
- Ping readout in statusbar
|
||||
- Extraneous information from right statusbar
|
||||
|
||||
## [5.8.3] 2026-01-04
|
||||
## Fixed
|
||||
- Normalize checksum numbers and dates
|
||||
|
||||
## [5.8.2] 2026-01-04
|
||||
## Fixed
|
||||
- Fix regression in symlink routine introduced by previous hotfix
|
||||
|
||||
## [5.8.1] 2025-12-27
|
||||
## Fixed
|
||||
- Path discovery during first-time setup when parsing filepaths with whitespaces
|
||||
- First-time setup dialog continuously triggering when DayZ install path had whitespaces in it
|
||||
|
||||
## [5.8.0] 2025-07-06
|
||||
## Added
|
||||
- Filter servers by official/unofficial status
|
||||
- Automatically fetch geolocation records
|
||||
## Changed
|
||||
- Updated internal versioning of helper files
|
||||
## Fixed
|
||||
- Corrected erroneous 2024 date in prior changelog entries
|
||||
|
||||
## [5.7.0] 2025-04-17
|
||||
## Added
|
||||
- Save application dimensions when quitting and restore on subsequent boot
|
||||
## Fixed
|
||||
- Issues with the window exceeding the bounds of the screen when displaying some table contexts
|
||||
## Changed
|
||||
- More direct server ping query method that should return marginally more accurate times
|
||||
|
||||
## [5.6.7] 2025-04-04
|
||||
## Dropped
|
||||
- Removed extraneous pre-boot API checks that could cause error messages to be printed if the user had not set up an API key yet
|
||||
|
||||
## [5.6.6] 2025-03-16
|
||||
## Changed
|
||||
- Update IP database records for 2025-03
|
||||
|
||||
## [5.6.5] 2025-03-04
|
||||
## Fixed
|
||||
- Livonia server results being dropped from batch queries
|
||||
|
||||
## [5.6.4] 2025-02-10
|
||||
### Changed
|
||||
- Drop launch flag and check for invocation through Steam automatically
|
||||
|
||||
## [5.6.3] 2025-02-09
|
||||
### Changed
|
||||
- Update IP database records for 2025-02
|
||||
|
||||
## [5.6.2] 2025-01-22
|
||||
### Fixed
|
||||
- Resolve regression introduced with IP resolution feature in 5.6.0 (restores functionality of right-click action: Add to My Servers)
|
||||
|
||||
## [5.6.1] 2025-01-10
|
||||
### Fixed
|
||||
- Add fallback support for jq 1.6
|
||||
|
||||
## [5.6.0] 2025-01-06
|
||||
### Added
|
||||
- Application header bar and controls
|
||||
- Menu context subtitle in header bar
|
||||
- Bulk delete mods (via 'List installed mods' list). Not compatible with Manual Mod install mode
|
||||
- Highlight stale mods in mods list
|
||||
- Added --steam launch parameter
|
||||
- Open Steam workshop subscriptions dialog when switching from Manual to Auto mode
|
||||
- Hover tooltips to most buttons
|
||||
- Add in-app documentation link to Codeberg mirror
|
||||
- Additional logging
|
||||
### Fixed
|
||||
- Avoid sudo escalation if system map count is sufficient (jiriks74)
|
||||
- Duplicate dialog title on Steam Deck
|
||||
- Resolve remote IP when saving records for game servers with multiple hosts
|
||||
- More performant symlink traversal when checking for legacy links
|
||||
- Only iterate on missing symlinks at boot (400% performance uplift)
|
||||
- Fix for server list truncation causing some servers to not appear in results
|
||||
- Empty dialog popups if user manually deletes local mods while application is running
|
||||
- Update statusbar when removing servers from list/repopulating
|
||||
- Abort DayZ path discovery if Steam files are not synched
|
||||
- Race condition when checking for installed mods
|
||||
- Favorite server message not updating correctly
|
||||
- Improved handling for cases where there are no locally installed mods
|
||||
- Set up mod symlinks at boot, rather than only on server connect
|
||||
- Prevent context menus from opening when table is empty
|
||||
- When reloading table in-place, prevent duplicate panel elements from being added if already present
|
||||
- Clean up local mod signatures from versions file when deleting mods
|
||||
- Focus first row when opening mods list
|
||||
### Changed
|
||||
- Redact usernames in log files
|
||||
- Prevent ArrowUp/ArrowDown input when inside keyword field
|
||||
- Admonish user to restart Steam in error dialog if DayZ path could not be found
|
||||
- Refactor control flow for more robust contextual parsing
|
||||
- Stop sending modal dialog hints to outer window
|
||||
- Clean up signal emission
|
||||
- Clarify some error messages and normalize text formatting
|
||||
- Update forum URL
|
||||
- Update README.md
|
||||
- Update IP database to 2025-01
|
||||
- Reduce IP database size by 50%
|
||||
- Update documentation to 5.6.x standard
|
||||
### Dropped
|
||||
- Hall of Fame section from button links, to be moved inside documentation
|
||||
- Unused imports
|
||||
|
||||
## [5.5.3] 2024-12-13
|
||||
### Fixed
|
||||
- Add remote resource health checks before downloading updates
|
||||
### Added
|
||||
- Add fallback repository
|
||||
|
||||
## [5.5.1] 2024-12-03
|
||||
### Fixed
|
||||
- Support localized decimal separators when parsing installed mod sizes
|
||||
|
||||
## [5.5.0] 2024-11-10
|
||||
### Added
|
||||
- Support servers running DLC content (fixes Frostline servers)
|
||||
- Expose a toggle setting for whether to launch the application in fullscreen
|
||||
- Text autocompletion in maps search field (partial search)
|
||||
- Add disk space warning to popup dialog when downloading mods
|
||||
### Fixed
|
||||
- Servers in saved servers list would populate context menu with same option when right-clicking in server browser
|
||||
- Enable adding/removing servers to/from My Saved Servers when in Recent Servers context
|
||||
- Prevent maps combobox from duplicating contents
|
||||
- Restore keyboard input to keyword entry field
|
||||
### Changed
|
||||
- Abort fallback query method if DLC is required
|
||||
|
||||
## [5.4.2] 2024-10-05
|
||||
### Fixed
|
||||
- Sanitize third-party API IDs to remove UGC collisions
|
||||
|
||||
## [5.4.1] 2024-09-25
|
||||
### Added
|
||||
- Pre-boot validation check for users with self-compiled version of jq
|
||||
### Fixed
|
||||
- Use fallback logic for modlist queries when user traverses networks
|
||||
- Fix signal handling control flow for checkbox toggles
|
||||
- When reloading the server browser, the map combobox selection would revert to the last selected map instead of All Maps
|
||||
- Server filter toggle signals were accessible from the main menu when switching between menu contexts
|
||||
- Global cooldown dialog could sometimes block filter toggles after cooldown reset
|
||||
- Normalized minor version number due to a previous clerical error
|
||||
|
||||
## [5.4.0] 2024-08-27
|
||||
### Added
|
||||
- Scan local area network for DayZ servers
|
||||
- Freedesktop application icons for system taskbar, tray, and other dialogs
|
||||
- Emit CPU model name when exporting system debug log
|
||||
### Fixed
|
||||
- Errors being printed to the console when Exit button was explicitly clicked
|
||||
- Detect Steam Deck OLED APU variant during initial setup
|
||||
- Encapsulate player names correctly so that names with whitespace in them are supported
|
||||
- Test if DayZ directory is empty at startup, implying that the game was moved to a new library collection
|
||||
- Report WM_CLASS name to the window manager
|
||||
|
||||
## [5.3.2] 2024-07-02
|
||||
### Fixed
|
||||
- Server list would sometimes be missing some expected servers due to truncation being caused when a server erroneously set an incomplete gametype
|
||||
|
||||
## [5.3.1] 2024-06-15
|
||||
### Added
|
||||
- Uninstall routine: invoke via dzgui.sh -u or dzgui.sh --uninstall and choose from full or partial uninstall
|
||||
|
||||
## [5.3.0] 2024-06-15
|
||||
### Added
|
||||
- Server browser tables now display the number of players in queue (for full servers)
|
||||
- Warning dialog if the user's API key returned no servers, and a global API cooldown dialog (60 seconds)
|
||||
### Fixed
|
||||
- Removing servers from My Servers via the right-click context menu was not actually removing the server and drawing an empty dialog
|
||||
- Resolved an issue where, when Steam was not installed in a standard location and the user was prompted to let DZGUI auto-discover the correct path, this information was not retained correctly
|
||||
|
||||
## [5.2.4] 2024-05-29
|
||||
### Fixed
|
||||
- Resolved an issue that could cause an old path to a prior DayZ installation to be reinserted in the config file if the Steam client did not synch the new path internally. DZGUI would try to ask the user to re-run first-time setup and update the path, but the old path would still be used.
|
||||
|
||||
## [5.2.3] 2024-04-19
|
||||
### Added
|
||||
- Added Debug Mode button to main menu
|
||||
|
||||
### Changed
|
||||
- Reworded debug mode notification dialog
|
||||
- Updated geolocation records
|
||||
|
||||
### Dropped
|
||||
- Dropped seen_news key from configs
|
||||
|
||||
## [5.2.2] 2024-04-18
|
||||
### Added
|
||||
- Cover artwork/icons for Steam "Recent Games" and tree view
|
||||
|
||||
### Changed
|
||||
- Updated documentation to the v5.0.0 spec
|
||||
|
||||
## [5.2.1] 2024-04-01
|
||||
### Fixed
|
||||
- Fixed a regression where where the first-time setup dialog would not trigger auto-path discovery
|
||||
|
||||
### Changed
|
||||
- Reworded some menus and dialogs for clarity
|
||||
|
||||
## [5.2.0] 2024-03-21
|
||||
### Added
|
||||
- Refresh player count for active row: invoke via right-click context meu or directly with the Ctrl-r hotkey. This feature has a 30 second global cooldown to prevent throttling.
|
||||
|
||||
### Fixed
|
||||
- Improve case-insensitive keyword search to be portable across awk versions (previous version required gawk)
|
||||
- Fixed a dialog string from being shown twice when adding a server to favorites via context menus
|
||||
|
||||
### Changed
|
||||
- Use a more robust method for downloading mods when auto mod install is enabled
|
||||
|
||||
## [5.1.1] 2024-03-18
|
||||
### Fixed
|
||||
- Hotfix for remote helper files not being fetched correctly
|
||||
|
||||
## [5.1.0] 2024-03-18
|
||||
### Added
|
||||
- Make columns in the server browser user-resizable (affects Server Browser, My Servers, and Recent Servers)
|
||||
- Save dragged position of user-resized columns
|
||||
- Display ping to server in statusbar: by popular request, added the ability to visualize both distance to server and round-trip latency (ping), at the cost of a small calculation delay. Please leave feedback regarding whether this feature feels fast/responsive enough.
|
||||
|
||||
### Fixed
|
||||
- Fixed a rare scenario in Auto Mod Install Mode where defunct mods (mods no longer available on Steam) would try to be downloaded if the user had previously downloaded the mod
|
||||
|
||||
## [5.0.0] 2024-01-31
|
||||
### Added
|
||||
- Context switching: navigate to different pages using side buttons
|
||||
- Dynamic statusbar: updates metadata and server distance when selecting rows
|
||||
- Show server-side modlist and allow jumping to Steam Workshop pages to browse, and list whether mod is currently installed
|
||||
- Print debug logs in-app (Help > Show debug log)
|
||||
- Functionality to change API keys in-app (used when revoking old API keys)
|
||||
- Print atomic mod sizes when listing installed mods
|
||||
- Dialogs show direct links to API key management URLs when changing API keys
|
||||
- Toggle dry-run mode directly from server browser
|
||||
- Extensive keybindings for fully controlling the application without the mouse
|
||||
- Extensive pre-boot sanity checks
|
||||
- Keybinding help dialog in main menu
|
||||
- Right-click context menus in server browsers/mod list: add/remove from favorites, show server-side mods, delete mod, copy server IP to clipboard
|
||||
|
||||
### Changed
|
||||
- Utilize GTK bindings and MVC paradigm for UI creation and data flow
|
||||
- Filter servers dynamically from within server browser
|
||||
- Performance and security improvements to DZGUI helper files
|
||||
|
||||
### Fixed
|
||||
- First-time setup dialogs respawning repeatedly in certain scenarios
|
||||
- Issues with Steam client switching to the wrong page when using auto-mod install
|
||||
- Set text input module correctly when launching on Steam Deck
|
||||
- Separate current/total player count and use proper integer sort method in table
|
||||
|
||||
## [4.1.1] 2023-12-18
|
||||
### Fixed
|
||||
|
||||
- News marquee not showing
|
||||
|
||||
## [4.1.0] 2023-12-17
|
||||
|
||||
This update adds support for DayZ servers running on a local area network. To connect or add to your server list, supply the server IP and query port in the format IP:PORT.
|
||||
|
||||
Support for Steam Deck Game Mode has also been restored, with a new dialog format that allows for virtual keyboard input. This should allow you to enter text in form fields by activating the Steam button + X. In addition, you can unlock the mouse and keyboard input when launching DZGUI through Steam by using an internal binding provided by Steam Deck: long-press the three dots button on the right of the device for three seconds to toggle the input state. This allows you to use mouse and keyboard-style bindings on Game Mode and vice versa.
|
||||
|
||||
### Added
|
||||
- Virtual keyboard support for text entry fields on Steam Deck Game Mode
|
||||
- Validate and connect to LAN server IPs
|
||||
|
||||
## [4.0.4] 2023-12-23
|
||||
### Fixed
|
||||
- Enforce version check for Python versions before 3.10
|
||||
|
||||
## [4.0.3] 2023-11-22
|
||||
### Fixed
|
||||
- Query helper: backwards compatibility for pre-2021 versions of Python 3
|
||||
|
||||
## [4.0.2] 2023-11-22
|
||||
### Fixed
|
||||
- Query helper not loading: fixed a remote link pointing to the wrong destination and added a checksum verification to ensure file is present
|
||||
|
||||
## [4.0.1] 2023-11-22
|
||||
### Fixed
|
||||
- Emergency hotfix to remove build artifacts leaking into main script: if you updated DZGUI from 3.3.18 to 4.0.0 between 2023-11-22 15:00:02 and 2023-11-22 15:03:37 GMT, there is a small chance it will be unable to launch correctly. If so, please follow the instructions on the manual to reinstall.
|
||||
|
||||
## [4.0.0] 2023-11-22
|
||||
|
||||
Hello players, this is a major version update which overhauls many of DZGUI's underlying systems to improve responsiveness of the application and make menus more intuitive to interact with. It should be considerably more difficult, if not impossible, to inadvertently crash a dialog, and nested dialogs should behave in a more expected fashion, such as when going back and forth between menus or changing options dynamically within a given menu.
|
||||
|
||||
In addition, with this update we are querying servers directly. The net benefit of this is that results will returned faster, bootup is faster, and it also paves the way for future features like connecting to servers on a LAN. The Battlemetrics API is now entirely optional and can be skipped during the setup process. However, if you have already set up a BM API key, you can continue using it if you want to query or add servers by ID instead of IP.
|
||||
|
||||
As part of this change, version 4.0.0 introduces the ability to connect to or add servers to your list based on either ID or IP. Previously, you could only connect by IP and add by IP, but now you can connect by IP/ID or add by IP/ID. If you choose the ID method, this will be translated into an IP seamlessly in the background. Similarly, favorite servers are now stored using the full IP rather than the ID. Due to the variety of systems and methods for connecting to servers, the application was carrying around and converting server IPs, IDs, and other formats back and forth, creating unnecessary complexity. By normalizing everything to an IP basis, maintainability should be more consistent. When upgrading to this version, your old favorites lists will be updated automatically to the new IP method. Note that as a result of this change, we must purge old history lists ("Recent Servers"), but everything else should carry over as before.
|
||||
|
||||
If you encounter any problems with this new release or with the migration of configs, please do not hesitate to submit a bug report.
|
||||
|
||||
Attention Fedora 38 users: problems with upstream GNOME packages causing crashes have been reported to GNOME development and a fix has been issued. You have the choice of compiling the zenity package
|
||||
from source or waiting until the latest version is merged into Fedora's package manager.
|
||||
|
||||
### Added
|
||||
- Change in game name: dynamically change your profile name via the Advanced Options menu
|
||||
- Connect by ID: supply a Battlemetrics ID to connect to a server; this can be used in lieu of the IP
|
||||
- Add by IP: supply a standard IP to add a server to your list; this can be used as a more direct way of saving servers
|
||||
- Filter by 1PP and 3PP in the server browser
|
||||
- Save connected server to favorites: prior to connecting, asks the user if they want to save this server for future use
|
||||
- Generate additional output when generating system logs
|
||||
|
||||
### Fixed
|
||||
- Rare cases where the keyword filter would not filter server results correctly
|
||||
- Handling of dialog exit signals: made it much more difficult to crash the application in rare cases when spamming input or returning from menus
|
||||
- Update menus in place: when toggling options in the Advanced Options menu, displays the current state/mode of the option for better readability into what option is currently enabled
|
||||
- More intuitive menu navigation: dialog setup and teardown is more responsive and follows expected flows when inside of nested menus
|
||||
- Message formatting: fold long messages inside of popup dialogs for proper word wrapping regardless of screen type
|
||||
- Fixed a rare case where dialogs would spawn twice during first-time setup
|
||||
- Properly remain inside of menus when looping where it would make sense to do so : e.g., Delete Servers list, Advanced Options
|
||||
|
||||
### Changed
|
||||
- Query servers directly to reduce API hops: initial bootup and subsequent server queries should be considerably faster
|
||||
- Store complete IP:Port instead of server IDs
|
||||
- Make Battlemetrics API key optional: this is only used for the 'Connect by ID' and 'Add server by ID' methods and is not required. If you prefer, you can simply connect/add by IP.
|
||||
- Prevent the application from launching in Game Mode on Steam Deck: Steam Deck's kiosk mode has problems sending keyboard input to third party applications. To prevent unintended usage, DZGUI now warns the user to launch the app in Desktop Mode if they attempt to use it from Game Mode. Adding DZGUI as a Non-Steam Game does work on desktop PCs, but is not recommended due to the way Steam handles subshells. For best results, launch DZGUI directly via the script/applications menu (PC) or via the desktop icon (Steam Deck).
|
||||
- Omit null servers from list: servers that time out or send an empty response are now omitted entirely from the My Servers list, as they will not return meaningful metadata unless they are online.
|
||||
The My Servers list thus shows online and accessible servers
|
||||
|
||||
## [3.3.0] 2023-05-16
|
||||
### Added
|
||||
- Fetch more inclusive global "players in-game" count
|
||||
- List mod directory on installed mods list
|
||||
- Detect default Flatpak Steam path
|
||||
- Dark mode/light mode theme to help file
|
||||
- Alpha-sort My Servers list
|
||||
- Add description of how to enable hidden folders on GTK2/3
|
||||
- Initial logging framework
|
||||
|
||||
### Changed
|
||||
- Test for wmctrl when enabling full auto mod installation
|
||||
- Steam Deck: block toggling full auto mod installation due to extra dependencies needed
|
||||
- First-time setup: sudo escalation when checking system map count for the first time
|
||||
|
||||
### Fixed
|
||||
- Steam Deck: non-ASCII delimiter causing setup menu to despawn on some devices
|
||||
- Don't add items in My Servers multiple times to array when the list of favorites is paginated
|
||||
- Trigger progress dialogs sooner and in sequence to reduce appearance of visual lag
|
||||
- First-time setup: break out of dialogs correctly when user backs out
|
||||
- First-time setup: break out of automatic path discovery when user specifies a path manually
|
||||
- More portable interpreter invocation
|
||||
- Properly size down window resolution when returning from server browser
|
||||
|
||||
## [3.2.10] 2023-05-11
|
||||
### Fixed
|
||||
- Return from lockfile function if first-time setup has not been run
|
||||
- Sanitize inputs when using file picker
|
||||
- Require both wmctrl and xdotool
|
||||
|
||||
## [3.2.9] 2023-05-10
|
||||
### Changed
|
||||
- Reword button to "Choose path manually" instead of "Retry"
|
||||
|
||||
## [3.2.7] 2023-05-10
|
||||
### Changed
|
||||
- Better sudo escalation within zenity dialogs if vm map count is too small
|
||||
|
||||
## [3.2.6] 2023-05-10
|
||||
### Fixed
|
||||
- Don't parse Flatpak symlinks when setting up default Steam path
|
||||
|
||||
## [3.2.5] 2023-05-07
|
||||
### Fixed
|
||||
- Require sudo when checking vm map count
|
||||
|
||||
## [3.2.4] 2023-03-01
|
||||
### Fixed
|
||||
- BM API returning stale query port and preventing fetching modlist
|
||||
|
||||
## [3.2.3] 2023-02-17
|
||||
### Fixed
|
||||
- sysctl map count value not being loaded immediately after setting
|
||||
- Application terminating when user declines to update map count value
|
||||
- Erroneous stderror output when flatpak is not installed
|
||||
|
||||
## [3.2.0] 2023-01-19
|
||||
### Added
|
||||
- Support Flatpak version of Steam
|
||||
|
||||
## [3.1.8] 2023-01-18
|
||||
### Fixed
|
||||
- Progress window blocking rest of window stack
|
||||
- Bug when updating old mods if automod set to ON
|
||||
|
||||
## [3.1.7] 2023-01-06
|
||||
### Fixed
|
||||
- Hotfix for xdotool repeating input
|
||||
|
||||
## [3.1.6] 2023-01-01
|
||||
### Changed
|
||||
- Tick low pop servers by default
|
||||
|
||||
## [3.1.5] 2023-01-01
|
||||
### Fixed
|
||||
- Validate BM key on initial setup
|
||||
- Fix history menu not parsing query ports correctly
|
||||
### Changed
|
||||
- More permissive Steam client discovery for tiling WMs
|
||||
|
||||
## [3.1.4] 2022-12-10
|
||||
### Fixed
|
||||
- Issue #43: Hotfix for workspace-driven WMs
|
||||
|
||||
## [3.1.3] 2022-12-06
|
||||
### Fixed
|
||||
- Explicitly require Python 3
|
||||
|
||||
## [3.1.1-2] 2022-12-03
|
||||
### Fixed
|
||||
- Fix lockfile path
|
||||
|
||||
## [3.1.0] 2022-12-03
|
||||
### Added
|
||||
- Recent connect history
|
||||
- Simple, OS-agnostic automod installation
|
||||
- Track local mod versions
|
||||
- Force update local mods option
|
||||
- Added python to dependencies
|
||||
- File-picker driven path discovery on initial setup
|
||||
### Dropped
|
||||
- Headless mod installation
|
||||
- Drop server ID field requirement on initial setup
|
||||
### Changed
|
||||
- Clean up main menu options
|
||||
- Enforce Steam API key on initial setup
|
||||
- More accurate path discovery on initial setup
|
||||
- Add thousands separator to player counts in server browser
|
||||
### Fixed
|
||||
- Initial setup dialog causing early crash
|
||||
- Improved error handling on initial setup to avoid malformed config files
|
||||
- Delete server menu not clearing when returning to main menu
|
||||
- Handle whitelist deletion when only one entry present
|
||||
- Include path to drives under /run in path discovery
|
||||
- Use Steam-safe local zenity version
|
||||
|
||||
## [3.0.7] 2022-11-25
|
||||
### Fixed
|
||||
- Hotfix for server reporting multiple versions of same mod
|
||||
|
||||
## [3.0.6] 2022-11-09
|
||||
### Changed
|
||||
- More verbose logs
|
||||
|
||||
## [3.0.5] 2022-10-27
|
||||
### Fixed
|
||||
- Properly create .desktop file on desktop PCs
|
||||
|
||||
## [3.0.3-4] 2022-10-16
|
||||
### Fixed
|
||||
- Steam Deck path discovery on first-time setup
|
||||
|
||||
## [3.0.2] 2022-10-12
|
||||
### Fixed
|
||||
- Size of certain popups on Steam Deck
|
||||
|
||||
## [3.0.1] 2022-10-12
|
||||
### Fixed
|
||||
- Initial popup size on Steam Deck
|
||||
|
||||
## [3.0.0] 2022-10-12
|
||||
### Added
|
||||
- Foreground progress of manual mod subscriptions
|
||||
- Automatic mod helper through steamcmd
|
||||
- Forum link
|
||||
- Enforce Steam API
|
||||
### Dropped
|
||||
- Stop retrieving extra metadata from BM
|
||||
### Changed
|
||||
- Reorder main menu
|
||||
- More verbose error messages
|
||||
- Better abstraction of URLs
|
||||
### Fixed
|
||||
- Width and text of some popups on Steam Deck
|
||||
|
||||
## [2.7.2] 2022-10-07
|
||||
### Fixed
|
||||
- Fix internal URL
|
||||
|
||||
## [2.7.1] 2022-10-05
|
||||
### Fixed
|
||||
- Game launch not kicking off after symlink creation
|
||||
|
||||
## [2.7.0] 2022-10-04
|
||||
### Added
|
||||
- Server browser and geolocation algorithm
|
||||
- More verbose error codes
|
||||
- Additional progress bar setup and destruction throughout the application
|
||||
- Additional API response validation
|
||||
### Fixed
|
||||
- Encapsulate title strings to prevent leaky arguments in title bars
|
||||
- Remove erroneous slow boot process if first-time setup was already complete
|
||||
- Delete server list not emptying when returning to main menu
|
||||
### Changed
|
||||
- Group main menu entries in advance of future functionality
|
||||
- Better abstraction of paths
|
||||
- Clarification of certain options and errors
|
||||
|
||||
## [2.6.3] 2022-10-02
|
||||
### Fixed
|
||||
- Hotfix for connect-to-fav not getting modlist
|
||||
|
||||
## [2.6.2] 2022-10-02
|
||||
### Fixed
|
||||
- Hotfix for BM API returning malformed publishedfileids
|
||||
|
||||
## [2.6.1] 2022-09-25
|
||||
### Fixed
|
||||
- Freedesktop shortcut errors
|
||||
|
||||
## [2.6.0] 2022-09-05
|
||||
### Added
|
||||
- Connect by IP method
|
||||
|
||||
## [2.5.1] 2022-08-17
|
||||
### Fixed
|
||||
- Hotfix for malformed paths during first-time setup
|
||||
|
||||
## [2.5.0] 2022-08-16
|
||||
### Added
|
||||
- Lockfile: prevent concurrent instances of DZGUI from being opened
|
||||
|
||||
### Changed
|
||||
- Faster path discovery on first-time setup
|
||||
|
||||
### Fixed
|
||||
- Symlink collision on servers with many mods
|
||||
- API response pagination for large server lists
|
||||
|
||||
## [2.4.1] 2022-08-09
|
||||
### Fixed
|
||||
- Hotfix for progress bar breaking table when >9 servers in list
|
||||
|
||||
## [2.4.0] 2022-08-07
|
||||
### Added
|
||||
- Delete server command added to main menu
|
||||
- Write log to file for bug reports
|
||||
- Prompt to permanently increase map count size
|
||||
- Dependency check for Steam
|
||||
- Cover artwork
|
||||
- News backend for OTA updates
|
||||
- Clean up stale symlinks when checking mods
|
||||
|
||||
### Fixed
|
||||
- Minify long mod launch params for servers with launch params breaking the upper limit
|
||||
- Port DZTUI method of handling legacy symlinks
|
||||
- Prevent user from entering invalid data on first-time setup
|
||||
- Prompt to re-run first-time setup if config is malformed
|
||||
- Better handling of field output from table
|
||||
- Better Steam Deck detection and handling
|
||||
- Prevent garbage in error messages
|
||||
- Miscellaneous backend improvements
|
||||
|
||||
### Changed
|
||||
- Enforce download when switching branches
|
||||
|
||||
## [2.3.2] 2022-08-04
|
||||
### Fixed
|
||||
Set branch flag to 'stable' if no config file present
|
||||
|
||||
## [2.3.1] 2022-08-04
|
||||
### Fixed
|
||||
- Improved error handling of first-time setup fields
|
||||
- Interpolate config file values for debug, branch when writing file
|
||||
|
||||
### Changed
|
||||
- Prompt user to restart first-time setup if broken config is found
|
||||
|
||||
## [2.3.0] 2022-07-18
|
||||
### Added
|
||||
- Numbered mod links in browser
|
||||
- Admonition to upgrade versions for bug fixes
|
||||
- Toggle branch between stable/testing
|
||||
|
||||
### Fixed
|
||||
- Hotfix for fav server select on main menu
|
||||
|
||||
## [2.2.1] 2022-07-17
|
||||
### Fixed
|
||||
- Hotfix for upstream API returning malformed modlists
|
||||
- Handle servers with no mods
|
||||
- Fix dialog window depending on browser exit
|
||||
- Remove stray newlines in config file
|
||||
|
||||
## [2.2.0] 2022-06-22
|
||||
### Added
|
||||
- Toggle debug mode in-app
|
||||
|
||||
## [2.1.0] 2022-06-19
|
||||
### Changed
|
||||
- Updated link to new documentation
|
||||
|
||||
## [2.0.3] 2022-06-17
|
||||
### Fixed
|
||||
- Safer expansion of originating script path
|
||||
|
||||
## [2.0.2] 2022-06-16
|
||||
### Fixed
|
||||
- Remove enforced runtime check of workshop path
|
||||
|
||||
## [2.0.2] 2022-06-16
|
||||
### Fixed
|
||||
- Expansion of Steam path prefix when default path was found
|
||||
|
||||
## [2.0.1] 2022-06-16
|
||||
### Fixed
|
||||
- Regenerate mod links file in browser when clicking dialog
|
||||
- Reset whitelist when canceling one-shot (fav) mode
|
||||
|
||||
## [2.0.0] 2022-06-15
|
||||
### Added
|
||||
- Attempt to find DayZ path and write to config on first launch
|
||||
- Merge existing config values into new config format when upgrading version
|
||||
- Dynamically detect Steam Deck and set launch parameters
|
||||
- Add "gametime" column to server list
|
||||
- One-shot mode to open mod links in browser if using desktop
|
||||
- Add favorite server from main menu
|
||||
- Update favorite server changes in real time
|
||||
- Add link to help pages from main menu
|
||||
- Add link to changelog from main menu
|
||||
### Changed
|
||||
- Don't require duplication of fav server in whitelist
|
||||
- More permissive truncation of long server names (50 char limit)
|
||||
- Render mod list as a scrollable menu
|
||||
- Reword errors for greater verbosity
|
||||
- Initial support of granular error handling for API response codes
|
||||
- Move extended path variables out of user config
|
||||
### Fixed
|
||||
- Check if mod dir is sane before listing mods
|
||||
- Prevent favorite server launch if none set
|
||||
- Reset server list to entire whitelist if canceling out of fav connect
|
||||
- Do not load table on empty API response and warn user
|
||||
- Suppress stderr cruft in logs and use logger instead
|
||||
|
||||
## [1.2.1] 2022-06-12
|
||||
### Fixed
|
||||
- Print the entire changelog
|
||||
- Add confirmation dialog before run
|
||||
|
||||
## [1.2.0] 2022-06-12
|
||||
### Changed
|
||||
- Mod validation process now uses faster, single-pass API query
|
||||
- Improved logger output when setting fav server
|
||||
|
||||
### Added
|
||||
- In-app changelog
|
||||
|
||||
## [1.1.2] 2022-06-08
|
||||
### Fixed
|
||||
- Fix array used for mod concatenation; fetch post-sanitized list of mods
|
||||
|
||||
## [1.1.1] 2022-06-05
|
||||
### Fixed
|
||||
- Stricter regex to parse upstream version number
|
||||
|
||||
## [1.1.0] 2022-06-05
|
||||
### Added
|
||||
- Main menu: fav server label on header
|
||||
- Main menu: add servers by ID directly into config file
|
||||
- Main menu: link to report a bug
|
||||
- Main menu: quick connect to fav server
|
||||
- Connect: mod compatibility check
|
||||
- Connect: mod download prompt
|
||||
- Connect: mod auto symlinks
|
||||
- New version download prompt
|
||||
- Additional visualization of progress/menus
|
||||
### Fixed
|
||||
- Menu recursion when navigating backwards
|
||||
### Changed
|
||||
- Reduced ping timeout interval
|
||||
@ -1,40 +0,0 @@
|
||||
.invalid-entry {
|
||||
border-color: red;
|
||||
}
|
||||
.frame {
|
||||
border: 0px;
|
||||
}
|
||||
.toast-label {
|
||||
background-color: black;
|
||||
border: 1px solid white;
|
||||
}
|
||||
.frame > border {
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
.page-heading {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 800;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.settings-subheading {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.left-label {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
.details-heading {
|
||||
font-size: 1.2rem
|
||||
}
|
||||
.preconnect-heading {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.masked-tree {
|
||||
background-color: transparent;
|
||||
}
|
||||
.error-frame border {
|
||||
border: 2px solid red;
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.util.ip import get_local_ip, get_coords, Coords
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def get_local_coords(path: "Path") -> Coords | None:
|
||||
try:
|
||||
my_ip = get_local_ip()
|
||||
return get_coords(path, my_ip)
|
||||
except Exception as e:
|
||||
logger.warn(e)
|
||||
return None
|
||||
@ -1,20 +0,0 @@
|
||||
import logging
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from dzgui.config.query import lookup
|
||||
from dzgui.const.constants import APPID_DAYZ, APP_NAME, LIBRARYFOLDERS_PATH
|
||||
from dzgui.const.enum import Preferences
|
||||
|
||||
import dzgui.api.pefile as PeFile
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def is_dayz_installed(config: Path) -> None:
|
||||
try:
|
||||
path = lookup(config, Preferences.DEFAULT)
|
||||
PeFile.get_app_path(Path(path) / LIBRARYFOLDERS_PATH, APPID_DAYZ)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
raise e
|
||||
@ -1,25 +0,0 @@
|
||||
import fcntl
|
||||
import os
|
||||
import sys
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TextIO
|
||||
|
||||
from dzgui.views.dialogs.early_alert import EarlyAlertDialog
|
||||
from dzgui.util.strings import cannot_acquire_lock
|
||||
|
||||
|
||||
def lock_release(lock: TextIO) -> None:
|
||||
fcntl.flock(lock, fcntl.LOCK_UN)
|
||||
os.close(lock.fileno())
|
||||
|
||||
|
||||
def lock_acquire() -> TextIO:
|
||||
lockfile = Path("/tmp/dzgui.flock")
|
||||
lock = open(lockfile, "w")
|
||||
try:
|
||||
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
except OSError:
|
||||
EarlyAlertDialog(cannot_acquire_lock)
|
||||
sys.exit(1)
|
||||
return lock
|
||||
@ -1,50 +0,0 @@
|
||||
import platform
|
||||
import sys
|
||||
|
||||
from ctypes.util import find_library
|
||||
from warnings import deprecated
|
||||
|
||||
LIB = "libgirepository-2.0"
|
||||
|
||||
|
||||
@deprecated("currently unused")
|
||||
def is_debian() -> bool:
|
||||
"""
|
||||
cf.
|
||||
|
||||
NAME="Debian GNU/Linux"
|
||||
ID=debian
|
||||
|
||||
NAME="Ubuntu"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
|
||||
NAME="Linux Mint"
|
||||
ID=linuxmint
|
||||
ID_LIKE="ubuntu debian"
|
||||
|
||||
NAME="Pop!_OS"
|
||||
ID=pop
|
||||
ID_LIKE="ubuntu debian"
|
||||
"""
|
||||
release = platform.freedesktop_os_release()
|
||||
strings = ["ubuntu debian", "debian"]
|
||||
try:
|
||||
self_id = release["ID"]
|
||||
if self_id == "debian":
|
||||
return True
|
||||
id_like = release["ID_LIKE"]
|
||||
return id_like in strings
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
def has_libgi() -> bool:
|
||||
return bool(find_library("girepository-2.0"))
|
||||
|
||||
|
||||
def test_libgi_missing() -> None:
|
||||
msg = f"System is missing the required library '{LIB}'. Install it via your system package manager."
|
||||
if has_libgi() is False:
|
||||
print(msg)
|
||||
sys.exit(1)
|
||||
@ -1,72 +0,0 @@
|
||||
import shutil
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from dzgui.const.constants import LEGACY_CONFIG_PATH, LEGACY_COLS_PATH, LEGACY_IPS_PATH
|
||||
from dzgui.config.convert import rc2json
|
||||
from dzgui.util._json import read_json, write_json
|
||||
|
||||
|
||||
def migrate_legacy_conf(config: Path) -> None:
|
||||
old_conf = Path.home() / LEGACY_CONFIG_PATH
|
||||
j = rc2json(old_conf)
|
||||
config.parent.mkdir(parents=True, exist_ok=True)
|
||||
config.write_text(j)
|
||||
|
||||
|
||||
def has_new_config(config: Path) -> bool:
|
||||
return config.exists()
|
||||
|
||||
|
||||
def convert_cols_file(res: Path) -> Any | None:
|
||||
j = read_json(res)
|
||||
cols = j["cols"]
|
||||
# NOTE: implies prior conversion
|
||||
if "View" in cols:
|
||||
return None
|
||||
# NOTE: user may not have changed these widths in API 6
|
||||
try:
|
||||
cols["View"] = cols.pop("Perspective")
|
||||
cols["Max"] = cols.pop("Maximum")
|
||||
except Exception:
|
||||
pass
|
||||
return j
|
||||
|
||||
|
||||
def migrate_cols_file(res: Path) -> None:
|
||||
# NOTE: filename "dzg.columns.json" is API 7 spec
|
||||
old_res = Path.home() / LEGACY_COLS_PATH
|
||||
if old_res.is_file():
|
||||
j = convert_cols_file(old_res)
|
||||
if j is not None:
|
||||
write_json(j, res)
|
||||
|
||||
|
||||
def copy_state_files(state_path: Path) -> None:
|
||||
home = Path.home()
|
||||
legacy = home / ".local/state/dzgui"
|
||||
to_copy = [
|
||||
"dzg.res.json",
|
||||
"dzg.notes.json",
|
||||
"dzg.history",
|
||||
"dzg.versions",
|
||||
"ips.csv",
|
||||
".month",
|
||||
]
|
||||
if state_path == legacy:
|
||||
# TODO: log this
|
||||
return
|
||||
for file in legacy.iterdir():
|
||||
if file.name in to_copy:
|
||||
shutil.copy(file, state_path / file.name)
|
||||
|
||||
|
||||
def copy_ipdb(ips_path: Path) -> None:
|
||||
home = Path.home()
|
||||
legacy = home / LEGACY_IPS_PATH
|
||||
if ips_path == legacy:
|
||||
return
|
||||
if legacy.is_file() is False:
|
||||
return
|
||||
# TODO: ensure that month file is copied
|
||||
shutil.copy(legacy, ips_path)
|
||||
@ -1,23 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from importlib import metadata
|
||||
from pathlib import Path
|
||||
|
||||
from dzgui.const.constants import APP_NAME_LOWER
|
||||
|
||||
def is_prefix_writeable() -> bool:
|
||||
prefix = sys.prefix
|
||||
path = Path(prefix)
|
||||
file = path / ".is_writeable"
|
||||
try:
|
||||
with open(file, "w") as f:
|
||||
f.write("")
|
||||
os.remove(file)
|
||||
except OSError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def get_version() -> str:
|
||||
return metadata.version(APP_NAME_LOWER)
|
||||
@ -1,25 +0,0 @@
|
||||
import logging
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from dzgui.const.constants import APP_NAME, FLATPAK_APPID, FLATPAK_CMD, STEAM_CMD
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def has_steam_client() -> bool:
|
||||
if shutil.which(STEAM_CMD):
|
||||
return True
|
||||
if not shutil.which(FLATPAK_CMD):
|
||||
return False
|
||||
try:
|
||||
res = subprocess.run(
|
||||
[FLATPAK_CMD, "list"], capture_output=True, text=True, check=True
|
||||
)
|
||||
if FLATPAK_APPID in res.stdout:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.critical(e)
|
||||
return False
|
||||
@ -1,93 +0,0 @@
|
||||
import psutil
|
||||
import subprocess
|
||||
import shutil
|
||||
import logging
|
||||
|
||||
from warnings import deprecated
|
||||
|
||||
from dzgui.const.constants import (
|
||||
APP_NAME,
|
||||
DAYZ_BINARY,
|
||||
STEAM_CMD,
|
||||
FLATPAK_APPID,
|
||||
FLATPAK_CMD,
|
||||
FLATPAK_RUN_CMD,
|
||||
FLATPAK_SANDBOX,
|
||||
)
|
||||
|
||||
from dzgui.util.format import format_exception
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
# TODO: move to util.proc
|
||||
def is_dayz_running() -> bool:
|
||||
"""Subprocesses spawned from Steam will not show up in regular process tree"""
|
||||
procs = []
|
||||
substring = DAYZ_BINARY
|
||||
for proc in psutil.process_iter():
|
||||
try:
|
||||
procs.append(proc.cmdline())
|
||||
except Exception as e:
|
||||
msg = format_exception(e)
|
||||
logger.warning(msg)
|
||||
continue
|
||||
return any(substring in item for sublist in procs for item in sublist)
|
||||
|
||||
|
||||
def is_steam_running(cmd: str) -> bool:
|
||||
if cmd == STEAM_CMD:
|
||||
if has_cmd(STEAM_CMD) is False:
|
||||
return False
|
||||
return is_running(STEAM_CMD)
|
||||
elif cmd == FLATPAK_RUN_CMD or FLATPAK_SANDBOX:
|
||||
return is_flatpak_steam_running()
|
||||
else:
|
||||
raise TypeError("Not a valid Steam client selection")
|
||||
|
||||
|
||||
# CHORE: test alternate clients
|
||||
# TODO: has_flatpak_steam
|
||||
def is_flatpak_steam_running() -> bool:
|
||||
if has_cmd(FLATPAK_CMD) is False:
|
||||
return False
|
||||
proc = subprocess.check_output([FLATPAK_CMD, "ps"], text=True)
|
||||
lines = proc.splitlines()
|
||||
if FLATPAK_APPID in lines:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def is_running(proc: str) -> bool:
|
||||
for process in psutil.process_iter(["pid", "name"]):
|
||||
if process.info["name"] == proc:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def has_cmd(cmd: str) -> bool:
|
||||
if shutil.which(cmd) is not None:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@deprecated("dropped in favor of Gtk native methods")
|
||||
def foreground(cmd: str, pid: int) -> None:
|
||||
if cmd == "wmctrl":
|
||||
proc = subprocess.run(["wmctrl", "-ilp"], capture_output=True, text=True)
|
||||
lines = proc.stdout.splitlines()
|
||||
for line in lines:
|
||||
els = line.split(" ")
|
||||
if str(pid) in els:
|
||||
wid = els[0]
|
||||
break
|
||||
subprocess.run(["wmctrl", "-ia", wid])
|
||||
elif cmd == "xdotool":
|
||||
args = [cmd, "search", "--pid", str(pid)]
|
||||
proc = subprocess.run([*args], capture_output=True, text=True)
|
||||
lines = proc.stdout.splitlines()
|
||||
## NOTE: some forked subprocesses may fail, so skip over them
|
||||
for line in lines:
|
||||
subprocess.run(
|
||||
["xdotool", "windowactivate", line], stderr=subprocess.DEVNULL
|
||||
)
|
||||
@ -1,39 +0,0 @@
|
||||
import logging
|
||||
import requests
|
||||
|
||||
from packaging.version import Version
|
||||
from typing import Any
|
||||
|
||||
from dzgui.const.constants import APP_NAME, REQUEST_TIMEOUT
|
||||
from dzgui.const.endpoints import GITHUB_RELEASES, CODEBERG_RELEASES
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def get_latest_release() -> tuple[Any, Any] | tuple[None, None]:
|
||||
tag = None
|
||||
url = None
|
||||
# TODO: check order; github often has gateway errors
|
||||
for url in [GITHUB_RELEASES, CODEBERG_RELEASES]:
|
||||
try:
|
||||
res = requests.get(url, timeout=REQUEST_TIMEOUT)
|
||||
if res.status_code == 200:
|
||||
tag = res.json()["tag_name"]
|
||||
url = res.json()["assets"][0]["browser_download_url"]
|
||||
break
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
continue
|
||||
return tag, url
|
||||
|
||||
|
||||
def check_updates(version: str) -> str | None:
|
||||
try:
|
||||
latest, url = get_latest_release()
|
||||
if latest is None:
|
||||
return None
|
||||
if Version(version) >= Version(latest):
|
||||
return None
|
||||
return url
|
||||
except Exception:
|
||||
return None
|
||||
@ -1 +0,0 @@
|
||||
Subproject commit b40eb24cdbb06ebd08272f224257fe5a81610e86
|
||||
@ -1 +0,0 @@
|
||||
Subproject commit 07483b88ed096327ebca752f5e177011b604d7fe
|
||||
@ -1,44 +0,0 @@
|
||||
import argparse
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.init.libgi import test_libgi_missing
|
||||
from dzgui.init.prefix import get_version
|
||||
from dzgui.util.strings import flags
|
||||
|
||||
parser = argparse.ArgumentParser(description=flags.description)
|
||||
parser.add_argument("-v", "--version", action="store_true", help=flags.version)
|
||||
parser.add_argument("-u", "--uninstall", action="store_true", help=flags.uninstall)
|
||||
parser.add_argument("-d", "--debug", action="store_true", help=flags.debug)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def uninstall() -> None:
|
||||
# TODO: uninstall data files (-u)
|
||||
# -u removes state, log, freedesktop
|
||||
# XDG_SHARE_HOME/dzgui
|
||||
# XDG_STATE_HOME/dzgui
|
||||
# XDG_DATA_HOME/dzgui
|
||||
pass
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if args.version is True:
|
||||
print(get_version())
|
||||
sys.exit(0)
|
||||
if args.uninstall is True:
|
||||
uninstall()
|
||||
sys.exit(0)
|
||||
if args.debug is True:
|
||||
warnings.filterwarnings("default", category=DeprecationWarning)
|
||||
|
||||
version = get_version()
|
||||
|
||||
print(f"{APP_NAME} {version}")
|
||||
test_libgi_missing()
|
||||
|
||||
# NOTE: only import ligbirepository modules after the above check
|
||||
from dzgui.app_init import load_gui
|
||||
|
||||
load_gui(version, args.debug)
|
||||
@ -1,246 +0,0 @@
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
from collections import deque
|
||||
from typing import Any, TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import (
|
||||
APP_NAME,
|
||||
FLATPAK_RUN_CMD,
|
||||
FLATPAK_SANDBOX,
|
||||
STEAM_CMD,
|
||||
WINDOW_DEFAULT_X,
|
||||
WINDOW_DEFAULT_Y,
|
||||
)
|
||||
from dzgui.api.probe import test_steam_api, test_bm_api
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
from dzgui.strings import dialogs
|
||||
from dzgui.util._json import read_json, write_json
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository.Gtk import main_quit # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.config.userprefs import UserPrefs
|
||||
from dzgui.controllers.mc import Controller
|
||||
from dzgui.views.base import OuterWindow
|
||||
from dzgui.views.trees.tree_servers import ServerTreeView
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
class ConfigManager:
|
||||
def __init__(self, prefs: "UserPrefs", controller: "Controller") -> None:
|
||||
self.prefs = prefs
|
||||
self.config = prefs.paths.config
|
||||
self.controller = controller
|
||||
self.emitter = controller.get_emitter()
|
||||
self.thread_man = ThreadingManager(controller)
|
||||
|
||||
def lookup(self, enum: Preferences) -> Any:
|
||||
key = self.enum_to_key(enum)
|
||||
config = self.get_config()
|
||||
try:
|
||||
return config[key]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def add_saved_server(self, record: str) -> None:
|
||||
ips = self.lookup(Preferences.IP_LIST)
|
||||
ips.append(record)
|
||||
self.update_config(Preferences.IP_LIST, ips)
|
||||
|
||||
def update_history_file(self, fqip: str) -> None:
|
||||
with open(self.prefs.paths.history, "r") as f:
|
||||
ips = [line.rstrip() for line in f.readlines()]
|
||||
|
||||
seen = set()
|
||||
ips.append(fqip)
|
||||
# NOTE: Preserve linear order of records while deduplicating
|
||||
unique = deque(maxlen=10) # type: ignore
|
||||
for i in range(len(ips) - 1, -1, -1):
|
||||
if ips[i] not in seen:
|
||||
seen.add(ips[i])
|
||||
unique.appendleft(ips[i])
|
||||
# NOTE: appendleft will push 11th item off right edge
|
||||
if len(unique) == 10:
|
||||
break
|
||||
|
||||
with open(self.prefs.paths.history, "w") as f:
|
||||
for record in unique:
|
||||
f.write(f"{record}\n")
|
||||
|
||||
def remove_saved_server(self, record: str) -> None:
|
||||
ips = self.lookup(Preferences.IP_LIST)
|
||||
ips.remove(record)
|
||||
self.update_config(Preferences.IP_LIST, ips)
|
||||
|
||||
# TODO: drop/reroute
|
||||
def update_config(self, key: Preferences, value: str) -> None:
|
||||
self.write_config(key, value)
|
||||
# TODO: suppress signals
|
||||
# then reenable (or it spawns dialog twice)
|
||||
# TODO: do this on demand if/when in options page
|
||||
# self.mediator.grid.notebook.settings.populate_settings()
|
||||
|
||||
def get_config(self) -> Any:
|
||||
# TODO: is this being called twice?
|
||||
try:
|
||||
return read_json(self.config)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
raise e
|
||||
|
||||
@call_on_thread(dialogs.checking_api)
|
||||
def update_api_key(self, key: Preferences, text: str) -> None:
|
||||
if key is Preferences.STEAM:
|
||||
res = test_steam_api(text)
|
||||
else:
|
||||
res = test_bm_api(text)
|
||||
if res is True:
|
||||
self.update_config(key, text)
|
||||
else:
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(lambda: self.emitter.emit("api_change_failed"))
|
||||
)
|
||||
return
|
||||
|
||||
def get_start_tab(self) -> Any:
|
||||
return int(self.lookup(Preferences.START_TAB))
|
||||
|
||||
def get_favorites(self) -> list[str]:
|
||||
return list(self.lookup(Preferences.IP_LIST))
|
||||
|
||||
def get_favorite(self) -> tuple[str, str] | None:
|
||||
fav = str(self.lookup(Preferences.FAV_LBL))
|
||||
if len(fav) < 1:
|
||||
return None
|
||||
ip = str(self.lookup(Preferences.FAV_SRV))
|
||||
addr = ip.split(":")
|
||||
return fav, f"{addr[0]}:{addr[2]}"
|
||||
|
||||
def is_in_favs(self, record: str) -> bool:
|
||||
favs = self.get_favorites()
|
||||
if record in favs:
|
||||
return True
|
||||
return False
|
||||
|
||||
def enum_to_key(self, enum: Preferences) -> str:
|
||||
return str(enum.dict["key"])
|
||||
|
||||
def get_client_index(self, client: str) -> int:
|
||||
if client == STEAM_CMD:
|
||||
return 0
|
||||
if client == FLATPAK_RUN_CMD:
|
||||
return 1
|
||||
if client == FLATPAK_SANDBOX:
|
||||
return 2
|
||||
return 0
|
||||
|
||||
def toggle_config(self, key: Preferences) -> None:
|
||||
try:
|
||||
real_key = self.enum_to_key(key)
|
||||
_json = self.get_config()
|
||||
cur_val = not _json[real_key]
|
||||
_json[real_key] = cur_val
|
||||
write_json(_json, self.config)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
raise e
|
||||
|
||||
def set_fav(self, name: str, record: str) -> None:
|
||||
try:
|
||||
self.write_config(Preferences.FAV_LBL, name)
|
||||
self.write_config(Preferences.FAV_SRV, record)
|
||||
except Exception:
|
||||
return
|
||||
|
||||
def write_config(self, key: Preferences, value: str) -> None:
|
||||
try:
|
||||
real_key = self.enum_to_key(key)
|
||||
conf = self.get_config()
|
||||
conf[real_key] = value
|
||||
write_json(conf, self.config)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
trace = traceback.format_exc()
|
||||
dialog = ExceptionDialog(self.controller, trace)
|
||||
dialog.run()
|
||||
raise e
|
||||
|
||||
def save_res_and_quit(self, tv: "ServerTreeView", window: "OuterWindow") -> None:
|
||||
columns = tv.get_columns()
|
||||
filters = self.controller.get_all_tree_filters()
|
||||
filters_file = self.prefs.paths.filters
|
||||
|
||||
columns_file = self.prefs.paths.columns
|
||||
try:
|
||||
data = read_json(columns_file)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
data = {"cols": {}}
|
||||
|
||||
for column in columns:
|
||||
title = column.get_title()
|
||||
size = column.get_width()
|
||||
data["cols"][title] = size
|
||||
|
||||
try:
|
||||
write_json(data, columns_file)
|
||||
write_json(filters, filters_file)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
|
||||
logger.info("Normal user exit")
|
||||
if window.props.is_maximized:
|
||||
main_quit()
|
||||
return
|
||||
|
||||
w, h = window.get_size()
|
||||
data = {"res": {"width": w, "height": h}}
|
||||
|
||||
res_path = self.prefs.paths.resolution
|
||||
try:
|
||||
write_json(data, res_path)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
|
||||
main_quit()
|
||||
|
||||
def set_resolution(self, window: "OuterWindow") -> None:
|
||||
if self.prefs.is_game_mode:
|
||||
window.fullscreen()
|
||||
return
|
||||
elif self.lookup(Preferences.WINDOW) is True:
|
||||
window.fullscreen()
|
||||
|
||||
try:
|
||||
data = read_json(self.prefs.paths.resolution)
|
||||
valid_json = True
|
||||
except Exception as e:
|
||||
valid_json = False
|
||||
logger.critical(e)
|
||||
|
||||
if valid_json:
|
||||
res = data["res"]
|
||||
w, h = res["width"], res["height"]
|
||||
logger.info(f"Restoring window size to {w},{h}")
|
||||
window.set_default_size(w, h)
|
||||
else:
|
||||
w = WINDOW_DEFAULT_X
|
||||
h = WINDOW_DEFAULT_Y
|
||||
logger.info(f"Using default window size {w},{h}")
|
||||
window.set_default_size(w, h)
|
||||
|
||||
def get_filters(self, tv: "ServerTreeView") -> Any | None:
|
||||
filters = self.prefs.paths.filters
|
||||
try:
|
||||
enum = tv.get_enum()
|
||||
filters = read_json(filters)
|
||||
return filters[str(enum)]
|
||||
except Exception:
|
||||
return None
|
||||
@ -1,349 +0,0 @@
|
||||
import logging
|
||||
import shutil
|
||||
import time
|
||||
|
||||
from dataclasses import dataclass
|
||||
from packaging.version import Version
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import dzgui.api.pefile as PeFile
|
||||
import dzgui.api.servers as Servers
|
||||
|
||||
from dzgui.api.steam import (
|
||||
connect,
|
||||
get_remote_signatures,
|
||||
get_needs_update,
|
||||
load_to_menu,
|
||||
subscribe,
|
||||
)
|
||||
|
||||
from dzgui.api.mods import (
|
||||
get_mod_dir_size,
|
||||
get_local_mod_ids,
|
||||
get_local_mod_path,
|
||||
update_signatures,
|
||||
)
|
||||
from dzgui.const.constants import (
|
||||
API_RATE_LIMIT,
|
||||
APP_NAME,
|
||||
APPID_DAYZ,
|
||||
APPID_DAYZ_EXP,
|
||||
APPNAME_DAYZ,
|
||||
APPNAME_DAYZ_EXP_HUMAN,
|
||||
)
|
||||
from dzgui.const.enum import NotebookPage, Preferences
|
||||
from dzgui.init.proc import is_dayz_running, is_steam_running
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.strings.dialogs import (
|
||||
waiting_for_launch,
|
||||
waiting_for_mods,
|
||||
waiting_for_directories,
|
||||
)
|
||||
from dzgui.strings.server_mods import checkmark, resync
|
||||
from dzgui.util.format import format_mib
|
||||
from dzgui.util.strings import dialog, server_timeout
|
||||
from dzgui.util.symlink import rebuild_symlinks
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
from dzgui.views.dialogs.servers import ServerDetailsDialog, ServerModDialog
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.api.servers import A2SInfo, Record
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class SteamProcess:
|
||||
name: str
|
||||
is_running: bool
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class Prerequisites:
|
||||
name: str
|
||||
appid: int
|
||||
local_version: Version
|
||||
remote_version: Version
|
||||
build: str
|
||||
binary_missing: bool
|
||||
required_space: float
|
||||
available_space: float
|
||||
passworded: bool
|
||||
dayz_running: bool
|
||||
steam_proc: SteamProcess
|
||||
mods: list[list[str]]
|
||||
game_mode: bool
|
||||
is_last_server: bool
|
||||
|
||||
|
||||
class ConnectionManager:
|
||||
def __init__(self, controller: "Controller") -> None:
|
||||
|
||||
self.controller = controller
|
||||
self.thread_man = ThreadingManager(controller)
|
||||
|
||||
self.appid: int
|
||||
self.record: Record
|
||||
self.workshop: Path
|
||||
|
||||
self.client: str
|
||||
self.remote_mod_ids: list[str] = []
|
||||
self.missing_mods: list[tuple[str, str, int, int]] = []
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def connect_by_id(self, _id: int, key: str) -> None:
|
||||
res = Servers.query_by_id(_id, key)
|
||||
self._prepare_connection(res)
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def connect_by_ip(self, addr: str) -> None:
|
||||
res = Servers.query_by_ip(addr)
|
||||
self._prepare_connection(res)
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def connect_by_record(self, record: Servers.Record) -> None:
|
||||
res = Servers.query_by_record(record)
|
||||
self._prepare_connection(res)
|
||||
|
||||
def _prepare_connection(self, res: "A2SInfo") -> None:
|
||||
failure_func = StoredFunc(self._server_timeout)
|
||||
info = res.get_info()
|
||||
if info is None:
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
return
|
||||
|
||||
try:
|
||||
self.history = res.as_row()
|
||||
except Exception:
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
return
|
||||
|
||||
record = res.get_record()
|
||||
|
||||
# NOTE: store metadata for later connection
|
||||
self.appid = info.game_id
|
||||
self.record = record
|
||||
|
||||
builds = {APPID_DAYZ: APPNAME_DAYZ, APPID_DAYZ_EXP: APPNAME_DAYZ_EXP_HUMAN}
|
||||
build = builds[self.appid]
|
||||
binary_missing = False
|
||||
required_mib = 0.0
|
||||
free_mib = 0.0
|
||||
|
||||
steam_path = Path(self.controller.query_config(Preferences.DEFAULT))
|
||||
self.workshop = get_local_mod_path(steam_path)
|
||||
local_version = PeFile.get_pretty_version(steam_path, info.game_id)
|
||||
if local_version is None:
|
||||
local_version = "0.0.0"
|
||||
binary_missing = True
|
||||
|
||||
prefs = self.controller.get_prefs()
|
||||
remote_mods: list[list[str]] = []
|
||||
if res.is_modded():
|
||||
try:
|
||||
remote_mods, missing_mods = self._query_modlist(record)
|
||||
self.missing_mods = missing_mods
|
||||
self.remote_mod_ids = [mod[1] for mod in remote_mods]
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
return
|
||||
|
||||
if local_version is not None:
|
||||
pefile_path = PeFile.get_pefile_path(steam_path, info.game_id)
|
||||
total, used, free = shutil.disk_usage(pefile_path)
|
||||
if len(self.missing_mods) > 0:
|
||||
required_size = sum(row[2] for row in self.missing_mods)
|
||||
required_mib = format_mib(required_size)
|
||||
free_mib = format_mib(free)
|
||||
|
||||
dayz_running = is_dayz_running()
|
||||
|
||||
client_name = self.controller.get_steam_client_name()
|
||||
client = self.controller.query_config(Preferences.CLIENT)
|
||||
running = is_steam_running(client)
|
||||
steam_proc = SteamProcess(client_name, running)
|
||||
self.client = client
|
||||
|
||||
game_mode = prefs.is_game_mode
|
||||
|
||||
is_last = self.is_last_server()
|
||||
|
||||
prereqs = Prerequisites(
|
||||
name=info.server_name,
|
||||
appid=info.game_id,
|
||||
local_version=Version(local_version),
|
||||
remote_version=Version(info.version),
|
||||
build=build,
|
||||
binary_missing=binary_missing,
|
||||
required_space=required_mib,
|
||||
available_space=free_mib,
|
||||
passworded=info.password_protected,
|
||||
dayz_running=dayz_running,
|
||||
steam_proc=steam_proc,
|
||||
mods=remote_mods,
|
||||
game_mode=game_mode,
|
||||
is_last_server=is_last,
|
||||
)
|
||||
|
||||
func = StoredFunc(self.controller.open_connection_assistant, prereqs)
|
||||
self.thread_man.set_cleanup_func(func, destroy_first=True)
|
||||
|
||||
def is_last_server(self) -> bool:
|
||||
prefs = self.controller.get_prefs()
|
||||
history = prefs.paths.history
|
||||
try:
|
||||
lines = history.read_text().splitlines()
|
||||
last = lines[-1]
|
||||
current = Servers.record_to_fqip(self.record)
|
||||
return last == current
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def query_details(self, record: Servers.Record) -> None:
|
||||
details = Servers.get_details(record)
|
||||
if details.success is False:
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._server_timeout), destroy_first=True
|
||||
)
|
||||
return
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._present_details_dialog, details), destroy_first=True
|
||||
)
|
||||
|
||||
def _query_modlist(
|
||||
self, record: Servers.Record
|
||||
) -> tuple[list[list[str]], list[tuple[str, str, int, int]]]:
|
||||
mods = Servers.get_rules(record)
|
||||
steam_path = self.controller.query_config(Preferences.DEFAULT)
|
||||
local = get_local_mod_ids(steam_path)
|
||||
|
||||
alpha_mods: list[list[str]] = [
|
||||
[
|
||||
mod.name,
|
||||
str(mod.workshop_id),
|
||||
checkmark if mod.workshop_id in local else "",
|
||||
]
|
||||
for mod in mods
|
||||
]
|
||||
alpha_mods.sort(key=lambda x: x[0])
|
||||
|
||||
prefs = self.controller.get_prefs()
|
||||
version_file = prefs.paths.version
|
||||
|
||||
remote_mod_ids = [mod[1] for mod in alpha_mods]
|
||||
hashes = get_remote_signatures(remote_mod_ids)
|
||||
missing_mods = get_needs_update(version_file, hashes)
|
||||
for mod in alpha_mods:
|
||||
if any(mod[1] in tuple for tuple in missing_mods):
|
||||
mod[2] = resync
|
||||
|
||||
return alpha_mods, missing_mods
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def query_modlist_and_present(self, record: Servers.Record) -> None:
|
||||
try:
|
||||
mods, missing_mods = self._query_modlist(record)
|
||||
except Exception:
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._server_timeout), destroy_first=True
|
||||
)
|
||||
return
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._present_modlist_dialog, mods),
|
||||
destroy_first=True,
|
||||
)
|
||||
|
||||
def _present_modlist_dialog(self, mods: list[list[str]]) -> None:
|
||||
dialog = ServerModDialog(self.controller, mods)
|
||||
dialog.run()
|
||||
|
||||
def _present_details_dialog(self, details: Servers.Details) -> None:
|
||||
dialog = ServerDetailsDialog(self.controller, details)
|
||||
dialog.run()
|
||||
|
||||
def _server_timeout(self) -> None:
|
||||
dialog = ExceptionDialog(self.controller, server_timeout)
|
||||
dialog.run()
|
||||
|
||||
def _connect_steam(self, menu_only: bool) -> None:
|
||||
addr = f"{self.record.ip}:{self.record.gameport}"
|
||||
playername = self.controller.query_config(Preferences.NAME)
|
||||
if menu_only:
|
||||
rc = load_to_menu(self.client, self.appid, playername, self.remote_mod_ids)
|
||||
else:
|
||||
rc = connect(self.client, addr, self.appid, playername, self.remote_mod_ids)
|
||||
if rc != 0:
|
||||
# TODO: log/pop the error
|
||||
func = StoredFunc(self.controller.update_status)
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
return
|
||||
|
||||
self.thread_man.update_dialog(waiting_for_launch)
|
||||
while True:
|
||||
# FIXME: cancel should not be visible here per setting above
|
||||
if self.controller.is_cancel_pending():
|
||||
# TODO: some facility to also close spawned steam process
|
||||
return
|
||||
if is_dayz_running():
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
func = StoredFunc(self._add_to_history_and_return)
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
|
||||
def _add_to_history_and_return(self) -> None:
|
||||
self.controller.add_to_history(self.history, self.record)
|
||||
self.controller.open_page(NotebookPage.SERVERS)
|
||||
|
||||
def _update_mods(self, menu_only: bool = False) -> None:
|
||||
prefs = self.controller.get_prefs()
|
||||
config_man = self.controller.get_config_man()
|
||||
key = config_man.lookup(Preferences.STEAM)
|
||||
|
||||
for title, mod, stamp, size in self.missing_mods:
|
||||
if self.controller.is_cancel_pending():
|
||||
return
|
||||
subscribe(key, int(mod))
|
||||
time.sleep(API_RATE_LIMIT)
|
||||
|
||||
self.thread_man.update_dialog(waiting_for_directories)
|
||||
for title, mod, stamp, size in self.missing_mods:
|
||||
mod_path = self.workshop / mod
|
||||
|
||||
# NOTE: Steam updates mod chunks in parallel, will finish at the same time
|
||||
while mod_path.is_dir() is False:
|
||||
if self.controller.is_cancel_pending():
|
||||
return
|
||||
time.sleep(1)
|
||||
while True:
|
||||
if self.controller.is_cancel_pending():
|
||||
return
|
||||
cur_size = get_mod_dir_size(mod_path)
|
||||
if cur_size == size:
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
update_signatures(self.missing_mods, prefs.paths.version)
|
||||
rebuild_symlinks(prefs.paths.config)
|
||||
|
||||
# NOTE: update table status in main loop
|
||||
self.thread_man.update_emitter("all_mods_synched")
|
||||
|
||||
# TODO: just push steam path directly
|
||||
self._connect_steam(menu_only)
|
||||
|
||||
@call_on_thread(waiting_for_mods, show_cancel=True)
|
||||
def update_and_connect(self, menu_only: bool = False) -> None:
|
||||
if len(self.missing_mods) > 0:
|
||||
self._update_mods(menu_only)
|
||||
else:
|
||||
self._connect_steam(menu_only)
|
||||
@ -1,123 +0,0 @@
|
||||
import gi
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.const.enum import ContextMenu, Preferences
|
||||
from dzgui.util.clip import copy_clipboard
|
||||
from dzgui.util.open_links import open_workshop_page
|
||||
|
||||
from dzgui.views.dialogs.note import NoteDialog
|
||||
from dzgui.views.trees.tree_mods import ModTreeView, OfflineModTreeView
|
||||
from dzgui.views.trees.tree_log import LogTreeView
|
||||
from dzgui.views.trees.tree_servers import ServerTreeView
|
||||
from dzgui.views.trees.tree_server_mods import ServerModTreeView
|
||||
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, GLib, GObject # noqa E402
|
||||
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
|
||||
class ContextMenuManager:
|
||||
def __init__(
|
||||
self,
|
||||
treeview: (
|
||||
LogTreeView
|
||||
| ModTreeView
|
||||
| ServerTreeView
|
||||
| ServerModTreeView
|
||||
| OfflineModTreeView
|
||||
),
|
||||
controller: "Controller",
|
||||
) -> None:
|
||||
self.controller = controller
|
||||
self.treeview = treeview
|
||||
|
||||
def process(self, action: ContextMenu) -> None:
|
||||
if isinstance(self.treeview, ServerTreeView):
|
||||
record = self.treeview.get_record()
|
||||
if record is None:
|
||||
return
|
||||
|
||||
match action:
|
||||
# UNTHREADED
|
||||
case ContextMenu.ADD_NOTE:
|
||||
dialog = NoteDialog(self.controller)
|
||||
dialog.run()
|
||||
case ContextMenu.COPY_SERVER_IP:
|
||||
self.copy_server_ip()
|
||||
case ContextMenu.COPY_SERVER_NAME:
|
||||
self.copy_server_name()
|
||||
case ContextMenu.SET_FAV:
|
||||
name = self.treeview.get_value_at_index(0)
|
||||
# NOTE: fully qualified ip
|
||||
fqip = self.treeview.get_record_string()
|
||||
# NOTE: short ip for display purposes
|
||||
simple = self.treeview.get_simplified_ip()
|
||||
self.controller.set_fav(name, fqip, simple)
|
||||
|
||||
# THREADED
|
||||
case ContextMenu.ADD_SERVER:
|
||||
self.controller.add_by_record(record)
|
||||
case ContextMenu.CONNECT:
|
||||
self.controller.connect_by_record(record)
|
||||
case ContextMenu.REFRESH_PLAYERS:
|
||||
self.controller.refresh_players(record)
|
||||
case ContextMenu.REMOVE_HISTORY:
|
||||
self.controller.remove_from_history(record)
|
||||
case ContextMenu.REMOVE_SERVER:
|
||||
self.controller.remove_by_record(record)
|
||||
case ContextMenu.SHOW_DETAILS:
|
||||
self.controller.get_details(record)
|
||||
case ContextMenu.SHOW_MODS:
|
||||
self.controller.get_modlist(record)
|
||||
|
||||
if isinstance(self.treeview, (ModTreeView, OfflineModTreeView)):
|
||||
match action:
|
||||
case ContextMenu.UNSUB_MOD:
|
||||
self.controller.unsub_mods(self.treeview)
|
||||
case ContextMenu.OPEN_WORKSHOP:
|
||||
self.open_mod_page()
|
||||
|
||||
if isinstance(self.treeview, LogTreeView):
|
||||
match action:
|
||||
case ContextMenu.COPY_LOG_CLIPBOARD:
|
||||
self.copy_log()
|
||||
|
||||
if isinstance(self.treeview, ServerModTreeView):
|
||||
match action:
|
||||
case ContextMenu.OPEN_WORKSHOP:
|
||||
self.open_mod_page()
|
||||
|
||||
def copy_server_ip(self) -> None:
|
||||
if not isinstance(self.treeview, ServerTreeView):
|
||||
return
|
||||
record = self.treeview.get_simplified_ip()
|
||||
copy_clipboard(record)
|
||||
|
||||
def copy_server_name(self) -> None:
|
||||
name = self.treeview.get_value_at_index(0)
|
||||
if name is None:
|
||||
return
|
||||
copy_clipboard(name)
|
||||
|
||||
def open_mod_page(self) -> None:
|
||||
if not hasattr(self.treeview, "get_selected_mod"):
|
||||
return
|
||||
mod = self.treeview.get_selected_mod()
|
||||
cmd = self.controller.query_config(Preferences.CLIENT)
|
||||
open_workshop_page(mod, cmd)
|
||||
|
||||
def copy_log(self) -> None:
|
||||
if not isinstance(self.treeview, LogTreeView):
|
||||
return
|
||||
log = self.treeview.concatenate_rows()
|
||||
if log is None:
|
||||
return
|
||||
copy_clipboard(log)
|
||||
@ -1,107 +0,0 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.model.model_factory import ModelFactory
|
||||
from dzgui.util import strings
|
||||
from dzgui.util.strings import all_maps
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.model.model_factory import FastInsertListStore
|
||||
|
||||
|
||||
class FilterManager:
|
||||
def __init__(self, show_empty: bool = False, show_full: bool = False) -> None:
|
||||
|
||||
self.map_store = ModelFactory().make_map_store()
|
||||
|
||||
# TODO: namespace under own file: strings.filters
|
||||
self.default_filters = {
|
||||
strings.filter_1pp: True,
|
||||
strings.filter_day: True,
|
||||
strings.filter_empty: show_empty,
|
||||
strings.filter_3pp: True,
|
||||
strings.filter_night: True,
|
||||
strings.filter_full: show_full,
|
||||
strings.filter_lowpop: True,
|
||||
strings.filter_nonascii: False,
|
||||
strings.filter_duplicate: False,
|
||||
strings.filter_official: True,
|
||||
strings.filter_unofficial: True,
|
||||
strings.filter_modded: True,
|
||||
}
|
||||
|
||||
self.active_keyword = ""
|
||||
self.active_map = (0, all_maps)
|
||||
self.prior_map = all_maps
|
||||
|
||||
self.filters: list
|
||||
self.enabled_filters = dict(self.default_filters)
|
||||
|
||||
def set_prior_map(self, name: str) -> None:
|
||||
self.prior_map = name
|
||||
|
||||
def get_active_map_name(self) -> str:
|
||||
return self.active_map[1]
|
||||
|
||||
def get_active_map(self) -> tuple[int, str]:
|
||||
return self.active_map
|
||||
|
||||
def set_active_map(self, ind: int, name: str) -> None:
|
||||
self.active_map = (ind, name)
|
||||
|
||||
def get_active_keyword(self) -> str:
|
||||
return self.active_keyword
|
||||
|
||||
def set_active_keyword(self, word: str) -> None:
|
||||
self.active_keyword = word
|
||||
|
||||
def get_default_filters(self) -> dict:
|
||||
"""Deep copy of defaults"""
|
||||
return dict(self.default_filters)
|
||||
|
||||
def get_filters(self) -> dict:
|
||||
return self.enabled_filters
|
||||
|
||||
def set_filter(self, label: str, state: bool) -> None:
|
||||
self.enabled_filters[label] = state
|
||||
|
||||
def get_map_store(self) -> "FastInsertListStore":
|
||||
return self.map_store
|
||||
|
||||
def reinit_map_store(self) -> None:
|
||||
model = ModelFactory().make_map_store()
|
||||
model.append([all_maps])
|
||||
self.map_store = model
|
||||
self.active_map = (0, all_maps)
|
||||
|
||||
def append_map(self, row: list[str]) -> None:
|
||||
self.map_store.append(row)
|
||||
|
||||
def set_unique_maps(self, maps: list[str]) -> None:
|
||||
if maps is None:
|
||||
return
|
||||
if len(maps) < 1:
|
||||
self.reinit_map_store()
|
||||
return
|
||||
|
||||
self.reinit_map_store()
|
||||
maps.sort()
|
||||
for m in maps:
|
||||
if m == "All maps":
|
||||
continue
|
||||
self.append_map([m])
|
||||
|
||||
# TODO: currently unused
|
||||
def get_unique_maps(self) -> list[str]:
|
||||
return [row[0] for row in self.map_store if row[0] != "All maps"]
|
||||
|
||||
def get_all_filters(self) -> tuple:
|
||||
map_name = self.get_active_map_name()
|
||||
enabled = self.get_filters()
|
||||
kw = self.get_active_keyword()
|
||||
filters = []
|
||||
filters.append(map_name)
|
||||
filters.append(kw)
|
||||
for filt in enabled:
|
||||
if enabled[filt] is False:
|
||||
filters.append(filt)
|
||||
return tuple(filters)
|
||||
@ -1,229 +0,0 @@
|
||||
import logging
|
||||
import time
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.api.steam import unsubscribe
|
||||
from dzgui.api.mods import (
|
||||
get_delimited_mods,
|
||||
find_stale_mods,
|
||||
_hash,
|
||||
remove_stale_signatures,
|
||||
)
|
||||
from dzgui.const.constants import (
|
||||
API_RATE_LIMIT,
|
||||
APP_NAME,
|
||||
APPID_DAYZ,
|
||||
APPID_DAYZ_EXP,
|
||||
)
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.model.model_factory import FastInsertListStore, ModelFactory
|
||||
from dzgui.strings import dialogs
|
||||
from dzgui.util.format import format_mods
|
||||
from dzgui.util.strings import server_timeout
|
||||
from dzgui.util.symlink import rebuild_symlinks
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
|
||||
|
||||
import dzgui.api.pefile as PeFile
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
class ModManager:
|
||||
"""
|
||||
Because mods may be dynamically updated on the system,
|
||||
this manager is instantiated each time the Mods page is opened
|
||||
"""
|
||||
|
||||
def __init__(self, tree: Gtk.TreeView, controller: "Controller") -> None:
|
||||
self.treeview = tree
|
||||
self.controller = controller
|
||||
|
||||
self.emitter = controller.get_emitter()
|
||||
self.prefs = controller.get_prefs()
|
||||
self.path = controller.query_config(Preferences.DEFAULT)
|
||||
|
||||
self.store: FastInsertListStore | None = None
|
||||
|
||||
self.thread_man = ThreadingManager(controller)
|
||||
|
||||
@call_on_thread(dialogs.fetching_mods)
|
||||
def load_mods(self) -> None:
|
||||
mods = get_delimited_mods(self.path)
|
||||
if len(mods) < 1:
|
||||
msg = self.format_mod_statusbar()
|
||||
func = StoredFunc(lambda: self.emitter.emit("mods_updated", msg, 0))
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
return
|
||||
|
||||
prefs = self.controller.get_prefs()
|
||||
rebuild_symlinks(prefs.paths.config)
|
||||
|
||||
self.store = ModelFactory().make_mod_store()
|
||||
self.store.extend(mods)
|
||||
func = StoredFunc(self._on_mods_loaded)
|
||||
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
|
||||
def set_store(self, store: "FastInsertListStore") -> None:
|
||||
self.store = store
|
||||
|
||||
def _on_mods_loaded(self) -> None:
|
||||
self.treeview.set_model(self.store)
|
||||
if self.store is None:
|
||||
return
|
||||
msg = self.format_mod_statusbar()
|
||||
total_mods = len(self.store)
|
||||
self.emitter.emit("mods_updated", msg, total_mods)
|
||||
|
||||
def unsub_mods(self) -> None:
|
||||
sel = self.treeview.get_selection()
|
||||
model, pathlist = sel.get_selected_rows()
|
||||
# NOTE: reverse when multiple selection
|
||||
mods: list[tuple[str, Gtk.TreeIter]] = []
|
||||
for path in reversed(pathlist):
|
||||
res = self.get_mod_from_tree_path(path)
|
||||
if res is None:
|
||||
continue
|
||||
mod, _iter = res
|
||||
mods.append((mod, _iter))
|
||||
self.thread_man.set_job_count(len(mods))
|
||||
self.unsub_all_mods(mods)
|
||||
|
||||
def get_mod_from_tree_path(
|
||||
self, tree_path: Gtk.TreePath
|
||||
) -> tuple[str, Gtk.TreeIter] | None:
|
||||
model = self.treeview.get_model()
|
||||
if model is None:
|
||||
return None
|
||||
tree_iter = model.get_iter(tree_path)
|
||||
mod = model.get_value(tree_iter, 2)
|
||||
return mod, tree_iter
|
||||
|
||||
@call_on_thread(dialogs.deleting_mods)
|
||||
def unsub_all_mods(self, mods: list[tuple[str, Gtk.TreeIter]]) -> None:
|
||||
for mod, _iter in mods:
|
||||
self.unsub_atomic_mod(mod)
|
||||
self.thread_man.increment_dialog()
|
||||
time.sleep(API_RATE_LIMIT)
|
||||
|
||||
func = StoredFunc(self._on_mods_unsubbed, mods)
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
|
||||
def unsub_atomic_mod(self, mod: str) -> None:
|
||||
config_man = self.controller.get_config_man()
|
||||
key = config_man.lookup(Preferences.STEAM)
|
||||
unsubscribe(key, int(mod))
|
||||
|
||||
steam_path = Path(self.path)
|
||||
app_path = PeFile.get_nested_app_path(steam_path, APPID_DAYZ)
|
||||
|
||||
try:
|
||||
md5 = _hash(mod)
|
||||
symlink = app_path / md5
|
||||
symlink.unlink()
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
# NOTE: second pass to unlink DAYZ_EXP mods
|
||||
# TODO: test this with working APPID_DAYZ_EXP installation
|
||||
try:
|
||||
app_path_exp = PeFile.get_nested_app_path(steam_path, APPID_DAYZ_EXP)
|
||||
symlink = app_path_exp / md5
|
||||
symlink.unlink()
|
||||
except PeFile.AppNotInstalledError:
|
||||
pass
|
||||
time.sleep(API_RATE_LIMIT)
|
||||
|
||||
def _on_mods_unsubbed(self, mod_iter: list[tuple[str, Gtk.TreeIter]]) -> None:
|
||||
mods = [int(mod) for mod, _iter in mod_iter]
|
||||
iters = [_iter for mod, _iter in mod_iter]
|
||||
if self.store is None:
|
||||
return
|
||||
for _iter in iters:
|
||||
self.store.remove(_iter)
|
||||
# TODO: process config path in called function
|
||||
remove_stale_signatures(self.prefs.paths.config, self.prefs.paths.version, mods)
|
||||
model = self.treeview.get_model()
|
||||
if model is None:
|
||||
return
|
||||
total_mods = len(model)
|
||||
msg = self.format_mod_statusbar()
|
||||
self.emitter.emit("mods_updated", msg, total_mods)
|
||||
|
||||
def uncolorize_mods(self) -> None:
|
||||
model = self.treeview.get_model()
|
||||
if model is None:
|
||||
return
|
||||
for mod in model:
|
||||
_iter = mod.iter
|
||||
path = model.get_path(_iter)
|
||||
model[path][4] = None
|
||||
path = Gtk.TreePath.new_from_indices([0])
|
||||
self.treeview.set_cursor(path)
|
||||
|
||||
def toggle_mod_selection(self, state: bool) -> None:
|
||||
sel = self.treeview.get_selection()
|
||||
if state:
|
||||
sel.select_all()
|
||||
else:
|
||||
sel.unselect_all()
|
||||
self.treeview.grab_focus()
|
||||
|
||||
def format_mod_statusbar(self) -> str:
|
||||
total_mods, total_size = self.calc_mod_size()
|
||||
msg = format_mods(total_size, total_mods)
|
||||
return msg
|
||||
|
||||
def calc_mod_size(self) -> tuple[int, int]:
|
||||
model = self.treeview.get_model()
|
||||
if model is None:
|
||||
return 0, 0
|
||||
total_mods = len(model)
|
||||
total_size = 0
|
||||
for mod in model:
|
||||
total_size += mod[3]
|
||||
return total_mods, total_size
|
||||
|
||||
def _on_stale_mods_found(self, stale_mods: list) -> None:
|
||||
"""Manipulates attached ListStore in the main event loop"""
|
||||
model = self.treeview.get_model()
|
||||
if model is None:
|
||||
return
|
||||
for mod in model:
|
||||
it = mod.iter
|
||||
path = model.get_path(it)
|
||||
if int(mod[2]) in stale_mods:
|
||||
model[path][4] = True
|
||||
self.emitter.emit("mods_highlighted")
|
||||
|
||||
@call_on_thread(dialogs.scanning_mods)
|
||||
def highlight_stale(self) -> None:
|
||||
stale = find_stale_mods(self.prefs.paths.config)
|
||||
func = StoredFunc(self._on_stale_mods_found, stale)
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
|
||||
def _server_timeout(self) -> None:
|
||||
dialog = ExceptionDialog(self.controller, server_timeout)
|
||||
dialog.run()
|
||||
|
||||
def select_colorized(self) -> None:
|
||||
model = self.treeview.get_model()
|
||||
if model is None:
|
||||
return
|
||||
sel = self.treeview.get_selection()
|
||||
for mod in model:
|
||||
it = mod.iter
|
||||
path = model.get_path(it)
|
||||
if mod[4] is True:
|
||||
sel.select_path(path)
|
||||
@ -1,45 +0,0 @@
|
||||
import json
|
||||
import logging
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.util._json import read_json
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
class NoteManager:
|
||||
def __init__(self, controller: "Controller", path: "Path") -> None:
|
||||
self.notes_path = path
|
||||
try:
|
||||
self.cache: dict[str, str] = read_json(self.notes_path)
|
||||
except Exception:
|
||||
self.cache = {}
|
||||
|
||||
def add_note(self, server: str, note: str) -> None:
|
||||
self.cache[server] = note
|
||||
self.write_file()
|
||||
|
||||
def delete_note(self, server: str) -> None:
|
||||
del self.cache[server]
|
||||
self.write_file()
|
||||
|
||||
def get_note(self, server: str) -> str:
|
||||
try:
|
||||
text = self.cache[server]
|
||||
return text
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
def write_file(self) -> None:
|
||||
j = json.dumps(self.cache, indent=2)
|
||||
self.notes_path.write_text(j)
|
||||
@ -1,134 +0,0 @@
|
||||
import logging
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Callable, TYPE_CHECKING, Union
|
||||
|
||||
import dzgui.api.pefile as PeFile
|
||||
from dzgui.api.mods import is_mission, get_custom_mods
|
||||
from dzgui.api.steam import launch_offline
|
||||
from dzgui.const.constants import APP_NAME, APPID_DAYZ_EXP
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.init.proc import is_dayz_running
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.model.model_factory import ModelFactory
|
||||
from dzgui.strings import dialogs
|
||||
from dzgui.util.symlink import create_custom_symlinks, rebuild_symlinks, symlink_mission
|
||||
from dzgui.views.dialogs.filepicker import FolderPicker
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
from dzgui.model.model_factory import FastInsertListStore
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
class OfflineManager:
|
||||
def __init__(
|
||||
self,
|
||||
controller: "Controller",
|
||||
) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.controller = controller
|
||||
self.emitter = controller.get_emitter()
|
||||
self.thread_man = ThreadingManager(controller)
|
||||
|
||||
self.appid: int
|
||||
self.local_mods: list[str] | None
|
||||
self.custom_mods: list[str] | None
|
||||
|
||||
# TODO: more robust test
|
||||
def is_custom_folder_valid(self, folder: str) -> bool:
|
||||
return Path(folder).exists()
|
||||
|
||||
# TODO: set properties as members of offline manager on demand and check them here
|
||||
# rather than passing strings again
|
||||
def is_mission_valid(self, folder: str) -> bool:
|
||||
return is_mission(Path(folder))
|
||||
|
||||
def get_mission(self) -> None:
|
||||
folder = self.open_folderpicker(dialogs.mission_dialog)
|
||||
if folder is None:
|
||||
return
|
||||
is_valid = is_mission(folder)
|
||||
self.emitter.emit("custom_mission_loaded", str(folder), is_valid)
|
||||
|
||||
def find_custom_mods(self, callback: Callable) -> None:
|
||||
folder = self.open_folderpicker(dialogs.custom_mod_dialog)
|
||||
window = self.controller.get_window()
|
||||
window.set_sensitive(False)
|
||||
if folder is None:
|
||||
window.set_sensitive(True)
|
||||
return
|
||||
# NOTE: starts spinner in calling UI
|
||||
callback()
|
||||
self.parse_custom_mods(folder)
|
||||
|
||||
@call_on_thread(dialogs.parsing_mods, show_dialog=False)
|
||||
def parse_custom_mods(self, folder: str) -> None:
|
||||
mods = get_custom_mods(Path(folder))
|
||||
store = ModelFactory().make_mod_store()
|
||||
store.extend(mods)
|
||||
func = StoredFunc(self.post_mod_loading, store, folder)
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
|
||||
def post_mod_loading(self, store: "FastInsertListStore", folder: str) -> None:
|
||||
window = self.controller.get_window()
|
||||
window.set_sensitive(True)
|
||||
self.emitter.emit("custom_mods_loaded", store, folder)
|
||||
|
||||
@call_on_thread(dialogs.waiting_for_launch)
|
||||
def launch(
|
||||
self,
|
||||
appid: int,
|
||||
mission: str,
|
||||
local_mods: list[str],
|
||||
custom_folder: str,
|
||||
custom_mods: list[str],
|
||||
) -> None:
|
||||
|
||||
# NOTE: local_mods and custom_mods are lists of symlinks
|
||||
client = self.controller.query_config(Preferences.CLIENT)
|
||||
name = self.controller.query_config(Preferences.NAME)
|
||||
steam_path = self.controller.query_config(Preferences.DEFAULT)
|
||||
|
||||
combined_mods: list[str] = []
|
||||
|
||||
if len(local_mods) > 0:
|
||||
combined_mods.extend(local_mods)
|
||||
config = self.controller.get_prefs().paths.config
|
||||
rebuild_symlinks(config)
|
||||
|
||||
if len(custom_mods) > 0:
|
||||
new_symlinks = create_custom_symlinks(
|
||||
Path(steam_path), Path(custom_folder), custom_mods
|
||||
)
|
||||
combined_mods.extend(new_symlinks)
|
||||
|
||||
relative_link = ""
|
||||
if len(mission) > 0:
|
||||
relative_link = symlink_mission(Path(steam_path), mission)
|
||||
|
||||
launch_offline(client, appid, name, combined_mods, relative_link)
|
||||
while True:
|
||||
if is_dayz_running():
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
def open_folderpicker(self, title: str) -> Union["Path", None]:
|
||||
picker = FolderPicker(self.controller.get_window(), title)
|
||||
folder = picker.pick_folder()
|
||||
picker.destroy()
|
||||
return folder
|
||||
|
||||
def has_dayz_exp(self) -> bool:
|
||||
try:
|
||||
default_steam_path = self.controller.query_config(Preferences.DEFAULT)
|
||||
steam_path = Path(default_steam_path)
|
||||
dayz_exp = PeFile.get_pretty_version(steam_path, APPID_DAYZ_EXP)
|
||||
if dayz_exp is None:
|
||||
return False
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
return False
|
||||
@ -1,132 +0,0 @@
|
||||
import inspect
|
||||
import logging
|
||||
import threading
|
||||
from typing import Any, Literal, TYPE_CHECKING, Union
|
||||
|
||||
from functools import wraps
|
||||
from typing import Callable
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.views.dialogs.generic import WaitDialog
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def call_on_thread(
|
||||
dialog_str: str, show_dialog: bool = True, show_cancel: bool = False
|
||||
) -> Callable:
|
||||
def decorator(func: Callable) -> Callable:
|
||||
@wraps(func)
|
||||
def wrapper(*args: Any, **kwargs: Any) -> None:
|
||||
self = args[0]
|
||||
stored = StoredFunc(func, *args, **kwargs)
|
||||
if not hasattr(self, "thread_man"):
|
||||
raise AttributeError(f"Object '{self}' has no attribute 'thread_man'")
|
||||
if type(self.thread_man) is not ThreadingManager:
|
||||
raise TypeError(
|
||||
"Attribute 'thread_man' must be of type 'ThreadingManager'"
|
||||
)
|
||||
self.thread_man.call_on_thread(dialog_str, stored, show_dialog, show_cancel)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
class StoredFunc:
|
||||
def __init__(self, func: Callable, *args: Any, **kwargs: Any) -> None:
|
||||
sig = inspect.signature(func)
|
||||
self.func = func
|
||||
self.bindings = sig.bind(*args, **kwargs)
|
||||
|
||||
def call(self) -> Any:
|
||||
return self.func(*self.bindings.args, *self.bindings.kwargs)
|
||||
|
||||
|
||||
class ThreadingManager:
|
||||
def __init__(self, controller: Union["Controller", None]) -> None:
|
||||
self.controller = controller
|
||||
self.jobs = 1
|
||||
self.cleanup_func: StoredFunc | None = None
|
||||
self.destroy_first = False
|
||||
|
||||
def call_on_thread(
|
||||
self,
|
||||
dialog_str: str,
|
||||
func: StoredFunc,
|
||||
show_dialog: bool = True,
|
||||
show_cancel: bool = False,
|
||||
) -> None:
|
||||
def callback() -> None:
|
||||
func.call()
|
||||
GLib.idle_add(self._destroy_on_idle)
|
||||
|
||||
if show_dialog is True and self.controller is not None:
|
||||
self.wait_dialog = WaitDialog(
|
||||
self.controller, dialog_str, jobs=self.jobs, show_cancel=show_cancel
|
||||
)
|
||||
self.wait_dialog.show_all()
|
||||
|
||||
thread = threading.Thread(target=callback)
|
||||
thread.start()
|
||||
|
||||
def set_job_count(self, jobs: int) -> None:
|
||||
self.jobs = jobs
|
||||
|
||||
def update_emitter(self, signal: str) -> None:
|
||||
if self.controller:
|
||||
emitter = self.controller.get_emitter()
|
||||
GLib.idle_add(lambda: emitter.emit(signal))
|
||||
|
||||
def update_dialog(self, msg: str) -> None:
|
||||
GLib.idle_add(lambda: self.wait_dialog.update_text(msg))
|
||||
|
||||
def increment_dialog(self) -> None:
|
||||
GLib.idle_add(self.wait_dialog.increment)
|
||||
|
||||
def increment_dialog_with_str(self, text: str) -> None:
|
||||
GLib.idle_add(lambda: self.wait_dialog.increment(text))
|
||||
|
||||
def set_cleanup_func(
|
||||
self, func: StoredFunc | None, destroy_first: bool = False
|
||||
) -> None:
|
||||
if type(func) not in (StoredFunc, type(None)):
|
||||
msg = f"Callback function '{func}' is not of type StoredFunc or None"
|
||||
logger.critical(msg)
|
||||
raise TypeError(msg)
|
||||
self.destroy_first = destroy_first
|
||||
self.cleanup_func = func
|
||||
|
||||
def get_cleanup_func(self) -> StoredFunc | None:
|
||||
return self.cleanup_func
|
||||
|
||||
def destroy_dialog(self) -> None:
|
||||
if hasattr(self, "wait_dialog"):
|
||||
self.wait_dialog.destroy()
|
||||
|
||||
def _destroy_on_idle(self) -> Literal[False]:
|
||||
if self.destroy_first:
|
||||
self.destroy_dialog()
|
||||
|
||||
func = self.get_cleanup_func()
|
||||
if func is not None:
|
||||
self.set_cleanup_func(None)
|
||||
func.call()
|
||||
if not self.destroy_first:
|
||||
self.destroy_dialog()
|
||||
|
||||
return False
|
||||
|
||||
def get_wait_dialog(self) -> WaitDialog:
|
||||
return self.wait_dialog
|
||||
|
||||
def show_cancel(self, state: bool) -> None:
|
||||
GLib.idle_add(self.wait_dialog.show_cancel, state)
|
||||
@ -1,67 +0,0 @@
|
||||
import logging
|
||||
import requests
|
||||
import shutil
|
||||
import subprocess
|
||||
import tarfile
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import (
|
||||
APP_NAME,
|
||||
TMP_EXE,
|
||||
TMP_PATH,
|
||||
TMP_TARBALL,
|
||||
)
|
||||
from dzgui.strings import dialogs
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog, QuitDialog
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
class UpdateManager:
|
||||
def __init__(self, controller: "Controller") -> None:
|
||||
|
||||
self.thread_man = ThreadingManager(controller)
|
||||
self.controller = controller
|
||||
|
||||
@call_on_thread(dialogs.fetching_update)
|
||||
def update_version(self, exe_path: str, url: str) -> None:
|
||||
try:
|
||||
res = requests.get(url)
|
||||
if res.status_code == 200:
|
||||
with open(TMP_TARBALL, "wb") as file:
|
||||
file.write(res.content)
|
||||
with tarfile.open(TMP_TARBALL) as tar:
|
||||
tar.extractall(TMP_PATH)
|
||||
|
||||
shutil.copy(TMP_EXE, exe_path)
|
||||
|
||||
proc = subprocess.run([exe_path, "self", "restore"])
|
||||
if proc.returncode == 0:
|
||||
func = StoredFunc(self._on_update_success)
|
||||
self.thread_man.set_cleanup_func(func, destroy_first=True)
|
||||
else:
|
||||
msg = dialogs.failed_to_update
|
||||
func = StoredFunc(self._on_update_failure, msg)
|
||||
self.thread_man.set_cleanup_func(func, destroy_first=True)
|
||||
except Exception as e:
|
||||
func = StoredFunc(self._on_update_failure, str(e))
|
||||
self.thread_man.set_cleanup_func(func, destroy_first=True)
|
||||
logger.warning(e)
|
||||
|
||||
def _on_update_success(self) -> None:
|
||||
msg = dialogs.update_success
|
||||
dialog = QuitDialog(self.controller, msg)
|
||||
dialog.run()
|
||||
|
||||
def _on_update_failure(self, msg: str) -> None:
|
||||
dialog = ExceptionDialog(self.controller, msg)
|
||||
dialog.run()
|
||||
@ -1,170 +0,0 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Sequence, TYPE_CHECKING
|
||||
|
||||
from dzgui.const.enum import HELP_MENU_ROWS
|
||||
from dzgui.util.redact import redact_log
|
||||
from dzgui.util.strings import delimiter
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository.Gtk import ListStore, TreeIter # noqa E402
|
||||
from gi.repository import GObject # noqa E402
|
||||
|
||||
GTYPE_TO_PYTHON = {
|
||||
GObject.type_from_name(GObject.type_name(ptype)): ptype
|
||||
for ptype in (int, float, str, bool, object)
|
||||
}
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class ServerCols:
|
||||
name: str
|
||||
_map: str
|
||||
perspective: str
|
||||
gametime: str
|
||||
players: int
|
||||
_max: int
|
||||
queue: int
|
||||
ip: str
|
||||
qport: int
|
||||
ping: int
|
||||
provider: str
|
||||
modded: bool
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class ModCols:
|
||||
name: str
|
||||
symlink: str
|
||||
directory: str
|
||||
size: float
|
||||
color: bool
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class LogCols:
|
||||
timestamp: str
|
||||
flag: str
|
||||
traceback: str
|
||||
msg: str
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class ServerModCols:
|
||||
name: str
|
||||
uid: str
|
||||
installed: str
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class MenuCols:
|
||||
name: str
|
||||
hidden: object
|
||||
|
||||
|
||||
class FastInsertListStore(ListStore):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def _is_same_length(self, lists: Sequence[Any]) -> bool:
|
||||
first_len = len(lists[0])
|
||||
if not all(len(sublist) == first_len for sublist in lists):
|
||||
return False
|
||||
return True
|
||||
|
||||
def _is_type_homogeneous(self, lists: Sequence[Any]) -> bool:
|
||||
transposed = zip(*lists)
|
||||
|
||||
for column in transposed:
|
||||
first_type = type(column[0])
|
||||
if not all(type(item) is first_type for item in column):
|
||||
return False
|
||||
return True
|
||||
|
||||
def extend(self, rows: Sequence[Any]) -> None:
|
||||
"""
|
||||
Compared to calling append() directly, introduces negligible overhead,
|
||||
but guarantees type and length equivalence prior to insertion
|
||||
"""
|
||||
n_cols = self.get_n_columns()
|
||||
expected_types = [
|
||||
GTYPE_TO_PYTHON[self.get_column_type(i)] for i in range(n_cols)
|
||||
]
|
||||
if len(rows) == 0:
|
||||
return
|
||||
if not self._is_same_length(rows):
|
||||
raise ValueError("Sublists are not of uniform length")
|
||||
if not self._is_type_homogeneous(rows):
|
||||
raise TypeError("Sublists are not type homogeneous")
|
||||
if not all(isinstance(a, b) for a, b in zip(rows[0], expected_types)):
|
||||
raise TypeError("Sublist types are not same as ListStore")
|
||||
if len(rows[0]) != n_cols:
|
||||
raise ValueError("Sublist column length is not same as ListStore")
|
||||
|
||||
for row in rows:
|
||||
self.append(row)
|
||||
|
||||
def append(self, row: list[Any] | tuple[Any, ...] | None = ...) -> TreeIter: # type: ignore
|
||||
"""
|
||||
Optimized for speed, but makes no assurances about row homogeneity
|
||||
and may segfault if types and length are not identical to ListStore.
|
||||
For this reason, it is recommended to use the extend() method to insert
|
||||
an entire list of lists
|
||||
"""
|
||||
if row is not None:
|
||||
total = len(row)
|
||||
i = len(self)
|
||||
tree_iter = self.insert_with_values(i, tuple(range(total)), row)
|
||||
else:
|
||||
tree_iter = super().append(row)
|
||||
return tree_iter
|
||||
|
||||
|
||||
class ModelFactory:
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def new_model_from_logfile(self, path: "Path") -> FastInsertListStore:
|
||||
store = self.make_log_store()
|
||||
with open(path, "r") as f:
|
||||
lines = [line.split(delimiter) for line in f.read().splitlines()]
|
||||
for record in lines:
|
||||
# NOTE: strips PII and API keys
|
||||
clean = redact_log(record)
|
||||
store.append(clean)
|
||||
return store
|
||||
|
||||
def new_model_from_class(self, cls: type) -> FastInsertListStore:
|
||||
store = FastInsertListStore(
|
||||
*[ftype for field, ftype in cls.__annotations__.items()]
|
||||
)
|
||||
return store
|
||||
|
||||
def make_map_store(self) -> FastInsertListStore:
|
||||
return FastInsertListStore(str)
|
||||
|
||||
def make_help_store(self) -> FastInsertListStore:
|
||||
store = self.new_model_from_class(MenuCols)
|
||||
rows = [[row.dict["label"], row] for row in HELP_MENU_ROWS]
|
||||
store.extend(rows)
|
||||
return store
|
||||
|
||||
def make_mod_store(self) -> FastInsertListStore:
|
||||
return self.new_model_from_class(ModCols)
|
||||
|
||||
def make_log_store(self) -> FastInsertListStore:
|
||||
return self.new_model_from_class(LogCols)
|
||||
|
||||
def make_server_mod_store(self) -> FastInsertListStore:
|
||||
return self.new_model_from_class(ServerModCols)
|
||||
|
||||
def make_server_store(self) -> FastInsertListStore:
|
||||
return self.new_model_from_class(ServerCols)
|
||||
|
||||
# def convert_model_to_list(self, model: "FastInsertListStore") -> list:
|
||||
# return [[el for el in row] for row in model]
|
||||
@ -1,301 +0,0 @@
|
||||
import re
|
||||
|
||||
from typing import Any, TYPE_CHECKING, Union
|
||||
from warnings import deprecated
|
||||
|
||||
from dzgui.const.enum import FilterMode
|
||||
from dzgui.model.model_factory import ModelFactory
|
||||
from dzgui.util import strings
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.managers.filter import FilterManager
|
||||
from dzgui.model.model_factory import FastInsertListStore
|
||||
from dzgui.api.servers import Record
|
||||
from dzgui.model.servers import NewPlayerCount
|
||||
|
||||
|
||||
class ProxyModelManager:
|
||||
"""
|
||||
Manages access to cached FastInsertListStore resources and
|
||||
performs filtering on behalf of atomic TreeViews,
|
||||
which share the same column structure.
|
||||
|
||||
A ProxyModelManager is attached to each ServerTreeView.
|
||||
|
||||
Raw data is cached before being packed into a FastInsertListStore, see get_control()
|
||||
Filtration creates a proxy of the TreeView's model, see get_proxy_model()
|
||||
"""
|
||||
|
||||
def __init__(self, filter_man: "FilterManager") -> None:
|
||||
self.filter_cache: dict[
|
||||
tuple[str],
|
||||
list[tuple[str, str, str, str, int, int, int, str, int, int, str, bool]],
|
||||
] = {}
|
||||
|
||||
self.proxy_model: "FastInsertListStore"
|
||||
self.filter_man = filter_man
|
||||
|
||||
self.control_model: (
|
||||
list[tuple[str, str, str, str, int, int, int, str, int, int, str, bool]]
|
||||
| None
|
||||
) = None
|
||||
self.filtered: list[
|
||||
tuple[str, str, str, str, int, int, int, str, int, int, str, bool]
|
||||
] = []
|
||||
self.success = True
|
||||
|
||||
def has_control_model(self) -> bool:
|
||||
if self.control_model is None:
|
||||
return False
|
||||
return True
|
||||
|
||||
def append_row(self, row: list) -> None:
|
||||
self.proxy_model.append(row)
|
||||
|
||||
def append_row_to_control(
|
||||
self, row: tuple[str, str, str, str, int, int, int, str, int, int, str, bool]
|
||||
) -> None:
|
||||
if self.control_model is None:
|
||||
raise AttributeError("Trying to add rows to a non-existent model")
|
||||
self.control_model.append(row)
|
||||
self.filter(FilterMode.INITIAL, skip_cache=True)
|
||||
|
||||
def update_playercount(self, playercount: "NewPlayerCount") -> None:
|
||||
treeiter = playercount.treeiter
|
||||
self.proxy_model[treeiter][4] = playercount.players
|
||||
self.proxy_model[treeiter][6] = playercount.queue
|
||||
|
||||
# TODO: use dataclass for record rows
|
||||
def append_row_to_history(
|
||||
self,
|
||||
history: tuple[str, str, str, str, int, int, int, str, int, int, str, bool],
|
||||
) -> None:
|
||||
addr = history[7]
|
||||
qport = history[8]
|
||||
|
||||
if self.control_model is None:
|
||||
raise AttributeError("Trying to append row to empty model")
|
||||
found = False
|
||||
for i, row in enumerate(self.control_model):
|
||||
if addr == row[7] and qport == row[8]:
|
||||
item = self.control_model.pop(i)
|
||||
self.control_model.append(item)
|
||||
found = True
|
||||
break
|
||||
|
||||
if found is False:
|
||||
self.control_model.append(history)
|
||||
|
||||
# if len(self.control_model) == 11:
|
||||
# del self.control_model[0]
|
||||
|
||||
self.filter(FilterMode.INITIAL, skip_cache=True)
|
||||
|
||||
def remove_row_from_control(self, record: "Record") -> None:
|
||||
if self.control_model is None:
|
||||
return
|
||||
addr = f"{record.ip}:{record.gameport}"
|
||||
qport = record.qport
|
||||
for row in self.control_model:
|
||||
if addr == row[7] and qport == row[8]:
|
||||
self.control_model.remove(row)
|
||||
break
|
||||
self.wipe_cache()
|
||||
self.filter(FilterMode.INITIAL, skip_cache=True)
|
||||
|
||||
def clear_proxy_model(self) -> None:
|
||||
self.proxy_model.clear()
|
||||
|
||||
def get_proxy_model(self) -> Union["FastInsertListStore", None]:
|
||||
if hasattr(self, "proxy_model"):
|
||||
return self.proxy_model
|
||||
return None
|
||||
|
||||
def filter(
|
||||
self, mode: FilterMode, skip_cache: bool = False
|
||||
) -> Union["FastInsertListStore", None]:
|
||||
"""
|
||||
Native Gtk.TreeView.refilter() method was not performant enough
|
||||
when running in the main loop with 40k+ records
|
||||
|
||||
skip_cache: used when updating a record on Saved Servers/History and forcing a refilter
|
||||
"""
|
||||
# TODO: filter cache: return a dataclass object with clearly enumerated map, keyword, and filter values
|
||||
# instead of just a serial list of strings
|
||||
filters = self.filter_man.get_all_filters()
|
||||
|
||||
if skip_cache is False:
|
||||
if filters in self.filter_cache:
|
||||
cached_rows = self.filter_cache[filters]
|
||||
clone = ModelFactory().make_server_store()
|
||||
clone.extend(cached_rows)
|
||||
self.set_proxy_model(clone)
|
||||
self.set_filtered(cached_rows)
|
||||
return None
|
||||
|
||||
match mode:
|
||||
case FilterMode.INITIAL:
|
||||
rows = self.filter_initial(filters)
|
||||
case FilterMode.TOGGLE_ON:
|
||||
rows = self.filter_toggle_on(filters)
|
||||
case FilterMode.TOGGLE_OFF:
|
||||
for f in filters[2:]:
|
||||
self.set_filtered(self.filter_toggle_off(filters, f))
|
||||
rows = self.filtered
|
||||
|
||||
# NOTE: FastInsertListStore manipulation must remain local to the thread
|
||||
clone = ModelFactory().make_server_store()
|
||||
if len(rows) > 0:
|
||||
rows = self.sort_rows(rows)
|
||||
clone.extend(rows)
|
||||
|
||||
self.set_cache(filters, rows)
|
||||
self.set_proxy_model(clone)
|
||||
return clone
|
||||
|
||||
def sort_rows(self, rows: list) -> list:
|
||||
rows.sort(key=lambda x: re.sub(r"[^A-Za-z0-9]+", "", x[0].lower()))
|
||||
return rows
|
||||
|
||||
def filter_initial(self, filters: tuple) -> list:
|
||||
"""
|
||||
Simply culls the control model of any disabled filters
|
||||
"""
|
||||
self.set_filtered(self.control_model)
|
||||
for f in filters[2:]:
|
||||
self.set_filtered(self.filter_toggle_off(filters, f))
|
||||
return self.filtered
|
||||
|
||||
def filter_map(self, filters: tuple) -> list:
|
||||
"""
|
||||
Multi-filtration for any context starts by narrowing by map
|
||||
"""
|
||||
rows = self.filtered
|
||||
sel_map = self.filter_man.get_active_map_name()
|
||||
|
||||
if sel_map == strings.all_maps:
|
||||
return rows
|
||||
|
||||
rows = [row for row in rows if row[1] == sel_map]
|
||||
return rows
|
||||
|
||||
def filter_keyword(self, filters: tuple) -> list:
|
||||
keyword = self.filter_man.get_active_keyword()
|
||||
rows = self.filtered
|
||||
|
||||
if keyword == "":
|
||||
return rows
|
||||
|
||||
filtered = [
|
||||
row
|
||||
for row in rows
|
||||
if keyword in row[0].lower()
|
||||
or keyword in row[1].lower()
|
||||
or keyword in row[7].lower()
|
||||
]
|
||||
return filtered
|
||||
|
||||
def filter_toggle_off(self, filters: tuple, filter_type: str) -> list:
|
||||
"""
|
||||
Sub-filtration of the current model
|
||||
"""
|
||||
pairs = {
|
||||
strings.filter_3pp: strings.filter_1pp,
|
||||
strings.filter_day: strings.filter_night,
|
||||
strings.filter_official: strings.filter_unofficial,
|
||||
}
|
||||
for k, v in pairs.items():
|
||||
if k in filters and v in filters:
|
||||
self.set_filtered(None)
|
||||
return []
|
||||
|
||||
rows = self.filtered
|
||||
match filter_type:
|
||||
case strings.filter_3pp:
|
||||
rows = [row for row in rows if row[2] != strings.filter_3pp]
|
||||
case strings.filter_1pp:
|
||||
rows = [row for row in rows if row[2] != strings.filter_1pp]
|
||||
case strings.filter_official:
|
||||
rows = [row for row in rows if row[10] != strings.filter_official]
|
||||
case strings.filter_unofficial:
|
||||
rows = [row for row in rows if row[10] != strings.filter_unofficial]
|
||||
case strings.filter_empty:
|
||||
rows = [row for row in rows if row[4] != 0]
|
||||
case strings.filter_full:
|
||||
rows = [row for row in rows if row[4] != row[5]]
|
||||
case strings.filter_duplicate:
|
||||
seen = set()
|
||||
final = []
|
||||
for row in rows:
|
||||
if row[0] not in seen:
|
||||
seen.add(row[0])
|
||||
final.append(row)
|
||||
rows = final
|
||||
case strings.filter_day:
|
||||
reg = r"([0][0-9]|[1][0-6])"
|
||||
rows = [row for row in rows if not re.match(reg, row[3])]
|
||||
case strings.filter_night:
|
||||
reg = r"([0][0-4]|[1][8]|[2][0-3])"
|
||||
rows = [row for row in rows if not re.match(reg, row[3])]
|
||||
case strings.filter_nonascii:
|
||||
rows = [row for row in rows if row[0].isascii()]
|
||||
case strings.filter_lowpop:
|
||||
rows = [row for row in rows if (row[4] / row[5] * 100) > 30]
|
||||
case strings.filter_modded:
|
||||
rows = [row for row in rows if not row[11]]
|
||||
return rows
|
||||
|
||||
def filter_toggle_on(self, filters: tuple[str]) -> list:
|
||||
"""Effectively applies all filters"""
|
||||
self.set_filtered(self.control_model)
|
||||
self.set_filtered(self.filter_map(filters))
|
||||
self.set_filtered(self.filter_keyword(filters))
|
||||
|
||||
f: str
|
||||
for f in filters[2:]:
|
||||
self.set_filtered(self.filter_toggle_off(filters, f))
|
||||
return self.filtered
|
||||
|
||||
def set_cache(self, filters: tuple[str], filtered_rows: list[tuple]) -> None:
|
||||
self.filter_cache[filters] = filtered_rows
|
||||
|
||||
@deprecated("Currently unused")
|
||||
# def convert_model_to_list(self, model: "FastInsertListStore") -> list:
|
||||
# return [[el for el in row] for row in model]
|
||||
|
||||
def set_filtered(self, rows: list | None) -> None:
|
||||
if rows is None:
|
||||
self.filtered = []
|
||||
else:
|
||||
self.filtered = rows
|
||||
|
||||
def get_filtered(self) -> list:
|
||||
return self.filtered
|
||||
|
||||
def set_proxy_model(self, model: "FastInsertListStore") -> None:
|
||||
"""
|
||||
FastInsertListStore representation of the raw model after filtration
|
||||
"""
|
||||
self.proxy_model = model
|
||||
|
||||
def set_control(self, rows: list) -> None:
|
||||
"""
|
||||
Raw data model prior to filtration
|
||||
"""
|
||||
self.control_model = rows
|
||||
|
||||
def get_control(self) -> list[Any]:
|
||||
if self.control_model is None:
|
||||
raise AttributeError(
|
||||
"Expected a populated control model, but it is Nonetype"
|
||||
)
|
||||
return self.control_model
|
||||
|
||||
def wipe_cache(self, full: bool = False) -> None:
|
||||
self.filtered = []
|
||||
self.filter_cache = {}
|
||||
|
||||
def push(self, data: list[Any]) -> None:
|
||||
self.wipe_cache()
|
||||
self.set_control(data)
|
||||
self.filter(FilterMode.INITIAL)
|
||||
@ -1,456 +0,0 @@
|
||||
import logging
|
||||
import threading
|
||||
|
||||
from concurrent.futures import as_completed
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, TYPE_CHECKING
|
||||
|
||||
import dzgui.api.servers as Servers
|
||||
from dzgui.const.constants import (
|
||||
APPID_DAYZ,
|
||||
APPID_DAYZ_EXP,
|
||||
APP_NAME,
|
||||
)
|
||||
from dzgui.const.enum import FilterMode, Preferences, ServerTab
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.strings import dialogs
|
||||
from dzgui.util.strings import api_warn_msg, dialog
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.api.servers import A2SInfo, Record
|
||||
from dzgui.controllers.mc import Controller
|
||||
from dzgui.model.proxy_model import ProxyModelManager
|
||||
from dzgui.views.trees.tree_servers import ServerTreeView
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
LAN_TIMEOUT = 0.5
|
||||
API_TIMEOUT = 3
|
||||
|
||||
|
||||
@dataclass
|
||||
class NewPlayerCount:
|
||||
treeiter: Gtk.TreeIter
|
||||
players: int
|
||||
queue: int
|
||||
|
||||
|
||||
class ServerModelManager:
|
||||
def __init__(self, controller: "Controller", tv: "ServerTreeView") -> None:
|
||||
|
||||
self.tv = tv
|
||||
self.enum = tv.get_enum()
|
||||
self.controller = controller
|
||||
self.emitter = controller.get_emitter()
|
||||
|
||||
self.first_iteration: bool
|
||||
self.preserve_on_fail = False
|
||||
self.jobs = 1
|
||||
|
||||
self.proxy_man = tv.get_proxy_man()
|
||||
self.thread_man = ThreadingManager(self.controller)
|
||||
|
||||
def load(self) -> None:
|
||||
"""
|
||||
Load is not called on init. There may be cases where you want to instantiate this class without dumping servers,
|
||||
e.g., adding saved servers from another tab
|
||||
"""
|
||||
|
||||
self.first_iteration = True
|
||||
match self.enum:
|
||||
case ServerTab.BROWSER:
|
||||
# NOTE: extra DAYZ_EXP param
|
||||
self.thread_man.set_job_count(len(Servers.params) + 1)
|
||||
self._dump_api()
|
||||
case ServerTab.SAVED:
|
||||
self._dump_favorites()
|
||||
case ServerTab.RECENT:
|
||||
self._dump_history()
|
||||
case ServerTab.LAN:
|
||||
# NOTE: LAN tab is only loaded on demand
|
||||
self.emitter.emit("lan_page_initialized")
|
||||
pass
|
||||
case _:
|
||||
pass
|
||||
|
||||
def refresh(self) -> None:
|
||||
self.preserve_on_fail = True
|
||||
self.load()
|
||||
|
||||
@call_on_thread(dialog.fetching)
|
||||
def _dump_api(self) -> None:
|
||||
# TODO: pass api key a priori in .load() call?
|
||||
failure_func = StoredFunc(self._cleanup_on_failure)
|
||||
config_man = self.controller.get_config_man()
|
||||
key = config_man.lookup(Preferences.STEAM)
|
||||
job = Servers.query_api
|
||||
params = Servers.params
|
||||
servers = []
|
||||
with ThreadPoolExecutor() as executor:
|
||||
futures = [executor.submit(job, key, APPID_DAYZ, param) for param in params]
|
||||
for future in as_completed(futures):
|
||||
try:
|
||||
# NOTE: faciliates early aborting via sigint
|
||||
# TODO: make this logic available to all dump contexts
|
||||
if self.controller.get_exit_event().is_set():
|
||||
return
|
||||
self.thread_man.increment_dialog()
|
||||
res = future.result(timeout=API_TIMEOUT)
|
||||
if res.status != 200 or not res.parsed:
|
||||
self.thread_man.set_cleanup_func(
|
||||
failure_func, destroy_first=True
|
||||
)
|
||||
return
|
||||
j = res.json
|
||||
if j is not None:
|
||||
servers.extend(j["response"]["servers"])
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
return
|
||||
|
||||
# NOTE: this step is allowed to fail, since this metadata is incidental
|
||||
res = Servers.query_api(key, APPID_DAYZ_EXP, "")
|
||||
if res.status == 200 and res.parsed is True:
|
||||
j = res.json
|
||||
if j is not None:
|
||||
servers.extend(j["response"]["servers"])
|
||||
|
||||
parsed = Servers.parse_json(servers)
|
||||
self._push_data(parsed)
|
||||
|
||||
@call_on_thread(dialog.scanning, show_cancel=True)
|
||||
def dump_lan(self, port: int, early_abort: bool) -> None:
|
||||
self.first_iteration = True
|
||||
|
||||
servers = []
|
||||
ports = range(1, 256)
|
||||
failure_func = StoredFunc(self._cleanup_on_lan_failure)
|
||||
|
||||
event = threading.Event()
|
||||
with ThreadPoolExecutor() as executor:
|
||||
futures = [executor.submit(Servers.test_ip, i, port, event) for i in ports]
|
||||
for future in as_completed(futures):
|
||||
try:
|
||||
if self.controller.is_cancel_pending():
|
||||
event.set()
|
||||
return
|
||||
res = future.result(timeout=LAN_TIMEOUT)
|
||||
if res is None:
|
||||
continue
|
||||
servers.append(res)
|
||||
if early_abort is True:
|
||||
# NOTE: on first non-empty hit, flag pending threads to close
|
||||
event.set()
|
||||
break
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
if len(servers) == 0:
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
return
|
||||
parsed = Servers.parse_json(servers)
|
||||
self._push_data(parsed)
|
||||
|
||||
@call_on_thread(dialog.fetching)
|
||||
def _dump_ips(self, ips: list[str]) -> None:
|
||||
job = Servers.query_direct
|
||||
servers = []
|
||||
with ThreadPoolExecutor() as executor:
|
||||
futures = [
|
||||
executor.submit(
|
||||
job,
|
||||
ip.split(":")[0],
|
||||
int(ip.split(":")[2]),
|
||||
)
|
||||
for ip in ips
|
||||
]
|
||||
for future in as_completed(futures):
|
||||
# TODO: wrap except
|
||||
if self.controller.get_exit_event().is_set():
|
||||
return
|
||||
res = future.result(timeout=API_TIMEOUT)
|
||||
self.thread_man.increment_dialog()
|
||||
# NOTE: failing entries are culled
|
||||
if res is None:
|
||||
# TODO: log which servers failed
|
||||
continue
|
||||
servers.append(res)
|
||||
if len(servers) == 0:
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_on_failure), destroy_first=True
|
||||
)
|
||||
return
|
||||
|
||||
parsed = Servers.parse_json(servers)
|
||||
self._push_data(parsed)
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def add_by_id(self, _id: str) -> None:
|
||||
config_man = self.controller.get_config_man()
|
||||
key = config_man.lookup(Preferences.BM)
|
||||
res = Servers.query_by_id(int(_id), key)
|
||||
self._parse_single_record(res)
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def add_by_ip(self, addr: str) -> None:
|
||||
res = Servers.query_by_ip(addr)
|
||||
self._parse_single_record(res)
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def add_by_record(self, record: Servers.Record) -> None:
|
||||
# NOTE: rationale: a raw Record as shown in server browser may resolve to a different IP
|
||||
res = Servers.query_by_record(record)
|
||||
self._parse_single_record(res)
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def remove_by_record(self, record: Servers.Record) -> None:
|
||||
res = Servers.query_by_record(record)
|
||||
self._parse_single_record(res, delete=True)
|
||||
|
||||
def update_history(
|
||||
self,
|
||||
rows: (
|
||||
list[tuple[str, str, str, str, int, int, int, str, int, int, str, bool]]
|
||||
| None
|
||||
) = None,
|
||||
) -> None:
|
||||
proxy_man = self._get_proxy_man()
|
||||
if rows is not None:
|
||||
records = rows
|
||||
else:
|
||||
control_model = proxy_man.get_control()
|
||||
records = control_model
|
||||
|
||||
self._sort_unique_maps(records)
|
||||
proxy = proxy_man.get_proxy_model()
|
||||
self.tv.set_model(proxy)
|
||||
|
||||
self.emitter.emit("servers_loaded", self.enum)
|
||||
|
||||
filter_man = self.tv.get_filter_man()
|
||||
maps = self._get_new_maps()
|
||||
filter_man.set_unique_maps(maps)
|
||||
store = filter_man.get_map_store()
|
||||
|
||||
self.first_iteration = False
|
||||
self.emitter.emit("load_maps", store)
|
||||
# self.emitter.emit("servers_loaded_init")
|
||||
|
||||
# TODO: dataclass for record rows; check for other dict annotations
|
||||
def add_to_history(self, data: tuple[dict[str, Any], "Record"]) -> None:
|
||||
row, record = data
|
||||
proxy_man = self._get_proxy_man()
|
||||
rows = Servers.parse_json([row])
|
||||
try:
|
||||
proxy_man.append_row_to_history(rows[0])
|
||||
self.update_history()
|
||||
except Exception:
|
||||
self.update_history(rows)
|
||||
|
||||
fqip = Servers.record_to_fqip(record)
|
||||
config_man = self.controller.get_config_man()
|
||||
config_man.update_history_file(fqip)
|
||||
|
||||
def remove_from_history(self, record: Servers.Record) -> None:
|
||||
proxy_man = self._get_proxy_man()
|
||||
proxy_man.remove_row_from_control(record)
|
||||
self.update_history()
|
||||
|
||||
def add_by_str(self, addr: str) -> None:
|
||||
if addr.isdigit():
|
||||
self.add_by_id(addr)
|
||||
else:
|
||||
self.add_by_ip(addr)
|
||||
|
||||
@call_on_thread(dialog.querying)
|
||||
def update_playercount(
|
||||
self, treeiter: Gtk.TreeIter, record: Servers.Record
|
||||
) -> None:
|
||||
res = Servers.query_playercount(record)
|
||||
if res is None:
|
||||
return
|
||||
players, queue = res
|
||||
|
||||
self.playercount = NewPlayerCount(treeiter, players, queue)
|
||||
self.thread_man.set_cleanup_func(StoredFunc(self._push_playercount))
|
||||
|
||||
def _push_playercount(self) -> None:
|
||||
proxy_man = self._get_proxy_man()
|
||||
proxy_man.update_playercount(self.playercount)
|
||||
|
||||
def _parse_single_record(self, response: "A2SInfo", delete: bool = False) -> None:
|
||||
self.preserve_on_fail = True
|
||||
try:
|
||||
row = response.as_row()
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_on_failure), destroy_first=True
|
||||
)
|
||||
return
|
||||
|
||||
# NOTE: expected to only contain one item
|
||||
records = Servers.parse_json([row])
|
||||
server = records[0]
|
||||
if server is None:
|
||||
return
|
||||
|
||||
proxy_man = self._get_proxy_man()
|
||||
config_man = self.controller.get_config_man()
|
||||
fqip = Servers.response_to_fqip(row)
|
||||
record = response.get_record()
|
||||
|
||||
# TODO: less convoluted
|
||||
if delete:
|
||||
# NOTE: abort early if Saved Servers tab was not loaded yet
|
||||
config_man.remove_saved_server(fqip)
|
||||
if proxy_man.has_control_model() is False:
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_when_no_model)
|
||||
)
|
||||
return
|
||||
proxy_man.remove_row_from_control(record)
|
||||
else:
|
||||
if config_man.is_in_favs(fqip):
|
||||
func = StoredFunc(lambda: self.emitter.emit("already_saved_server"))
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
return
|
||||
config_man.add_saved_server(fqip)
|
||||
|
||||
# FIXME: this is valid if saved servers tab is already open,
|
||||
# but not if app was just booted; causes single row to appear prematurely
|
||||
if proxy_man.has_control_model() is False:
|
||||
proxy_man.push(records)
|
||||
else:
|
||||
proxy_man.append_row_to_control(server)
|
||||
|
||||
control_model = proxy_man.get_control()
|
||||
self._sort_unique_maps(control_model)
|
||||
self.thread_man.set_cleanup_func(StoredFunc(self._cleanup_single_ip))
|
||||
|
||||
def _cleanup_when_no_model(self) -> None:
|
||||
self.emitter.emit("saved_servers_changed")
|
||||
|
||||
def _dump_history(self) -> None:
|
||||
history = self.controller.get_prefs().paths.history
|
||||
try:
|
||||
with open(history, "r") as f:
|
||||
rows = [row.rstrip("\n") for row in f]
|
||||
except OSError:
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_on_failure, False), destroy_first=True
|
||||
)
|
||||
return
|
||||
if len(rows) == 0:
|
||||
# TODO: customize statusbar to mention how records are added after connecting
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_on_failure, False), destroy_first=True
|
||||
)
|
||||
return
|
||||
self.thread_man.set_job_count(len(rows))
|
||||
self._dump_ips(rows)
|
||||
|
||||
def _dump_favorites(self) -> None:
|
||||
config_man = self.controller.get_config_man()
|
||||
ips = config_man.lookup(Preferences.IP_LIST)
|
||||
self.thread_man.set_job_count(len(ips))
|
||||
|
||||
if len(ips) == 0:
|
||||
# TODO: customize statusbar to mention how records can be added via contextmenu
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_on_failure, False), destroy_first=True
|
||||
)
|
||||
return
|
||||
self._dump_ips(ips)
|
||||
|
||||
def _cleanup_single_ip(self) -> None:
|
||||
proxy = self._get_proxy_man().get_proxy_model()
|
||||
self.tv.set_model(proxy)
|
||||
|
||||
if self.controller.get_active_treeview().get_enum() == ServerTab.SAVED:
|
||||
self.emitter.emit("servers_loaded", self.enum)
|
||||
|
||||
filter_man = self.tv.get_filter_man()
|
||||
# NOTE: maps are set outside of thread because it triggers map changed signals
|
||||
maps = self._get_new_maps()
|
||||
filter_man.set_unique_maps(maps)
|
||||
store = filter_man.get_map_store()
|
||||
self.emitter.emit("load_maps", store)
|
||||
|
||||
self.first_iteration = False
|
||||
self.emitter.emit("saved_servers_changed")
|
||||
|
||||
def _update_maps(self) -> None:
|
||||
filter_man = self.tv.get_filter_man()
|
||||
filter_man.set_unique_maps(self._get_new_maps())
|
||||
store = filter_man.get_map_store()
|
||||
self.emitter.emit("load_maps", store)
|
||||
self.first_iteration = False
|
||||
|
||||
def _cleanup_on_success(self) -> None:
|
||||
proxy = self.proxy_man.get_proxy_model()
|
||||
self.tv.set_model(proxy)
|
||||
if self.preserve_on_fail is True:
|
||||
self.proxy_man.wipe_cache()
|
||||
|
||||
self.emitter.emit("servers_loaded", self.enum)
|
||||
if self.first_iteration:
|
||||
self._update_maps()
|
||||
|
||||
def _cleanup_on_lan_failure(self, show_dialog: bool = True) -> None:
|
||||
if self.preserve_on_fail is False:
|
||||
self.tv.set_model(None)
|
||||
filter_man = self.tv.get_filter_man()
|
||||
filter_man.set_unique_maps([])
|
||||
|
||||
if show_dialog:
|
||||
dialog = ExceptionDialog(self.controller, dialogs.load_error_lan)
|
||||
dialog.run()
|
||||
|
||||
def _cleanup_on_failure(self, show_dialog: bool = True) -> None:
|
||||
# TODO: disable map, keyword, and filter widgets if model is None
|
||||
# signal driven (servers_empty, servers_failed_to_load)
|
||||
|
||||
if self.preserve_on_fail is False:
|
||||
self.tv.set_model(None)
|
||||
filter_man = self.tv.get_filter_man()
|
||||
filter_man.set_unique_maps([])
|
||||
|
||||
# TODO: distinguish signals, e.g. "servers_failed_to_load", "servers_loaded_empty"
|
||||
# customize statusbar and dialog accordingly
|
||||
if show_dialog:
|
||||
dialog = ExceptionDialog(self.controller, api_warn_msg)
|
||||
dialog.run()
|
||||
|
||||
def _push_data(self, data: list[Any]) -> None:
|
||||
self._get_proxy_man().push(data)
|
||||
self._sort_unique_maps(data)
|
||||
self.thread_man.set_cleanup_func(StoredFunc(self._cleanup_on_success))
|
||||
|
||||
def _sort_unique_maps(self, data: list) -> None:
|
||||
u_maps = set([row[1] for row in data])
|
||||
self._set_new_maps(sorted(u_maps))
|
||||
|
||||
def _set_new_maps(self, maps: list[str]) -> None:
|
||||
self.new_maps: list[str] = maps
|
||||
|
||||
def _get_new_maps(self) -> list[str]:
|
||||
return self.new_maps
|
||||
|
||||
def _get_proxy_man(self) -> "ProxyModelManager":
|
||||
return self.proxy_man
|
||||
|
||||
@call_on_thread(dialog.filtering)
|
||||
def refilter(self, mode: FilterMode) -> None:
|
||||
# FIXME: causes two wait dialogs when map selection change signal emits after loading servers
|
||||
self.first_iteration = False
|
||||
proxy_man = self._get_proxy_man()
|
||||
proxy_man.filter(mode)
|
||||
self.thread_man.set_cleanup_func(StoredFunc(self._cleanup_on_success))
|
||||
@ -1 +0,0 @@
|
||||
all_ok = "All OK. Loading UI..."
|
||||
@ -1,2 +0,0 @@
|
||||
workshop = "Steam Workshop"
|
||||
workshop_tooltip = "Open your Workshop subscriptions"
|
||||
@ -1,24 +0,0 @@
|
||||
add_button="Add"
|
||||
add_con_heading="Add/connect"
|
||||
add_popover = "This address is already in your Saved Servers"
|
||||
add_tooltip="Add to Saved Servers"
|
||||
connect_button="Connect"
|
||||
connect_tooltip="Connect to this server"
|
||||
connect_entry_tooltip=(
|
||||
"- IP: format as IP:Query port\ne.g. 192.168.1.1:27016\n"
|
||||
"- Battlemetrics: numeric server ID\ne.g. 123456"
|
||||
)
|
||||
connect_entry_placeholder="Enter IP (IP:Query port) or Battlemetrics ID (numerical id)"
|
||||
|
||||
fav_heading="Favorite server"
|
||||
favs_empty="None set. Right click a server and select 'Set favorite' to set."
|
||||
|
||||
lan_heading="LAN query port"
|
||||
lan_default_button="Default port (27016)"
|
||||
lan_custom_button="Custom port"
|
||||
lan_scan_button="Scan"
|
||||
lan_abort_tooltip = "Unless you have multiple DayZ servers on your LAN,\nleave this checked to get results faster"
|
||||
lan_checkbox = "Stop scanning on first hit"
|
||||
lan_placeholder="Enter the query port (1-65535)"
|
||||
lan_entry_tooltip="Specify the port to search for DayZ servers on the local network"
|
||||
lan_scan_tooltip="Scan for servers"
|
||||
@ -1,22 +0,0 @@
|
||||
waiting_for_launch = "Waiting for DayZ to launch"
|
||||
waiting_for_mods = "Queueing up mods (step 1/2)"
|
||||
waiting_for_directories = "Steam is staging mods (step 2/2)"
|
||||
|
||||
fetching_update = "Fetching update"
|
||||
failed_to_update = "Failed to update DZGUI executable"
|
||||
update_success = "Updated successfully. Please exit and relaunch."
|
||||
|
||||
load_error_lan = "Failed to find any servers on your network.\nCheck the server query port or your firewall settings."
|
||||
fetching_mods = "Fetching mod metadata"
|
||||
deleting_mods = "Unsubscribing mods"
|
||||
scanning_mods = "Scanning mods"
|
||||
parsing_mods = "Parsing mods"
|
||||
|
||||
checking_api = "Checking API key"
|
||||
|
||||
running = "Running"
|
||||
failed = "FAILED"
|
||||
ok = "OK"
|
||||
|
||||
mission_dialog = "Set a mission folder location"
|
||||
custom_mod_dialog = "Set location to a custom mods folder"
|
||||
@ -1,6 +0,0 @@
|
||||
api_validation_error = (
|
||||
"API key validation error. Key was typed incorrectly or is defunct."
|
||||
)
|
||||
|
||||
api_popover = "API key validation failed."
|
||||
dayz_not_found = "Could not find a valid DayZ installation."
|
||||