def minimise_app(*args): if platform is 'android': PythonActivity = autoclass('org.kivy.android.PythonActivity') Intent = autoclass('android.content.Intent') intent = Intent(Intent.ACTION_MAIN) intent.addCategory(Intent.CATEGORY_HOME) intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) currentActivity = cast('android.app.Activity', PythonActivity.mActivity) currentActivity.startActivity(intent) else: Window.minimize() return True
def on_kv_post(self, base_widget): self.children_to_light = [self.ids.current_path, self.ids.search] self.files_space = self.ids.files_space self.progress_box = self.ids.progress_box self.base_path = '' self.current_path = default_remote() self.connect() if self.sftp and len(sys.argv) > 1 and 'kill' not in sys.argv: Window.minimize() for file in sys.argv[1:]: self.external_dropfile(file.encode(), self.current_path) self.set_view() check_for_updates(on_popup=self.on_popup, on_dismiss=self.on_popup_dismiss)
def valid_commit(instance, value): # Here, modified/created/... files have already been # added by inotify event handlers, we just have to change # the branch and push the commit according to what user # entered. branch_name = instance.text_branch.text if (branch_name != "" and branch_name != "Branch"): try: dev_branch = repo.heads["%s" % branch_name] except IndexError: dev_branch = repo.create_head("%s" % branch_name) # And work on this new branch. dev_branch.checkout() repo.index.commit("%s" % instance.text_commit.text) Window.minimize()
def build(self): self.text_branch = TextInput(text="Branch", multiline=False) self.text_commit = TextInput(text="Commit", Focus=True) btn = Button(text="Ok") btn.bind(on_press=self.valid_commit) self.layout = GridLayout(cols=1, row_force_default=True, row_default_height=55, col_force_default=True, col_default_width=480, padding=10, spacing=10) self.layout.add_widget(self.text_branch) self.layout.add_widget(self.text_commit) self.layout.add_widget(btn) Window.bind(on_close=self.exit_app) # TODO: upgrade to kivy 1.9.2 # Window.bind(on_restore = self.restore) Window.minimize() return self.layout
def minimize(self, *_): Window.minimize()
def minimize_window(self): Window.disable_on_restore = 'Y' Window.minimize() Window.window_state = 'minimized' Clock.unschedule(ButtonsApp.minimize_window)
def on_touch_down(self, touch): if touch.button == 'left': #only run all this on a left click.. global touch_down_active global last_mouse_pos_x global last_mouse_pos_y global start_window_height global start_window_width global start_window_top global start_window_left global start_pos_x global start_pos_y global window_resize_feature global icon_active touch_down_active = 'N' window_resize_feature = 'disabled' title_bar_button_clicked = 'N' start_window_height = Window.size[1] start_window_width = Window.size[0] start_window_top = Window.top start_window_left = Window.left start_pos_x = mouse2.position[0] start_pos_y = mouse2.position[1] #//Minimize Button Clicked// if self.ids.s1.collide_point(touch.pos[0], touch.pos[1]): threading.Thread( target=self.disable_window_move_resize).start() Window.last_screen_pos_left = Window.left Window.last_screen_pos_top = Window.top Window.minimize() Window.window_state = 'minimized' title_bar_button_clicked = 'Y' if self.ids.s2.collide_point(touch.pos[0], touch.pos[1]): #//Window Button Clicked// if icon_active == 'window': threading.Thread( target=self.disable_window_move_resize).start() Window.disable_on_restore = 'N' Window.last_screen_width = Window.original_screen_width / 2 Window.last_screen_height = Window.original_screen_height / 2 Window.on_restore() #change the button to a maximize button.. self.ids.s2.size = [25, 20] self.ids.s2.pos = [ int(Window.size[0] - (self.get_screen_width() * .03958333)), int(Window.size[1] - (self.get_screen_height() * .02403846)) ] self.ids.t2.size = [12, 12] self.ids.t2.pos = [ int(Window.size[0] - (self.get_screen_width() * .03645833)), int(Window.size[1] - (self.get_screen_height() * .02115385)) ] self.ids.t2.source = 'maximize_icon_blue.png' touch_down_active = 'N' icon_active = 'maximize' title_bar_button_clicked = 'Y' #//Maximize Button Clicked// elif icon_active == 'maximize': threading.Thread( target=self.disable_window_move_resize).start() Window.disable_on_restore = 'N' #find which monitor the window is currently using window left and top position - look in taskbar included position coordinates i = 0 for row in Window.monitor_data_incl_taskbar: if Window.left >= row[0] and Window.left < row[ 1] and Window.top >= row[ 2] and Window.top < row[3]: break #stop the loop and use i below i = i + 1 #update window position and size Window.last_screen_pos_left = Window.monitor_data_excl_taskbar[ i][0] Window.last_screen_pos_top = Window.monitor_data_excl_taskbar[ i][2] Window.last_screen_width = Window.monitor_data_excl_taskbar[ i][4] Window.last_screen_height = Window.monitor_data_excl_taskbar[ i][5] Window.on_restore() #change the button to a window button.. self.ids.s2.size = [25, 20] self.ids.s2.pos = [ int(Window.size[0] - (self.get_screen_width() * .03854167)), int(Window.size[1] - (self.get_screen_height() * .02403846)) ] self.ids.t2.size = [15, 15] self.ids.t2.pos = [ int(Window.size[0] - (self.get_screen_width() * .03645833)), int(Window.size[1] - (self.get_screen_height() * .02307692)) ] self.ids.t2.source = 'window_icon_blue.png' icon_active = 'window' title_bar_button_clicked = 'Y' #//Close Button Clicked// if self.ids.s3.collide_point( touch.pos[0], touch.pos[1]): #if close button is clicked.. ButtonsApp.mouse_listener_active = 'N' ButtonsApp.click_listener_active = 'N' Window.close() if touch.pos[1] > Window.size[ 1] - 30 and title_bar_button_clicked == 'N': #this will limit dragging of the window to only when the cursor is near the very TOP of the window.. ButtonsApp.window_move_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' else: ButtonsApp.window_move_active = 'N' ButtonsApp.mouse_listener_active2 = 'N' #//Window Resize Feature Activated// if icon_active == 'maximize' and title_bar_button_clicked == 'N': #here is where we determine which window drag feature the user is trying to utilize #//BOTTOM - North to South// if (touch.pos[1] < 7 and touch.pos[0] < Window.size[0] - 7 ) and (touch.pos[1] < 7 and touch.pos[0] > 7): window_resize_feature = 'n_s_b' #north to south arrow for vertical sizing ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//BOTTOM RIGHT - Northwest to Southeast// elif touch.pos[1] < 7 and touch.pos[0] > Window.size[0] - 7: window_resize_feature = 'nw_se_b' #northwest to southeast arrow for diagonal sizing ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//RIGHT SIDE - West to East// elif (touch.pos[1] > 8 and touch.pos[0] > Window.size[0] - 7 ) and (touch.pos[1] < Window.size[1] - 8 and touch.pos[0] > Window.size[0] - 7): window_resize_feature = 'w_e_r' #west to east arrow for horizontal sizing ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//TOP - North to South// elif (touch.pos[1] > Window.size[1] - 7 and touch.pos[0] < Window.size[0] - 7) and ( touch.pos[1] > Window.size[1] - 7 and touch.pos[0] > 7): window_resize_feature = 'n_s_t' ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//TOP RIGHT - Northeast to Southwest// elif touch.pos[1] > Window.size[1] - 7 and touch.pos[ 0] > Window.size[0] - 7: window_resize_feature = 'ne_sw_t' ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//TOP LEFT - Northwest to Southeast// elif touch.pos[1] > Window.size[1] - 7 and touch.pos[0] < 7: window_resize_feature = 'nw_se_t' ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//LEFT SIDE - West to East// elif (touch.pos[1] > 8 and touch.pos[0] < 7) and (touch.pos[1] < Window.size[1] - 8 and touch.pos[0] < 7): window_resize_feature = 'w_e_l' ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//BOTTOM LEFT - Northeast to Southwest// elif touch.pos[1] < 7 and touch.pos[0] < 7: window_resize_feature = 'ne_sw_b' ButtonsApp.window_move_active = 'N' ButtonsApp.window_resize_active = 'Y' ButtonsApp.mouse_listener_active2 = 'Y' #//ANYTHING ELSE// else: window_resize_feature = 'disabled' ButtonsApp.window_resize_active = 'N' touch_down_active = 'Y' return super(ButtonsApp, self).on_touch_down(touch)
def minimize_app(self): """Minimize App window.""" Window.minimize()
def minimize(self): Window.minimize()
def minimize(): Window.minimize()