@@ -1547,8 +1547,8 @@ def find_build_finished(self):
1547
1547
1548
1548
target_regex = re .compile (
1549
1549
r'cdda-windows-' +
1550
- re . escape ( asset_graphics ) + r'-' +
1551
- re . escape ( asset_platform ) + self . selected_build_type +
1550
+ r'with-graphics' + r'-' +
1551
+ r'x64' +
1552
1552
r'b?(?P<build>[0-9\-]+)\.zip'
1553
1553
)
1554
1554
@@ -3015,6 +3015,30 @@ def warn_rate_limit(self, requests_remaining, reset_dt):
3015
3015
if selected_branch == self .experimental_radio_button :
3016
3016
self .find_build_warning_label .show ()
3017
3017
3018
+ def get_stable_tags (self ):
3019
+ url = cons .GITHUB_REST_API_URL + cons .CDDA_RELEASE_TAGS
3020
+ tag_regex = re .compile (r'(refs/tags/)(cdda-|)(0\.[A-Z]-)([0-9\-]+|[a-zA-Z]+|)' )
3021
+
3022
+
3023
+ try :
3024
+ tags_data = requests .get (url ).json ()
3025
+ except :
3026
+ tags_data = []
3027
+ stable_refs = list (filter (lambda d : tag_regex .match (d ['ref' ]), tags_data ))
3028
+ stable_tags = []
3029
+ stable_letter = ""
3030
+ # Reverse order to deal with the most recent first
3031
+ for entry in reversed (stable_refs ):
3032
+ # Extract the actual tag
3033
+ tag = re .sub (r'refs/tags/' , '' , entry ['ref' ])
3034
+ # Get the stable version: 0.H, 0.I etc
3035
+ tmp_letter = re .compile (r'0.[A-Z]' ).search (tag ).group (0 )
3036
+ if tmp_letter != stable_letter : # Only get the first unique stable you find
3037
+ stable_letter = tmp_letter
3038
+ stable_tags .append (tag )
3039
+
3040
+ return stable_tags
3041
+
3018
3042
def lb_http_finished (self ):
3019
3043
main_window = self .get_main_window ()
3020
3044
@@ -3121,8 +3145,8 @@ def lb_http_finished(self):
3121
3145
3122
3146
target_regex = re .compile (
3123
3147
r'cdda-windows-' +
3124
- re . escape ( asset_graphics ) + r'-' +
3125
- re . escape ( asset_platform ) + self . selected_build_type +
3148
+ r'with-graphics' + r'-' +
3149
+ r'x64' +
3126
3150
r'b?(?P<build>[0-9\-]+)\.zip'
3127
3151
)
3128
3152
@@ -3267,6 +3291,38 @@ def refresh_builds(self):
3267
3291
3268
3292
builds = []
3269
3293
3294
+ tmp_changelog = ""
3295
+ build_regex = re .compile (r'cdda-windows-tiles' + r'(-x64|-x32)' + r'(-msvc-|-)' + r'([0-9\-]+)\.zip' )
3296
+ stable_tags = self .get_stable_tags ()
3297
+
3298
+ last_idx = len (stable_tags ) - 1
3299
+ for tag in stable_tags :
3300
+ url = cons .GITHUB_REST_API_URL + cons .CDDA_RELEASE_BY_TAG (tag )
3301
+ try :
3302
+ release = requests .get (url ).json ()
3303
+ except :
3304
+ continue
3305
+
3306
+ stable_name = re .compile (r'0.[A-Z]' ).search (release ['tag_name' ]).group (0 )
3307
+ # Skip hardcoded releases
3308
+ if stable_name in cons .STABLE_ASSETS :
3309
+ continue
3310
+ if release ['prerelease' ]:
3311
+ stable_name += ' release candidate'
3312
+ tmp_changelog += f'<h3>{ stable_name } </h3> <p><a href="https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/changelog.txt">Changelog</a></p>'
3313
+ else :
3314
+ tmp_changelog += f'<h3>{ stable_name } { release ["name" ]} </h3>' + '<p>' + release ['body' ] + '</p>'
3315
+ stable_assets = list (filter (lambda d : build_regex .match (d ['name' ]), release ['assets' ]))
3316
+ # We simply get the first valid build
3317
+ if isinstance (stable_assets , list ) and len (stable_assets ) > 1 :
3318
+ build = {
3319
+ 'url' : stable_assets [0 ]['browser_download_url' ],
3320
+ 'name' : stable_name ,
3321
+ 'number' : tag ,
3322
+ 'date' : arrow .get (stable_assets [0 ]['created_at' ]).datetime
3323
+ }
3324
+ builds .append (build )
3325
+
3270
3326
for stable_version in cons .STABLE_ASSETS :
3271
3327
version_details = cons .STABLE_ASSETS [stable_version ]
3272
3328
@@ -3310,7 +3366,7 @@ def refresh_builds(self):
3310
3366
3311
3367
# Populate stable changelog
3312
3368
3313
- self .changelog_content .setHtml (cons .STABLE_CHANGELOG )
3369
+ self .changelog_content .setHtml (tmp_changelog + cons .STABLE_CHANGELOG )
3314
3370
3315
3371
3316
3372
elif selected_branch is self .experimental_radio_button :
@@ -3499,8 +3555,8 @@ def step(self):
3499
3555
self .deleting = True
3500
3556
3501
3557
progress_bar = QProgressBar ()
3502
- progress_bar . setRange (0 , self .total_files )
3503
- progress_bar .setValue ( 0 )
3558
+ self . scale_factor = max (0 , int ( self .total_copy_size . bit_length ()) - 31 )
3559
+ progress_bar .setRange ( 0 , self . total_copy_size >> self . scale_factor )
3504
3560
self .status_bar .addWidget (progress_bar )
3505
3561
self .progress_bar = progress_bar
3506
3562
0 commit comments