Skip to content

Commit

Permalink
Merge branch 'master' of github.com:PyPlanet/PyPlanet
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvlk committed Aug 29, 2023
2 parents fb979dd + 07ecc02 commit d971fad
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[bumpversion]
commit = True
tag = False
current_version = 0.10.4
current_version = 0.10.5
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>.*))?
serialize =
serialize =
{major}.{minor}.{patch}-{release}
{major}.{minor}.{patch}

Expand All @@ -13,7 +13,7 @@ serialize =

[bumpversion:part:release]
optional_value = final
values =
values =
alpha
beta
rc
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ venv/
### Editors / IDE
# IntelliJ project files
.idea
.vs
*.iml
out
gen
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
Changelog
=========

0.10.5
------

Core
~~~~

* Improvement: Removed \x92 character and <hidden> values from mode settings descriptions (#1219).

* Bugfix: Fixing crash on start when using PostgreSQL database backend (thanks to lel-amri) (#1126).
* Bugfix: Fixing list template background with no search, but with buttons (thanks to skybaks) (#1232).
* Bugfix: Fixing log rollover with TimedRotatingFileHandler for Windows (thanks to w1lla) (#1089).
* Bugfix: Fixing sorting with None values in list generics (#1245).
* Bugfix: Fixing default value for confirmation alert pop-up (#1244).

Apps
~~~~

* Feature: Added option to vote to go to the previous map (#1223).

* Improvement: Ceil amount of votes required for vote to pass (#1246).

* Bugfix: Fixing retrieval of correct amount of Discord users for servers with over 100 users (thanks to froznsm) (#1208).
* Bugfix: Fixing rankings calculations for newer MariaDB versions (thanks to reaby) (#1238).

0.10.4
------

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
# built documents.
#
# The short X.Y version.
version = '0.10.4'
version = '0.10.5'
# The full version, including alpha/beta/rc tags.
release = '0.10.4'
release = '0.10.5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion pyplanet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
PyPlanet, a robust and simple Maniaplanet Server Controller for Python 3.6+.
Please see LICENSE file in root of project.
"""
__version__ = '0.10.4'
__version__ = '0.10.5'
__author__ = 'Tom Valk'
40 changes: 40 additions & 0 deletions pyplanet/apps/contrib/live_rankings/templates/widget.Script.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
main() {
declare Boolean Prev_DistractionFreeMode = False;
declare netwrite Boolean Net_DistractionFreeMode for UI;

if (Net_DistractionFreeMode == True) {
Page.GetClassChildren("distraction-hide", Page.MainFrame, True);
foreach (Control in Page.GetClassChildren_Result) {
Control.Hide();
}
}

while(True) {
yield;

foreach (Event in PendingEvents) {
if (Event.Type == CMlScriptEvent::Type::MouseClick && Event.Control.HasClass("toggleSpec")) {
if (InputPlayer.RequestsSpectate) {
declare frame <=> Event.Control.Parent;
SetSpectateTarget(frame.DataAttributeGet("login"));
}
}
}

if (Prev_DistractionFreeMode != Net_DistractionFreeMode) {
Prev_DistractionFreeMode = Net_DistractionFreeMode;

if (Net_DistractionFreeMode == True) {
Page.GetClassChildren("distraction-hide", Page.MainFrame, True);
foreach (Control in Page.GetClassChildren_Result) {
Control.Hide();
}
} else {
Page.GetClassChildren("distraction-hide", Page.MainFrame, True);
foreach (Control in Page.GetClassChildren_Result) {
Control.Show();
}
}
}
}
}
18 changes: 11 additions & 7 deletions pyplanet/apps/contrib/live_rankings/templates/widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
{% block content %}
{% if times != None %}
{% for time in times %}
<frame pos="0 -{{ (loop.index0 * 3.25) }}">
<frame pos="0 -{{ (loop.index0 * 3.25) }}" data-login="{{time.login}}">
<quad pos="0 0" z-index="0" size="4 3" bgcolor="00000070"/>
<label pos="2 -1.5" z-index="1" size="4 3" text="{{ time.index }}" textsize="0.3" textfont="RajdhaniMono" textemboss="1" halign="center" valign="center2"/>
<quad pos="4.25 0" z-index="0" size="20.5 3" bgcolor="00000070"/>
<label pos="4.5 -1.5" z-index="1" size="20 3" text="{{ time.nickname }}" textsize="0.2" textfont="RajdhaniMono" textemboss="1" halign="left" valign="center2"/>
<label pos="2 -1.5" z-index="1" size="4 3" text="{{ time.index }}" textsize="0.3" textfont="RajdhaniMono" textemboss="1" halign="center" valign="center2"/>
<quad pos="4.25 0" z-index="0" size="20.5 3" bgcolor="00000070" class="toggleSpec" scriptevents="1"/>
<label pos="4.5 -1.5" z-index="1" size="20 3" text="{{ time.nickname }}" textsize="0.2" textfont="RajdhaniMono" textemboss="1" halign="left" valign="center2" class="toggleSpec" scriptevents="1"/>
<quad pos="25 0" z-index="0" size="10 3" bgcolor="00000070"/>
<label pos="30 -1.5" z-index="1" size="10 3" text="{{ time.color }}{{ time.score }}" textsize="0.2" textfont="RajdhaniMono" textemboss="1" halign="center" valign="center2"/>
<label pos="30 -1.5" z-index="1" size="10 3" text="{{ time.color }}{{ time.score }}" textsize="0.2" textfont="RajdhaniMono" textemboss="1" halign="center" valign="center2"/>
{% if time.cp_difference != None and time.cp_difference != 0 %}
<quad pos="35.25 0" z-index="0" size="7 3" bgcolor="00000070"/>
<label pos="38.75 -1.5" size="7 3" z-index="1" textsize="0.2" halign="center" valign="center2" text="$fff+{{ time.cp_difference }} cp" textfont="RajdhaniMono" textemboss="1"/>
<label pos="38.75 -1.5" size="7 3" z-index="1" textsize="0.2" halign="center" valign="center2" text="$fff+{{ time.cp_difference }} cp" textfont="RajdhaniMono" textemboss="1"/>
{% elif time.points_added != None and time.points_added != 0 %}
<quad pos="35.25 0" z-index="0" size="7 3" bgcolor="00000070"/>
<label pos="38.75 -1.5" size="7 3" z-index="1" textsize="0.2" halign="center" valign="center2" text="$0f3+{{ time.points_added }}" textfont="RajdhaniMono" textemboss="1"/>
<label pos="38.75 -1.5" size="7 3" z-index="1" textsize="0.2" halign="center" valign="center2" text="$0f3+{{ time.points_added }}" textfont="RajdhaniMono" textemboss="1"/>
{% endif %}
</frame>
{% endfor %}
{% endif %}
{% endblock %}

{% block maniascript %}
<script><!-- {% include 'live_rankings/widget.Script.txt' %} --></script>
{% endblock %}
1 change: 1 addition & 0 deletions pyplanet/apps/contrib/live_rankings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def get_widget_records(self, player=None):
if index == player_index:
list_record['color'] = '$0f3'

list_record['login'] = record['login']
list_record['nickname'] = record['nickname']

if self.format_times:
Expand Down
17 changes: 16 additions & 1 deletion pyplanet/apps/contrib/rankings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ async def get_data(self):

return data

async def get_actions(self):
custom_actions = list()
if 'rankings' in self.app.instance.apps.apps:
custom_actions.append(dict(
name='Add to folder',
action=self.app.instance.apps.apps['jukebox'].add_to_folder,
text='&#xf07b;',
textsize='1.2',
safe=True,
type='label',
order=-50,
require_confirm=False,
))

return custom_actions

async def action_jukebox(self, player, values, map_info, **kwargs):
await self.app.instance.apps.apps['jukebox'].add_to_jukebox(player, await self.app.instance.map_manager.get_map(map_info['uid']))

6 changes: 5 additions & 1 deletion pyplanet/contrib/map/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,12 @@ async def update_list(self, full_update=False, detach_fks=True):
Map.select().where(Map.uid << [m['uid'] for m in rows])
))

# Order the maps to match the order on the server.
ordered_uids = [m['UId'] for m in raw_list]
ordered_maps = sorted(set(maps), key=lambda m: ordered_uids.index(m.uid) if m.uid in ordered_uids else -1)

async with self.lock:
self._maps = set(maps)
self._maps = ordered_maps

# Reload locals for all maps.
# TODO: Find better way to remove this and handle it on the folders way.
Expand Down
8 changes: 6 additions & 2 deletions pyplanet/core/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ async def send(self, manialink, players=None, **kwargs):
raise Exception('Manialink has no body or template defined!')

# Add manialink tag to body.
body = '<manialink version="{}" id="{}">{}</manialink>'.format(manialink.version, manialink.id, body)
body = '<manialink version="{}" id="{}" name="{}">{}</manialink>'.format(
manialink.version, manialink.id, manialink.id, body
)

# Prepare query
queries.append(self.instance.gbx(
Expand All @@ -111,7 +113,9 @@ async def send(self, manialink, players=None, **kwargs):
raise Exception('Manialink has no body or template defined!')

# Add manialink tag to body.
body = '<manialink version="{}" id="{}">{}</manialink>'.format(manialink.version, manialink.id, body)
body = '<manialink version="{}" id="{}" name="{}">{}</manialink>'.format(
manialink.version, manialink.id, manialink.id, body
)

# Add normal queries.
if for_logins and len(for_logins) > 0:
Expand Down

0 comments on commit d971fad

Please sign in to comment.