Example #1
0
    def show_datepicker(self, mode):
        ui.end_editing()
        self.shield_view = ui.View()
        self.shield_view.flex = 'WH'
        self.shield_view.frame = (0, 0, self.view.width, self.view.height)

        self.dismiss_datepicker_button = ui.Button()
        self.dismiss_datepicker_button.flex = 'WH'
        self.dismiss_datepicker_button.frame = (0, 0, self.view.width,
                                                self.view.height)
        self.dismiss_datepicker_button.background_color = (0, 0, 0, 0.5)
        self.dismiss_datepicker_button.action = self.dismiss_datepicker
        self.dismiss_datepicker_button.alpha = 0.0
        self.shield_view.add_subview(self.dismiss_datepicker_button)

        self.date_picker = ui.DatePicker()
        self.date_picker.date = self.selected_date_value
        self.date_picker.background_color = 'white'
        self.date_picker.mode = mode
        self.date_picker.frame = (0, self.shield_view.height -
                                  self.date_picker.height,
                                  self.shield_view.width,
                                  self.date_picker.height)
        self.date_picker.flex = 'TW'
        self.date_picker.transform = ui.Transform.translation(
            0, self.date_picker.height)
        self.shield_view.add_subview(self.date_picker)

        self.container_view.add_subview(self.shield_view)

        def fade_in():
            self.dismiss_datepicker_button.alpha = 1.0
            self.date_picker.transform = ui.Transform.translation(0, 0)

        ui.animate(fade_in, 0.3)
Example #2
0
    def photoBooth(self, sender):
        ui.end_editing()
        self.booth = ui.View()
        self.booth.flex = 'WH'
        self.booth.frame = (0, 0, self.view.width, self.view.height)

        self.dismiss_booth_button = ui.Button()
        self.dismiss_booth_button.flex = 'WH'
        self.dismiss_booth_button.frame = (0, 0, self.view.width,
                                           self.view.height)
        self.dismiss_booth_button.background_color = (0, 0, 0, 0.5)
        self.dismiss_booth_button.action = self.dismiss_booth
        self.dismiss_booth_button.alpha = 1.0
        self.booth.add_subview(self.dismiss_booth_button)

        self.snap = ui.Button()
        self.snap.title = 'Snap!'
        self.snap.background_color = 'white'
        self.snap.height = 200
        self.snap.frame = (0, self.booth.height - self.snap.height,
                           self.booth.width, self.snap.height)
        self.snap.flex = 'TW'
        self.snap.action = take_photo
        self.booth.add_subview(self.snap)

        self.container_view.add_subview(self.booth)
Example #3
0
	def done_action(self, sender):
		if self.shield_view:
			self.dismiss_datepicker(None)
		else:
			ui.end_editing()
			self.was_canceled = False
			self.container_view.close()
Example #4
0
	def done_action(self, sender):
		if self.shield_view:
			self.dismiss_datepicker(None)
		else:
			ui.end_editing()
			self.was_canceled = False
			self.container_view.close()
Example #5
0
	def show_datepicker(self, mode):
		ui.end_editing()
		self.shield_view = ui.View()
		self.shield_view.flex = 'WH'
		self.shield_view.frame = (0, 0, self.view.width, self.view.height)
		
		self.dismiss_datepicker_button = ui.Button()
		self.dismiss_datepicker_button.flex = 'WH'
		self.dismiss_datepicker_button.frame = (0, 0, self.view.width, self.view.height)
		self.dismiss_datepicker_button.background_color = (0, 0, 0, 0.5)
		self.dismiss_datepicker_button.action = self.dismiss_datepicker
		self.dismiss_datepicker_button.alpha = 0.0
		self.shield_view.add_subview(self.dismiss_datepicker_button)

		self.date_picker = ui.DatePicker()
		self.date_picker.date = self.selected_date_value
		self.date_picker.background_color = 'white'
		self.date_picker.mode = mode
		self.date_picker.frame = (0, self.shield_view.height - self.date_picker.height, self.shield_view.width, self.date_picker.height)
		self.date_picker.flex = 'TW'
		self.date_picker.transform = ui.Transform.translation(0, self.date_picker.height)
		self.shield_view.add_subview(self.date_picker)

		self.container_view.add_subview(self.shield_view)
		
		def fade_in():
			self.dismiss_datepicker_button.alpha = 1.0
			self.date_picker.transform = ui.Transform.translation(0, 0)
		ui.animate(fade_in, 0.3)
 def done_action(self, sender):
     if callable(self.validator):
         invalid_keys = self.validator(self.values)
         if invalid_keys:
             for i, (title, fields) in enumerate(self.sections):
                 for j, field in enumerate(fields):
                     cell = self.cells[i][j]
                     if field['key'] in invalid_keys:
                         cell.text_label.text_color = 'red'
                     else:
                         cell.text_label.text_color = None
             return
     if self.shield_view:
         self.dismiss_datepicker(None)
     else:
         ui.end_editing()
         self.was_canceled = False
         self.container_view.close()
Example #7
0
	def show_panel(self):
		'''
		stops us showing muliple times.because we make this class
		on the fly, storing states inside the class does not make
		sense so we strore them in the parent :(
		'''
		if hasattr(self.parent, 'panel_displayed'):
			if self.parent.panel_displayed:
				return

		self.parent.panel_displayed = True

		ui.end_editing()

		# save and disable the menu buttons
		self.disable_menu_buttons()

		# removed the shield view. didnt think it was needed
		# as ui.Button is a ui.View. i changed some alpha vals.
		# seems to work the same...i hope so
		self.dismiss = ui.Button()
		self.dismiss.flex = 'WH'
		self.dismiss.frame = (0, 0, self.p_width, self.p_height)
		self.dismiss.background_color = (0, 0, 0, 0.5)
		self.dismiss.action = self.dismiss_action
		self.dismiss.alpha = 0.0

		self.panel.frame = (0, self.dismiss.height - self.panel.height,
		self.dismiss.width, self.panel.height )

		self.panel.flex = 'TW'
		self.panel.transform = ui.Transform.translation(0, self.panel.height)
		self.dismiss.add_subview(self.panel)

		self.view.add_subview(self.dismiss)

		def fade_in():
			self.dismiss.alpha = 1.0
			self.panel.transform = ui.Transform.translation(0, 0)

		ui.animate(fade_in, self.fade_in_duration)
Example #8
0
	def show_panel(self):
		'''
		stops us showing muliple times.because we make this class
		on the fly, storing states inside the class does not make
		sense so we strore them in the parent :(
		'''
		if hasattr(self.parent, 'panel_displayed'):
			if self.parent.panel_displayed:
				return

		self.parent.panel_displayed = True

		ui.end_editing()

		# save and disable the menu buttons
		self.disable_menu_buttons()

		# removed the shield view. didnt think it was needed
		# as ui.Button is a ui.View. i changed some alpha vals.
		# seems to work the same...i hope so
		self.dismiss = ui.Button()
		self.dismiss.flex = 'WH'
		self.dismiss.frame = (0, 0, self.p_width, self.p_height)
		self.dismiss.background_color = (0, 0, 0, 0.5)
		self.dismiss.action = self.dismiss_action
		self.dismiss.alpha = 0.0

		self.panel.frame = (0, self.dismiss.height - self.panel.height,
		self.dismiss.width, self.panel.height )

		self.panel.flex = 'TW'
		self.panel.transform = ui.Transform.translation(0, self.panel.height)
		self.dismiss.add_subview(self.panel)

		self.view.add_subview(self.dismiss)

		def fade_in():
			self.dismiss.alpha = 1.0
			self.panel.transform = ui.Transform.translation(0, 0)

		ui.animate(fade_in, self.fade_in_duration)
	def my_done_action(sender):
		# check if needed fields are filled
		#print('my_done_action',c.values)
		c.error_message.text = ''		
		if c.values['title'].strip() == '':
			c.error_message.text = 'title has to be defined'
			return
		if c.values['script'].strip() == '' and c.values['url'].strip() == '':
			c.error_message.text = 'script or url has to be defined'
			return
		if c.values['url'].strip() != '' and c.values['arguments'].strip() != '':
			c.error_message.text = 'arguments not allowed if url'
			return
		if 'icon' not in c.values:
			c.error_message.text = 'icon not defined'
			return		
		if c.shield_view:
			c.dismiss_datepicker(None)
		else:
			ui.end_editing()
			c.was_canceled = False
			c.container_view.close()
Example #10
0
 def my_done_action(sender):
     # check if needed fields are filled
     #print('my_done_action',c.values)
     c.error_message.text = ''
     if c.values['title'].strip() == '':
         c.error_message.text = 'title has to be defined'
         return
     if c.values['script'].strip() == '' and c.values['url'].strip() == '':
         c.error_message.text = 'script or url has to be defined'
         return
     if c.values['url'].strip() != '' and c.values['arguments'].strip(
     ) != '':
         c.error_message.text = 'arguments not allowed if url'
         return
     if 'icon' not in c.values:
         c.error_message.text = 'icon not defined'
         return
     if c.shield_view:
         c.dismiss_datepicker(None)
     else:
         ui.end_editing()
         c.was_canceled = False
         c.container_view.close()
Example #11
0
 def done_action(self, sender):
     ui.end_editing()
     self.text = self.view.text
     self.view.close()
Example #12
0
	def done_action(self, sender):
		ui.end_editing()
		self.text = self.view.text
		self.view.close()