Python wx 模块,ICON_EXCLAMATION 实例源码

我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用wx.ICON_EXCLAMATION

项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def on_ok(self, event):
        if not os.path.exists(self.out_dir.GetPath()):
            os.makedirs(self.out_dir.GetPath())
        self.num_songs = len(self.in_files)
        if self.num_songs <= 0:
            alert = wx.MessageDialog(self, "No songs selected!", "pyjam", wx.ICON_EXCLAMATION)
            alert.ShowModal()
            alert.Destroy()
            return

        self.progress_dialog = wx.ProgressDialog(title="Conversion", message="Converting songs...",
                                                 maximum=self.num_songs * 2, parent=self, style=PD_STYLE)

        self.converter = FFmpegConvertThread(parent=self, dest=self.out_dir.GetPath(), rate=self.game_rate.GetValue(),
                                             vol=self.volume.GetValue(), songs=self.in_files)
        self.converter.start()
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def convert_update(self, message):
        progress = "{songs} out of {total}".format(songs=message // 2, total=self.num_songs)
        if self.progress_dialog and self.converter.isAlive():
            if message >= self.num_songs * 2:
                message = self.num_songs * 2 - 1
            if not self.progress_dialog.Update(value=message, newmsg="Converted: {prog}".format(prog=progress))[0]:
                self.converter.abort()
                self.converter.join()
                self.progress_dialog.Destroy()

                alert_string = "Aborted! Only {progress} songs were converted".format(progress=progress)
                alert = wx.MessageDialog(parent=self, message=alert_string, caption="pyjam", style=wx.ICON_EXCLAMATION)
                alert.ToggleWindowStyle(wx.STAY_ON_TOP)
                alert.ShowModal()
                alert.Destroy()

                logger.info("Audio conversion canceled canceled.")
                logger.info(progress)
                # wx.CallAfter(self.progress_dialog.Destroy)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def OnStartButton(self, e):
        if wpkg_running():
            dlg_msg = _(u"WPKG is currently running,\n"
                        u"please wait a few seconds and try again.")
            dlg = wx.MessageDialog(self, dlg_msg, app_name, wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        dlg_title = _(u"2. Warning")
        dlg_msg = _(u"Close all open programs!\n\nThe System could restart without further confirmation!\n\n" \
                    u"Continue?")
        dlg = wx.MessageDialog(self, dlg_msg, dlg_title, wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wx.ID_YES:
            dlg.Destroy()
            # Disable/enable buttons and disable Close Window option!
            self.startButton.Disable()
            self.abortButton.Enable()
            self.EnableCloseButton(enable=False)
            # Set Start Time
            self.wpkg_start_time = datetime.datetime.now()
            # Reset Log
            self.log = None
            startWorker(self.LongTaskDone, self.LongTask)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def OnAbortButton(self, e):
        if not self.running:
            self.Close()
            return
        dlg_title = _(u"Cancel")
        dlg_msg = _(u"System update in progress!\n\n Canceling this Progress could result in installation issues.\n"
                    u"Cancel?")
        dlg = wx.MessageDialog(self, dlg_msg, dlg_title, wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wx.ID_YES:
            dlg.Destroy()
            if not self.running:
                # WPKG Process by this client has finished, no cancel possible
                return
            print 'Aborting WPKG Process' #TODO: MOVE TO DEBUG LOGGER
            self.shouldAbort = True
            msg = 'Cancel'
            try:
                pipeHandle = CreateFile("\\\\.\\pipe\\WPKG", GENERIC_READ | GENERIC_WRITE, 0, None, OPEN_EXISTING, 0, None)
            except pywintypes.error, (n, f, e):
                print "Error when generating pipe handle: %s" % e #TODO: MOVE TO DEBUG LOGGER
                return 1

            SetNamedPipeHandleState(pipeHandle, PIPE_READMODE_MESSAGE, None, None)
            WriteFile(pipeHandle, msg)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def OnStartButton(self, e):
        if wpkg_running():
            dlg_msg = _(u"WPKG is currently running,\n"
                        u"please wait a few seconds and try again.")
            dlg = wx.MessageDialog(self, dlg_msg, app_name, wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        dlg_title = _(u"2. Warning")
        dlg_msg = _(u"Close all open programs!\n\nThe System could restart without further confirmation!\n\n" \
                    u"Continue?")
        dlg = wx.MessageDialog(self, dlg_msg, dlg_title, wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wx.ID_YES:
            dlg.Destroy()
            # Disable/enable buttons and disable Close Window option!
            self.startButton.Disable()
            self.abortButton.Enable()
            self.EnableCloseButton(enable=False)
            # Set Start Time
            self.wpkg_start_time = datetime.datetime.now()
            # Reset Log
            self.log = None
            startWorker(self.LongTaskDone, self.LongTask)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def OnAbortButton(self, e):
        if not self.running:
            self.Close()
            return
        dlg_title = _(u"Cancel")
        dlg_msg = _(u"System update in progress!\n\n Canceling this Progress could result in installation issues.\n"
                    u"Cancel?")
        dlg = wx.MessageDialog(self, dlg_msg, dlg_title, wx.YES_NO|wx.YES_DEFAULT|wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wx.ID_YES:
            dlg.Destroy()
            if not self.running:
                # WPKG Process by this client has finished, no cancel possible
                return
            print 'Aborting WPKG Process' #TODO: MOVE TO DEBUG LOGGER
            self.shouldAbort = True
            msg = 'Cancel'
            try:
                pipeHandle = CreateFile("\\\\.\\pipe\\WPKG", GENERIC_READ | GENERIC_WRITE, 0, None, OPEN_EXISTING, 0, None)
            except pywintypes.error, (n, f, e):
                print "Error when generating pipe handle: %s" % e #TODO: MOVE TO DEBUG LOGGER
                return 1

            SetNamedPipeHandleState(pipeHandle, PIPE_READMODE_MESSAGE, None, None)
            WriteFile(pipeHandle, msg)
项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def open(self, event):
        dialog = wx.DirDialog(self, 'Select a Turrican II CDTV directory', '', wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST)
        if dialog.ShowModal() != wx.ID_OK:
            return

        directory = dialog.GetPath()
        test_files = ['L1-1', 'L2-1', 'L3-1', 'L4-1', 'L5-1', 'LOADER', 'MAIN']
        for filename in test_files:
            if not os.path.exists(os.path.join(directory, filename)):
                wx.MessageBox('Not a valid Turrican II CDTV directory.', 'Invalid directory', wx.OK | wx.ICON_EXCLAMATION)
                return

        self._game_dir = directory
        self._graphics = Graphics(self._game_dir)
        self.load_worlds()

        self.Entities.set_graphics(self._graphics)
        self.Entities.set_font(self._font)

        self.LevelSelect.SetSelection(0)
        self.select_level(0, 0)
        self.update_menu_state()
        self.update_title()
项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def close(self, event):
        if not self._world:
            event.Skip()
            return

        modified = False
        for level in self._world.levels:
            modified = modified | level.modified

        if modified:
            result = wx.MessageBox('Do you want to save your changes?', 'Unsaved changes', wx.YES_NO | wx.CANCEL | wx.ICON_EXCLAMATION)
            if result == wx.YES:
                self._world.save()
            elif result == wx.CANCEL:
                return

        event.Skip()
项目:hostswitcher    作者:fiefdx    | 项目源码 | 文件源码
def OnDelete(self, evt):
        name = self.combo_box_1.GetValue()
        fpath = os.path.join(DataPath, name)
        if name != "default":
            msg_dialog = wx.MessageDialog(self,
                                          "Are you sure that you want to delete file \"%s\"" % name,
                                          "Delete \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION)
            msg_dialog.Centre(wx.BOTH)
            r = msg_dialog.ShowModal()
            if r == wx.ID_YES:
                if os.path.exists(fpath) and os.path.isfile(fpath):
                    os.remove(fpath)
                    index = self.combo_box_1.GetSelection()
                    self.combo_box_1.Delete(index)
                    self.combo_box_1.Select(0)
            msg_dialog.Destroy()
        else:
            msg_dialog = wx.MessageDialog(self,
                                          "\"%s\" can't be deleted.\nYou can edit it only." % name,
                                          "\"%s\" can't be deleted." % name, wx.OK | wx.ICON_ERROR)
            msg_dialog.Centre(wx.BOTH)
            msg_dialog.ShowModal()
            msg_dialog.Destroy()
项目:hostswitcher    作者:fiefdx    | 项目源码 | 文件源码
def OnSet(self, evt):
        name = self.combo_box_1.GetValue()
        fpath = os.path.join(DataPath, name)
        msg_dialog = wx.MessageDialog(self,
                                      "Are you sure that you want to set file \"%s\" as current hosts" % name,
                                      "Set \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION)
        msg_dialog.Centre(wx.BOTH)
        r = msg_dialog.ShowModal()
        if r == wx.ID_YES:
            with open(fpath, "rb") as fp_src:
                with open("/etc/hosts", "wb") as fp_des:
                    fp_des.write(fp_src.read())
                    self.current = name
                    with open(CurrentHosts, "wb") as fp:
                        fp.write(name)
                    self.statusbar.SetStatusText("Current: %s" % self.current)
        msg_dialog.Destroy()
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def OnOpenEtotV(self, event):
        wildcard =  "dat file (*.dat)|*.dat|" \
                    "All files (*)|*"
        dialog = wx.FileDialog(None, "Choose a file with total energies", os.getcwd(),"", wildcard)
        if dialog.ShowModal() == wx.ID_OK:
            try:
                fname = dialog.GetPath()
                self.V, self.E = read_EtotV(fname)   
                self.IsEtotVRead = True
                self.SetStatusText("E_tot(V) file "+fname+" read")
            except:
                wx.MessageBox("Something wrong while opening the E_tot file... not loaded.",
                "", wx.OK | wx.ICON_EXCLAMATION, self)  

        dialog.Destroy()
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def OnFitisoEtot(self, event):
        try:

            self.a, self.cov, self.chi = fit_Murn(self.V,self.E)
            print_eos_data(self.V,self.E,self.a,self.chi,"Etot")

            fig1 = plot_EV(self.V,self.E,self.a)                    # plot the E(V) data and the fitting line
            fig1.savefig("figure_1.png")

        except:
            wx.MessageBox("Something wrong while fitting total energies...",
                "", wx.OK | wx.ICON_EXCLAMATION, self)
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def OnFitanisoEtot(self, event):
        try:
            wx.MessageBox("Not implemented yet...",
                "", wx.OK | wx.ICON_EXCLAMATION, self)  

        except:
            wx.MessageBox("Something wrong while fitting total energies...",
                "", wx.OK | wx.ICON_EXCLAMATION, self)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def download_update(self, message):
        progress = "{songs} out of {total}".format(songs=message // 100, total=self.num_songs)
        if self.progress_dialog and self.downloader.isAlive():
            if not self.progress_dialog.Update(value=message, newmsg="Downloaded: {prog}".format(prog=progress))[0]:
                self.downloader.abort()
                self.downloader.join()

                alert_string = "Aborted! Only {progress} songs were downloaded".format(progress=progress)
                alert = wx.MessageDialog(parent=self, message=alert_string, caption="pyjam", style=wx.ICON_EXCLAMATION)
                alert.ShowModal()
                alert.Destroy()

                logger.info("Audio download canceled.")
                logger.info(alert_string)
                wx.CallAfter(self.progress_dialog.Destroy)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def ff_update(self, message):
        if self and self.downloader.isAlive():  # True PD has not been destroyed.
            if not self.Update(value=message // 1024)[0]:
                # Cancel button pressed
                self.downloader.abort()
                self.downloader.join()
                logger.info("FFmpeg download canceled.")

                alert = wx.MessageDialog(parent=self, message="Aborted! FFmpeg was not downloaded.", caption="pyjam",
                                         style=wx.ICON_EXCLAMATION)
                alert.ShowModal()
                alert.Destroy()

                wx.CallAfter(self.Destroy)
项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def update_status(self):
        bytes_left = self._level.get_entity_bytes_left()
        if bytes_left < 0:
            self.Status.SetStatusText('No entity bytes left!', 0)
            wx.MessageBox('There is no more room for entities. Delete entities or move entites to create empty blockmap blocks to free up more room. This level cannot be saved until enough room is made available.', 'No more room for entities', wx.ICON_EXCLAMATION | wx.OK)
        else:
            self.Status.SetStatusText('{} entity bytes left'.format(bytes_left), 0)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def AddLadderBlock(self):
        message = wx.MessageDialog(self, _("This option isn't available yet!"), _("Warning"), wx.OK | wx.ICON_EXCLAMATION)
        message.ShowModal()
        message.Destroy()

    # -------------------------------------------------------------------------------
    #                          Delete element functions
    # -------------------------------------------------------------------------------
项目:pyUVVIS    作者:ddietze    | 项目源码 | 文件源码
def connectCamera(self):
        if uc480avail and OOavail:
            dlg = wx.SingleChoiceDialog(None, 'Please select input device..', 'Camera setup', ['uc480', 'OceanOptics'], style=wx.OK)
            dlg.ShowModal()
            if dlg.GetSelection() == 0:
                self.connectUC480()
            else:
                self.connectOO()
            dlg.Destroy()
        elif uc480avail:
            self.connectUC480()
        elif OOavail:
            self.connectOO()
        else:
            wx.MessageBox('No input device detected! Please check connections..', 'Camera setup', style=wx.OK | wx.ICON_EXCLAMATION)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def __init__(self, trayicon, tooltip):
        super(TaskBarIcon, self).__init__()
        self.show_no_updates = False

        # Set trayicon and tooltip
        icon = wx.Icon(wx.Bitmap(trayicon))
        self.SetIcon(icon, tooltip)

        self.Bind(wx.adv.EVT_TASKBAR_LEFT_DCLICK, self.on_upgrade)
        self.Bind(wx.adv.EVT_TASKBAR_BALLOON_CLICK, self.on_bubble)
        self.upd_error_count = 0
        self.checking_updates = False
        self.updates_available = False
        self.shutdown_scheduled = False
        self.reboot_scheduled = False
        self.bootup_time = getBootUp()
        if update_interval and update_method:
            self.timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
            self.timer.Start(update_interval)
            if update_startup:
                self.on_timer(None)
        if check_bootup_log:
            last_check = check_file_date(xml_file)
            now = datetime.datetime.now()
            if (self.bootup_time + datetime.timedelta(hours=1) > now) and \
               (self.bootup_time + datetime.timedelta(minutes=30) > last_check):
                log, errorlog, reboot = check_eventlog(self.bootup_time)
                if errorlog:
                    error_str = _(u"Update error detected\n"
                                  u"during system start up.")
                    self.ShowBalloon(title=_(u'WPKG Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
                    title = _(u"System start error")
                    dlg = ViewLogDialog(title=title,log=errorlog)
                    dlg.ShowModal()
        if check_last_upgrade:
            # Check if the last changes to the local wpkg.xml are older than a specific time
            # Inform USER that he should upgrade the System
            last_check = check_file_date(xml_file)
            if last_check < (datetime.datetime.now() - datetime.timedelta(days=last_upgrade_interval)):
                dlg_str = _(u"System should be updated!\n\n"
                            u"System wasn't updated in over {} days.").format(str(last_upgrade_interval))
                dlg = wx.MessageDialog(None, dlg_str, _(u"Attention!"), wx.OK | wx.ICON_EXCLAMATION)
                dlg.ShowModal()
                self.on_upgrade(None)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def on_upgrade(self, event):
        try:
            if self.wpkg_dialog.IsShown():
                # If dialog is opened already, raise window to top
                self.wpkg_dialog.Raise()
                return
        except AttributeError:
            # Dialog is not opened yet
            # Check if Reboot is Pending
            try:
                reboot_pending = ReadRebootPendingTime()
            except WindowsError:
                dlg_msg = _(u'Registry Error\n\nNo access to necessary registry key.')
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
            if reboot_pending and reboot_pending > self.bootup_time:
                dlg_msg = _(u"Reboot required!\n\n"
                           u"A reboot is required before the system\n"
                           u"can be updated again.\n"
                           u"Reboot now?")
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.YES_NO | wx.YES_DEFAULT | wx.ICON_EXCLAMATION)
                if dlg.ShowModal() == wx.ID_YES:
                    # Initiate Reboot
                    shutdown(1, time=5, msg=_(u"System will reboot now!"))
                    return
                else:
                    return
            elif reboot_pending:
                SetRebootPendingTime(reset=True)
            if update_method and update_interval:
                self.timer.Stop()
            self.wpkg_dialog = RunWPKGDialog(parent=self, title=_(u'System Update'))
            self.wpkg_dialog.ShowModal()
            if self.wpkg_dialog.shutdown_scheduled == True:
                # Shutdown Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
            if self.wpkg_dialog.reboot_scheduled == True:
                # Reboot Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
                self.reboot_scheduled = True
            self.wpkg_dialog.Destroy()
            if update_method and update_interval:
                self.timer.Start()
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def __init__(self, trayicon, tooltip):
        super(TaskBarIcon, self).__init__()
        self.show_no_updates = False

        # Set trayicon and tooltip
        icon = wx.IconFromBitmap(wx.Bitmap(trayicon))
        self.SetIcon(icon, tooltip)

        self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.on_upgrade)
        self.Bind(wx.EVT_TASKBAR_BALLOON_CLICK, self.on_bubble)
        self.upd_error_count = 0
        self.checking_updates = False
        self.updates_available = False
        self.shutdown_scheduled = False
        self.reboot_scheduled = False
        self.bootup_time = getBootUp()
        if update_interval and update_method:
            self.timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
            self.timer.Start(update_interval)
            if update_startup:
                self.on_timer(None)
        if check_bootup_log:
            last_check = ReadLastSyncTime()
            now = datetime.datetime.now()
            if (self.bootup_time + datetime.timedelta(hours=1) > now) and \
               (self.bootup_time + datetime.timedelta(minutes=30) > last_check):
                log, errorlog, reboot = check_eventlog(self.bootup_time)
                if errorlog:
                    error_str = _(u"Update error detected\n"
                                  u"during system start up.")
                    self.ShowBalloon(title=_(u'WPKG Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
                    title = _(u"System start error")
                    dlg = ViewLogDialog(title=title,log=errorlog)
                    dlg.ShowModal()
        if check_last_upgrade:
            # Check when WPKG-GP sucessfully synced the last time
            # Inform USER that he should upgrade the System
            last_sync = ReadLastSyncTime()
            if last_sync:
                if last_sync < (datetime.datetime.now() - datetime.timedelta(days=last_upgrade_interval)):
                    dlg_str = _(u"System should be updated!\n\n"
                                u"System wasn't updated in over {} days.").format(str(last_upgrade_interval))
                    dlg = wx.MessageDialog(None, dlg_str, _(u"Attention!"), wx.OK | wx.ICON_EXCLAMATION)
                    dlg.ShowModal()
                    self.on_upgrade(None)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def OnOK(self, event):
        error = []
        pou_name = self.PouName.GetValue()
        if pou_name == "":
            error.append(_("POU Name"))
        if self.PouType.GetSelection() == -1:
            error.append(_("POU Type"))
        if self.Language.GetSelection() == -1:
            error.append(_("Language"))
        message = None
        question = False
        if len(error) > 0:
            text = ""
            for i, item in enumerate(error):
                if i == 0:
                    text += item
                elif i == len(error) - 1:
                    text += _(" and %s") % item
                else:
                    text += _(", %s") % item
            message = _("Form isn't complete. %s must be filled!") % text
        elif not TestIdentifier(pou_name):
            message = _("\"%s\" is not a valid identifier!") % pou_name
        elif pou_name.upper() in IEC_KEYWORDS:
            message = _("\"%s\" is a keyword. It can't be used!") % pou_name
        elif pou_name.upper() in self.PouNames:
            message = _("\"%s\" pou already exists!") % pou_name
        elif pou_name.upper() in self.PouElementNames:
            message = _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?") % pou_name
            question = True
        if message is not None:
            if question:
                dialog = wx.MessageDialog(self, message, _("Warning"), wx.YES_NO | wx.ICON_EXCLAMATION)
                result = dialog.ShowModal()
                dialog.Destroy()
                if result == wx.ID_YES:
                    self.EndModal(wx.ID_OK)
            else:
                dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
                dialog.ShowModal()
                dialog.Destroy()
        else:
            self.EndModal(wx.ID_OK)