Skip to content

Commit

Permalink
Merge remote-tracking branch 'remote/master' into parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauszus committed Mar 14, 2020
2 parents f3ec4f7 + 9f00bee commit 2c99178
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
2 changes: 2 additions & 0 deletions kivy/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ class struct_tv(ctypes.Structure):
# 12: CLOCK_MONOTONIC_FAST (FreeBSD specific)
Logger.debug('clock.py: {{{:s}}} clock ID {:d}'.format(
platform, _clockid))
elif 'openbsd' in platform:
_clockid = 3 # CLOCK_MONOTONIC
else:
_clockid = 1 # CLOCK_MONOTONIC

Expand Down
27 changes: 18 additions & 9 deletions kivy/tools/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,20 @@ def make_gallery_page(infos):

def a(s=''):
''' append formatted s to output, which will be joined into lines '''
output.append(s.format(**info))
for info in infos:
output.append(s.format(**info))

def t(left='', right=''):
''' append left and right format strings into a table line. '''
l = left.format(**info)
r = right.format(**info)
if len(l) > width1 or len(r) > width2:
Logger.error('items to wide for generated table: "%s" and "%s"',
l, r)
return
output.append('| {0:{w1}} | {1:{w2}} |'
.format(l, r, w1=width1, w2=width2))
for info in infos:
l = left.format(**info)
r = right.format(**info)
if len(l) > width1 or len(r) > width2:
Logger.error('items to wide for generated table: "%s" and "%s"',
l, r)
return
output.append('| {0:{w1}} | {1:{w2}} |'
.format(l, r, w1=width1, w2=width2))

gallery_top = '''
Gallery
Expand Down Expand Up @@ -303,6 +305,13 @@ def a(s=''):

def write_file(name, s):
''' write the string to the filename '''

# Make sure all the directories has been created before
# trying to write to the file
directory = os.path.dirname(name)
if not os.path.exists(directory):
os.makedirs(directory)

with open(name, 'w') as f:
f.write(s)

Expand Down

0 comments on commit 2c99178

Please sign in to comment.