我们从Python开源项目中,提取了以下20个代码示例,用于说明如何使用gtk.MESSAGE_INFO。
def info(self, msg): infodialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, str(msg)) infodialog.set_position(gtk.WIN_POS_CENTER_ALWAYS) infodialog.show_all() response_info= infodialog.run() if response_info == gtk.RESPONSE_OK: infodialog.hide() infodialog.destroy() # ??????? ??????? ??????????? ???? "? ?????????"
def show_help_main(self,args): self.help_text = ("<b>Install Help</b>\n\n- All LVM partitions need to take less than or equal to 100% of the LVM Volume Group.\n\n- Pressing OK prompts for a password to encrypt Disk (LUKS), GRUB, and admin password.\n\n- The sshusers group controls remote access, wheel group is for root users, and isso group is for limited root with auditing permissions.\n\n- To access root remotely via ssh you need to create a user and add them to the wheel and sshusers groups.\n\n- Minimum password length is 15 characters, using a strong password is recommended.\n") self.MessageBox(self.window,self.help_text,gtk.MESSAGE_INFO) # System Profile Configuration
def MessageBox(self,parent,text,type=gtk.MESSAGE_INFO): message = gtk.MessageDialog(parent,0,type,gtk.BUTTONS_OK) message.set_markup(text) response = message.run() if response == gtk.RESPONSE_OK: message.destroy() # Get Password
def python_colorize(image, layer): """Colorize plugin""" image.disable_undo() print(image, layer) colorize.check_api_key() # 1. Save actual image to GIMP TEMP direcotry as PNG bw_photo = save_tmp_file(image, layer, image.filename) print("Temp file saved in: " + bw_photo) gimpfu.gimp.progress_init("Uploading image for processing.") # 2. Upload file to the server # gui_message( # "Image is being processed at <u>{0}</u>.\nIt may take a while.".format(colorize.URL), # gtk.MESSAGE_INFO # ) # TODO: information window that data are uploaded. download_url = colorize.upload_image(bw_photo) if download_url == '': # if empty => error gui_message(colorize.ALG_API_ERR, gtk.MESSAGE_ERROR) gimpfu.gimp.quit() else: print("download_url: " + download_url) # 3. Download it from the server if download_url: color_photo = colorize.download_image(download_url, bw_photo) # 4. Display result as a new image if color_photo: gimpfu.gimp.Display( gimpfu.pdb.file_png_load(color_photo, color_photo) ) gimpfu.gimp.progress_init("Colorized data received...") image.enable_undo() #################### # Plug-in register # ####################
def saver(self, text): file_name = save_bar.get_text() start_iter = textbuffer.get_start_iter() end_iter = textbuffer.get_end_iter() file_data = textbuffer.get_text(start_iter, end_iter, True) with open('Reports/'+file_name, 'w') as file: file.write(file_data) file.close() done = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK) done.set_markup("<big><b>File {} Has Been Saved</b></big>".format(file_name)) done.run()
def show_message(message,title): message_dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, None); message_dialog.set_markup(message); message_dialog.set_title(title) message_dialog.run(); #?????dialog
def show_alert_message(parent_window, msg): alert = gtk.MessageDialog(parent_window, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, msg) alert.run() alert.destroy()
def parse_all(self, event): for collector in self.engine.collectors: collector.parser.parse() # alert = gtk.MessageDialog(self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, # gtk.BUTTONS_CLOSE, "Parsing complete") # alert.run() # alert.destroy()
def show_confirmation_dialog(self, msg): dialog = gtk.MessageDialog(self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_YES_NO, msg) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: return True return False
def message(message, parent=None): dia = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, message) dia.show() dia.run() dia.destroy() return False
def message(self, message): dia = gtk.MessageDialog(self.window, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, message) dia.show() dia.run() dia.destroy() return False
def show_about(self, widget): dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, """ PiJuice battery level status """) dialog.run() dialog.destroy()
def info(msg, parent=None): if mac: macutils.createAlert(msg) else: dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, msg) dialog.set_skip_taskbar_hint(False) dialog.run() dialog.destroy()
def show_msg_dialog(self, dlg_type=gtk.MESSAGE_INFO, dlg_buttons=gtk.BUTTONS_OK, msg=None): """display a MessageDialog""" mdlg = gtk.MessageDialog(type=dlg_type, buttons=dlg_buttons, message_format=msg) resp = mdlg.run() mdlg.destroy() #done return resp #map getitem to getattr
def _updates(self, version): if not version: return if version == CHIRP_VERSION: return LOG.info("Server reports version %s is available" % version) # Report new updates every seven days intv = 3600 * 24 * 7 if CONF.is_defined("last_update_check", "state") and \ (time.time() - CONF.get_int("last_update_check", "state")) < intv: return CONF.set_int("last_update_check", int(time.time()), "state") d = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, parent=self, type=gtk.MESSAGE_INFO) d.set_property("text", _("A new version of CHIRP is available: " + "{ver}. ".format(ver=version) + "It is recommended that you upgrade, so " + "go to http://chirp.danplanet.com soon!")) d.run() d.destroy()
def display_no_zipcode_or_latitude_error_box(self): md = gtk.MessageDialog(self.window, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "The f.lux indicator applet needs to know " + "your latitude or zipcode to run. " + "Please fill either of them in on the preferences screen "+ "and click 'Close'.") md.set_title("f.lux indicator applet") md.run() md.destroy()