Last active
August 5, 2018 18:37
-
-
Save matham/2005a18d8c94c9edd5a6890eef4f4d61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileChooserProgress(FileChooserProgressBase): | |
@KV() | |
def apply_kv(self): | |
with KVCtx(): | |
self.pos_hint = {'x': 0, 'y': 0} | |
with self.canvas: | |
Factory.Color(rgba=(0, 0, 0, .8)) | |
rect = Factory.Rectangle() | |
rect.pos ^= self.pos | |
rect.size ^= self.size | |
opening = self << Factory.Label( | |
pos_hint={'x': .2, 'y': .6}, size_hint=(.6, .2)) | |
opening.text @= 'Opening %s' % self.path | |
flt = self << Factory.FloatLayout( | |
pos_hint={'x': .2, 'y': .4}, size_hint=(.6, .2)) | |
pb = flt << Factory.ProgressBar(pos_hint={'x': 0, 'center_y': .5}) | |
pb.max @= self.total | |
pb.value @= self.index | |
label = flt << Factory.Label( | |
pos_hint={'x': 0}, size_hint_y=None, | |
font_size='13sp', color=(.8, .8, .8, .8)) | |
label.text @= '%d / %d' % (self.index, self.total) | |
label.height @= label.texture_size[1] | |
label.y @= pb.center_y - label.height - 8 | |
anchor = self << Factory.AnchorLayout( | |
pos_hint={'x': .2, 'y': .2}, size_hint=(.6, .2)) | |
btn = anchor << Factory.Button( | |
text='Cancel', size_hint=(None, None), size=(150, 44)) | |
with KVRule(btn.on_release): | |
self.cancel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileChooserProgress(FileChooserProgressBase): | |
@KV() | |
def apply_kv(self): | |
with KVCtx(): | |
self.pos_hint = {'x': 0, 'y': 0} | |
with self.canvas: | |
Factory.Color(rgba=(0, 0, 0, .8)) | |
rect = Factory.Rectangle() | |
rect.pos ^= self.pos | |
rect.size ^= self.size | |
opening = Factory.Label( | |
pos_hint={'x': .2, 'y': .6}, size_hint=(.6, .2)) | |
opening.text @= 'Opening %s' % self.path | |
flt = Factory.FloatLayout( | |
pos_hint={'x': .2, 'y': .4}, size_hint=(.6, .2)) | |
pb = Factory.ProgressBar(pos_hint={'x': 0, 'center_y': .5}) | |
pb.max @= self.total | |
pb.value @= self.index | |
label = Factory.Label( | |
pos_hint={'x': 0}, size_hint_y=None, font_size='13sp', | |
color=(.8, .8, .8, .8)) | |
label.text @= '%d / %d' % (self.index, self.total) | |
label.height @= label.texture_size[1] | |
label.y @= pb.center_y - label.height - 8 | |
anchor = Factory.AnchorLayout( | |
pos_hint={'x': .2, 'y': .2}, size_hint=(.6, .2)) | |
btn = Factory.Button( | |
text='Cancel', size_hint=(None, None), | |
size=(150, 44)) | |
with KVRule(btn.on_release): | |
self.cancel() | |
with self: | |
with opening: | |
pass | |
with flt: | |
with pb: | |
pass | |
with label: | |
pass | |
with anchor: | |
with btn: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileChooserProgress(FileChooserProgressBase): | |
@KV() | |
def apply_kv(self): | |
with KVCtx(): | |
with -self: | |
self.pos_hint = {'x': 0, 'y': 0} | |
with ~self.canvas: | |
with ~Factory.Color(rgba=(0, 0, 0, .8)): | |
pass | |
with ~Factory.Rectangle() as rect: | |
rect.pos ^= self.pos | |
rect.size ^= self.size | |
with -Factory.Label( | |
pos_hint={'x': .2, 'y': .6}, | |
size_hint=(.6, .2)) as opening: | |
opening.text @= 'Opening %s' % self.path | |
with -Factory.FloatLayout( | |
pos_hint={'x': .2, 'y': .4}, size_hint=(.6, .2)): | |
with -Factory.ProgressBar( | |
pos_hint={'x': 0, 'center_y': .5}) as pb: | |
pb.max @= self.total | |
pb.value @= self.index | |
with -Factory.Label( | |
pos_hint={'x': 0}, size_hint_y=None, | |
font_size='13sp', color=(.8, .8, .8, .8)) as label: | |
label.text @= '%d / %d' % (self.index, self.total) | |
label.height @= label.texture_size[1] | |
label.y @= pb.center_y - label.height - 8 | |
with -Factory.AnchorLayout( | |
pos_hint={'x': .2, 'y': .2}, size_hint=(.6, .2)) | |
with -Factory.Button( | |
text='Cancel', size_hint=(None, None), | |
size=(150, 44)) as btn: | |
pass | |
with KVRule(btn.on_release): | |
self.cancel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileChooserProgress(FileChooserProgressBase): | |
@KV() | |
def apply_kv(self): | |
with KVCtx(): | |
self.pos_hint = {'x': 0, 'y': 0} | |
with self.canvas: | |
Factory.Color(rgba=(0, 0, 0, .8)) | |
rect = Factory.Rectangle() | |
rect.pos ^= self.pos | |
rect.size ^= self.size | |
opening = Factory.Label( | |
parent=self, pos_hint={'x': .2, 'y': .6}, size_hint=(.6, .2)) | |
opening.text @= 'Opening %s' % self.path | |
flt = Factory.FloatLayout( | |
parent=self, pos_hint={'x': .2, 'y': .4}, size_hint=(.6, .2)) | |
pb = Factory.ProgressBar( | |
parent=flt, pos_hint={'x': 0, 'center_y': .5}) | |
pb.max @= self.total | |
pb.value @= self.index | |
label = Factory.Label( | |
parent=flt, pos_hint={'x': 0}, size_hint_y=None, | |
font_size='13sp', color=(.8, .8, .8, .8)) | |
label.text @= '%d / %d' % (self.index, self.total) | |
label.height @= label.texture_size[1] | |
label.y @= pb.center_y - label.height - 8 | |
anchor = Factory.AnchorLayout( | |
parent=self, pos_hint={'x': .2, 'y': .2}, size_hint=(.6, .2)) | |
btn = Factory.Button( | |
parent=anchor, text='Cancel', size_hint=(None, None), | |
size=(150, 44)) | |
with KVRule(btn.on_release): | |
self.cancel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileChooserProgress(FileChooserProgressBase): | |
@KV() | |
def apply_kv(self): | |
with KVCtx(): | |
with self: | |
self.pos_hint = {'x': 0, 'y': 0} | |
with self.canvas: | |
Factory.Color(rgba=(0, 0, 0, .8)) | |
rect = Factory.Rectangle() | |
rect.pos ^= self.pos | |
rect.size ^= self.size | |
with Factory.Label( | |
parent=self, pos_hint={'x': .2, 'y': .6}, | |
size_hint=(.6, .2)) as opening: | |
opening.text @= 'Opening %s' % self.path | |
with Factory.FloatLayout( | |
parent=self, pos_hint={'x': .2, 'y': .4}, | |
size_hint=(.6, .2)) as flt: | |
with Factory.ProgressBar( | |
parent=flt, | |
pos_hint={'x': 0, 'center_y': .5}) as pb: | |
pb.max @= self.total | |
pb.value @= self.index | |
with Factory.Label( | |
parent=flt, pos_hint={'x': 0}, size_hint_y=None, | |
font_size='13sp', color=(.8, .8, .8, .8)) as label: | |
label.text @= '%d / %d' % (self.index, self.total) | |
label.height @= label.texture_size[1] | |
label.y @= pb.center_y - label.height - 8 | |
with Factory.AnchorLayout( | |
parent=self, pos_hint={'x': .2, 'y': .2}, | |
size_hint=(.6, .2)) as anchor: | |
btn = Factory.Button( | |
parent=anchor, text='Cancel', size_hint=(None, None), | |
size=(150, 44)) | |
with KVRule(btn.on_release): | |
self.cancel() |
tshirtman
commented
Aug 5, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment