A Qt Widget for visualizing osu! beatmaps and replays.
Project description
Circlevis
Circlevis is the replay viewer (aka visualizer) in Circleguard. It was split off into its own repository to allow other projects to use it, should they so choose.
Circlevis is a Qt widget, and will only work if you are using the Qt (or pyqt, as we are) GUI framwork.
Installation
Circlevis can be installed from pip:
pip install circlevis
Usage
Circlevis can be used in two ways:
VisualizerApp
The easiest way is to instantiate a VisualizerApp
, which subclasses QApplication
so you don't have to create a main application yourself. This is best for quick visualization, when you only want to open circlevis and nothing else.
from circleguard import *
from circlevis import VisualizerApp, BeatmapInfo
cg = Circleguard("key")
r = ReplayMap(509610, 6304246)
# replays must be loaded before passed to the visualizer
cg.load(r)
# BeatmapInfo tells circlevis how it should load the beatmap before it displays
# it. You can pass either a map id (in which case circlevis will download the map
# from osu!'s servers) or a path to a .osu file (in which case circlevis will
# load the beatmap from that file).
# If you don't want any beatmap to be displayed, instantiate an empty BeatmapInfo
# (bm = BeatmapInfo()) and pass that to the visualizer.
bm = BeatmapInfo(map_id=r.map_id)
app = VisualizerApp(bm, replays=[r])
# this calls qt's `exec` function, which shows the application and enters the
# gui run loop, blocking any code after this call.
app.exec()
You can also visualize only a map, without any replay:
from circlevis import VisualizerApp, BeatmapInfo
bm = BeatmapInfo(map_id=509610)
app = VisualizerApp(bm)
app.exec()
Visualizer
If you want to integrate the visualizer into an existing project (which already has its own QApplication
), you should instead instantiate the Visualizer
class, which is a normal Qt
widget and can be added to a layout like any other widget.
from circleguard import *
from circlevis import Visualizer, BeatmapInfo
cg = Circleguard("key")
r = ReplayMap(509610, 6304246)
cg.load(r)
bm = BeatmapInfo(map_id=r.map_id)
visualizer_widget = Visualizer(bm, replays=[r])
# add visualizer_widget to your layout here
Advanced Usage
Both VisualizerApp
and Visualizer
can take several optional arguments:
events
- a list of timestamps (in ms). If a frame with that timestamp is found in the replay, it is colored goldlibrary
- A sliderLibrary
class, which will be used instead of creating a new one if passedspeeds
- a list of possible speeds the visualizer can play at. These can be switched between in real time with the speed up or speed down icons on the visualizer, or by pressing the up or down keysstart_speed
- which speed to start playback at. This value must be inspeeds
paint_info
- whether to draw information about the map and replays in the upper left hand corner
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file circlevis-1.3.0.tar.gz
.
File metadata
- Download URL: circlevis-1.3.0.tar.gz
- Upload date:
- Size: 119.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0b725960f9ffb02b8f7e823503f5239a1767517c1a651248d2b034f4d032eea |
|
MD5 | ff12d2308dbbf7d7f00e71259a086f29 |
|
BLAKE2b-256 | bf79532e7c558add43f29201f97ba7345e44da639eab75d331f514c5eb77c6a0 |
File details
Details for the file circlevis-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: circlevis-1.3.0-py3-none-any.whl
- Upload date:
- Size: 136.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0d880a9ff9548db80e9a5e2eab5379618dab2fe499baa24910f4d3063f08b96 |
|
MD5 | a36416bcbc0a84119661e2f027482fc6 |
|
BLAKE2b-256 | 97d6248b418e24e890f378b01214137e7c66ae4d4dc399caea5833555de41fe0 |