def EncryptedVolumePrompt(self, error_message=None): """Prompt for any "unlock" kind of action.""" if isinstance(error_message, Tkinter.Event): error_message = None self._PrepTop(error_message) _, encrypted_volumes, _ = corestorage.GetStateAndVolumeIds() Tkinter.Label( self.top_frame, text='Pick one of the following encrypted volumes:').pack( anchor=Tkinter.W) self.unlock_volume = Tkinter.StringVar() self.unlock_volume.set(encrypted_volumes[0]) for volume in encrypted_volumes: size = corestorage.GetVolumeSize(volume) text = '%s %s' % (volume, size) Tkinter.Radiobutton( self.top_frame, text=text, variable=self.unlock_volume, value=volume ).pack(anchor=Tkinter.W) Tkinter.Label( self.top_frame, text='Pick an action:').pack(anchor=Tkinter.W) self.action = Tkinter.StringVar() self.action.set(self.REVERT_ACTION) for action, action_text in self.ACTIONS.items(): Tkinter.Radiobutton( self.top_frame, variable=self.action, text=action_text, value=action ).pack(anchor=Tkinter.W) Tkinter.Button( self.top_frame, text='Continue', command=self._EncryptedVolumeAction ).pack() self.root.mainloop()
def main(): if options.debug: logging.getLogger().setLevel(logging.DEBUG) if options.version: print 'UNKNOWN' return 0 if options.login_type == 'clientlogin': gui = tkinter.GuiClientLogin(options.server_url) else: raise NotImplementedError('Unsupported login type: %s', options.login_type) _, encrypted_volumes, _ = corestorage.GetStateAndVolumeIds() try: if encrypted_volumes: gui.EncryptedVolumePrompt() else: gui.PlainVolumePrompt(options.no_welcome) except Exception as e: # pylint: disable=broad-except gui.ShowFatalError(e) return 1 return 0
def main(options): if options.login_type == 'oauth2': gui = tkinter.GuiOauth(options.server_url) else: raise NotImplementedError('Unsupported login type: %s', options.login_type) _, encrypted_volumes, _ = corestorage.GetStateAndVolumeIds() try: if encrypted_volumes: gui.EncryptedVolumePrompt() else: gui.PlainVolumePrompt(options.no_welcome) except Exception as e: # pylint: disable=broad-except gui.ShowFatalError(e) return 1 return 0