当前位置: 首页>>代码示例>>Python>>正文


Python swing.JOptionPane类代码示例

本文整理汇总了Python中javax.swing.JOptionPane的典型用法代码示例。如果您正苦于以下问题:Python JOptionPane类的具体用法?Python JOptionPane怎么用?Python JOptionPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JOptionPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

    def update(self,button=None): #human triggered
        print 'current1', self.current_player

        if(button!=None):
            #human
            cell = str(button.row) + str(button.col)
            if cell in self.empty_cells and self.current_player.level=='human':
                self.current_player.turn(button)
                self.update_state()
                if (self.state == 'next'):
                    self.switch_turn()

        print 'current2', self.current_player
        if self.current_player.level != 'human':
            #ai!
            print "before ai's turn", self.current_player, self.board, self.empty_cells

            self.current_player.turn()
            self.update_state()
            if (self.state == 'next'):
                self.switch_turn()

            print "after ai's turn", self.current_player, self.board, self.empty_cells

        print 'update', self.state, self.turn

        if self.state == 'over':
            JOptionPane.showMessageDialog(self.ui.panel,
                "Game Over! Player: " + self.current_player.name + " Wins!!",
                "Winner", JOptionPane.INFORMATION_MESSAGE)
        elif self.state == 'draw':
                JOptionPane.showMessageDialog(self.ui.panel,
                    "Its a draw!",
                    "Draw", JOptionPane.INFORMATION_MESSAGE)
开发者ID:mykemouuuse,项目名称:TicTac_AI,代码行数:34,代码来源:tictacdax.py

示例2: vulnNameChanged

    def vulnNameChanged(self):
            if os.path.exists(self.getCurrentVulnPath()) and self.vulnName.getText() != "":
                self.addButton.setText("Update")
            elif self.addButton.getText() != "Add":
                options = ["Create a new vulnerability", "Change current vulnerability name"]
                n = JOptionPane.showOptionDialog(None,
                    "Would you like to?",
                    "Vulnerability Name",
                    JOptionPane.YES_NO_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE,
                    None,
                    options,
                    options[0]);

                if n == 0:
                    self.clearVulnerabilityTab(False)
                    self.addButton.setText("Add")
                else:
                    newName = JOptionPane.showInputDialog(
                    None,
                    "Enter new name:",
                    "Vulnerability Name",
                    JOptionPane.PLAIN_MESSAGE,
                    None,
                    None,
                    self.vulnName.getText())
                    row = self.logTable.getSelectedRow()
                    old = self.logTable.getValueAt(row,1)                   
                    self.changeVulnName(newName,old)
开发者ID:anhnt4288,项目名称:PT-Manager,代码行数:29,代码来源:PTManager.py

示例3: actionPerformed

    def actionPerformed(self, event):
        content, message, info, parameter = self.tab._current

        try:
            body = content[info.getBodyOffset():].tostring()

            if parameter is not None:
                param = self.tab.helpers.getRequestParameter(
                        content, parameter.getName())

                if param is not None:
                    rules = self.tab.extender.table.getParameterRules().get(parameter.getName(), {})
                    body = param.getValue().encode('utf-8')

                    for rule in rules.get('before', []):
                        body = rule(body)

            message = parse_message(self.descriptor, body)

            self.tab.editor.setText(str(message))
            self.tab.editor.setEditable(True)
            self.tab._current = (content, message, info, parameter)

        except Exception as error:
            title = "Error parsing message as %s!" % (self.descriptor.name, )
            JOptionPane.showMessageDialog(self.tab.getUiComponent(),
                error.message, title, JOptionPane.ERROR_MESSAGE)

        return
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:29,代码来源:protoburp.py

示例4: promptInfoPane

 def promptInfoPane(self, text):
     '''
     1. Show popup with given information text
     '''
     JOptionPane.showMessageDialog( \
             self.view.getContentPane(), text, "Information", \
             JOptionPane.INFORMATION_MESSAGE)
开发者ID:jenshnielsen,项目名称:nammu,代码行数:7,代码来源:NammuController.py

示例5: on_falsePositiveBtn_clicked

    def on_falsePositiveBtn_clicked(self, event):
        """Tell the tool server that selected error is a false positive
        """
        check = self.selectedError.check
        tool = check.tool
        if tool.falseFeedbackMode == "url":
            #the tool supports automatic reporting
            if self.properties.getProperty("false_positive_warning.%s" % tool.name) == "on":
                messageArguments = array([tool.title], String)
                formatter = MessageFormat("")
                formatter.applyPattern(self.strings.getString("false_positive_confirmation"))
                msg = formatter.format(messageArguments)
                options = [self.strings.getString("yes_do_not_ask_the_next_time"),
                           self.strings.getString("Yes"),
                           self.strings.getString("No")]
                answer = JOptionPane.showOptionDialog(Main.parent,
                    msg,
                    self.strings.getString("flagging_a_false_positive"),
                    JOptionPane.YES_NO_CANCEL_OPTION,
                    JOptionPane.WARNING_MESSAGE,
                    None,
                    options,
                    options[2])
                if answer == 0:
                    #don't ask again
                    self.properties.setProperty("false_positive_warning.%s" % tool.name,
                                                "off")
                    self.save_config(self)
                elif answer == 2:
                    #don't flag as false positive
                    return
            tool.sayFalseBug(self.selectedError, check)

        elif tool.falseFeedbackMode == "msg":
            #the tool supports manual reporting of false positives
            if self.properties.getProperty("false_positive_warning.%s" % tool.name) == "on":
                messageArguments = array([tool.title], String)
                formatter = MessageFormat("")
                formatter.applyPattern(self.strings.getString("manual_false_positive_confirmation"))
                msg = formatter.format(messageArguments)
                options = [self.strings.getString("yes_do_not_ask_the_next_time"),
                           self.strings.getString("Yes"),
                           self.strings.getString("No")]
                answer = JOptionPane.showOptionDialog(Main.parent,
                    msg,
                    self.strings.getString("flagging_a_false_positive"),
                    JOptionPane.YES_NO_CANCEL_OPTION,
                    JOptionPane.WARNING_MESSAGE,
                    None,
                    options,
                    options[2])
            errorInfo = [tool.title,
                         check.name,
                         self.selectedError.errorId,
                         self.selectedError.osmId]
            self.falsePositiveDlg.tableModel.addRow(errorInfo)
        else:
            #the tool does not support feedback
            return
        self.editDone()
开发者ID:alex85k,项目名称:qat_script,代码行数:60,代码来源:qat_script.py

示例6: on_downloadBoundariesBtn_clicked

 def on_downloadBoundariesBtn_clicked(self, e):
     """Download puter ways of administrative boundaries from
        Overpass API
     """
     adminLevel = self.adminLevelTagTextField.getText()
     name = self.nameTagTextField.getText()
     optional = self.optionalTagTextField.getText()
     if (adminLevel, name, optional) == ("", "", ""):
         JOptionPane.showMessageDialog(self,
                                       self.app.strings.getString("enter_a_tag_msg"),
                                       self.app.strings.getString("Warning"),
                                       JOptionPane.WARNING_MESSAGE)
         return
     optTag = ""
     if optional.find("=") != -1:
         if len(optional.split("=")) == 2:
             key, value = optional.split("=")
             optTag = '["%s"="%s"]' % (URLEncoder.encode(key, "UTF-8"),
                                       URLEncoder.encode(value.replace(" ", "%20"), "UTF-8"))
     self.create_new_zone_editing_layer()
     overpassurl = 'http://127.0.0.1:8111/import?url='
     overpassurl += 'http://overpass-api.de/api/interpreter?data='
     overpassquery = 'relation["admin_level"="%s"]' % adminLevel
     overpassquery += '["name"="%s"]' % URLEncoder.encode(name, "UTF-8")
     overpassquery += '%s;(way(r:"outer");node(w););out meta;' % optTag
     overpassurl += overpassquery.replace(" ", "%20")
     print overpassurl
     self.app.send_to_josm(overpassurl)
开发者ID:alex85k,项目名称:qat_script,代码行数:28,代码来源:NewZoneDialog.py

示例7: getFirstSymbol

def getFirstSymbol():
	color_alpha_width = {}
	activeLayers=getActiveLayers()
	if (len(activeLayers)>0):
		lyr=activeLayers[0]
		if lyr.getClass().getCanonicalName() == "com.iver.cit.gvsig.fmap.layers.FLyrVect":
			legend=lyr.getLegend()
			print legend
			if legend.getClassName() == 'com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend':
				sym = legend.getDefaultSymbol()
				color_alpha_width["color"] = sym.getColor()
				color_alpha_width["alpha"] = sym.getAlpha()
				if (sym.getClassName() == 'com.iver.cit.gvsig.fmap.core.symbols.SimpleLineSymbol'):
					color_alpha_width["width"] = sym.getLineWidth()
			elif legend.getClassName() == 'com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend':
				sym = legend.getSymbol(0)
				if (sym.getClassName() == 'com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol'):
					color_alpha_width["color"] = sym.getOutline().getColor()
					color_alpha_width["width"] = sym.getOutline().getLineWidth()
					color_alpha_width["alpha"] = sym.getOutline().getAlpha()
			else:
				try:
					color_alpha_width["color"] = sym.getOutline().getColor()
					color_alpha_width["width"] = sym.getOutline().getLineWidth()
					color_alpha_width["alpha"] = sym.getOutline().getAlpha()
				except Exception, e:
					JOptionPane.showMessageDialog(None, legend.getClassName() + " not yet implemented!", 
								      "Border Symbology", JOptionPane.WARNING_MESSAGE)
					close(e)
开发者ID:nachouve,项目名称:uve_gvsig_scripts,代码行数:29,代码来源:batchBorderSimbology.py

示例8: printDB

 def printDB(self, e):
     out = ""
     for a in self._db.arrayOfUsers:
         out += str(a._index)+" "+a._name+" : "+str(a._roles)+"\n"
     for b in self._db.arrayOfMessages:
         out += str(b._index)+" "+str(b._roles)+"\n"
     JOptionPane.showMessageDialog(self._splitpane,out)
开发者ID:webpentest-factory,项目名称:AuthMatrix,代码行数:7,代码来源:AuthMatrix.py

示例9: main

def main():
    b=BuildingInBuilding()

    if Main.main and Main.main.map:
        mv= Main.main.map.mapView
        print mv.editLayer

        if mv.editLayer and mv.editLayer.data :
            selectedNodes = mv.editLayer.data.getSelectedNodes()
            selectedWays = mv.editLayer.data.getSelectedWays()
            if not(selectedWays):
                JOptionPane.showMessageDialog(Main.parent, "Please select a set of ways")
            else:
                print "going to output ways";
                for way in selectedWays:
                    #is there a 
                    housenumber=way.get('addr:housenumber')
                    street=way.get('addr:street')
                    if(housenumber):
                         b.visitw(way)
        #                print 'house box:', street, housenumber

                for node in selectedNodes:
                    housenumber=node.get('addr:housenumber')
                    street=node.get('addr:street')
                    if(housenumber):
                         b.visitn(node)
                         l.showNode(node)
        #                print 'house box:', street, housenumber
        

        b.endTest()
开发者ID:h4ck3rm1k3,项目名称:josm-script-jython-streetrepair,代码行数:32,代码来源:buildinginbuilding.py

示例10: _validate_form

    def _validate_form(self):
        error_message = ''

        try:
            original_hash = hex_to_raw(self._textfields["original_hash"].getText())
        except Exception:
            error_message += "Original hash doesn't look right.\n"

        try:
            max_key_len = int(self._textfields["max_key_len"].getText())
        except Exception:
            error_message += "Max key length needs to be an integer.\n"

        original_msg = self._textfields["original_msg"].getText().encode()
        append_msg = self._textfields["append_msg"].getText().encode()

        if not original_msg:
            error_message += "Missing original message.\n"
        if not append_msg:
            error_message += "Missing message to append.\n"

        if error_message:
            JOptionPane.showMessageDialog(self._tab, error_message, "Form Validation Error", JOptionPane.WARNING_MESSAGE)
            return False
        return True
开发者ID:vergl4s,项目名称:signatures,代码行数:25,代码来源:signatures.py

示例11: purge_old_birch

def purge_old_birch():
	
	print_label("Purging old BIRCH")	
	os.chdir(ARGS.install_dir)
	contents=os.listdir(os.getcwd())
	
	
	if  "install-birch" in contents:
		for each in birch_files:
			
			if (each!="local" and each.count("birch_backup")!=1 and os.path.lexists(ARGS.install_dir+"/"+each)):
				print_console("Removing old BIRCH component: "+each)
				filename=ARGS.install_dir+"/"+each
				
				
				if (os.path.isdir(filename)):
					try:
						shutil.rmtree(filename)
						if (os.path.isdir(filename)):
							os.remove(filename)
					except:
						err=traceback.format_exc()
						print_console(err)
						JOptionPane.showMessageDialog(None, "An error occurred deleting file: "+filename)
	else:
		pass
开发者ID:dalehamel,项目名称:getbirch,代码行数:26,代码来源:__init__.py

示例12: actionPerformed

 def actionPerformed(self, event):
     if _num.getValue() > 8:
         JOptionPane.showMessageDialog(None, "Max value reached. Resetting to zero.")
         _num.setValue(0)
     else:
         _num.increment()
     otText.setText(str(_num))
开发者ID:chaddorsey,项目名称:otrunk-examples,代码行数:7,代码来源:external-script.py

示例13: move_script_warning

def move_script_warning():
    """Warn the user to move qat_script directory into Scripting Plugin
       directory
    """
    scriptingPluginDir = PluginHandler.getPlugin("scripting").getPluginDir()
    pane = JPanel(GridLayout(3, 1, 5, 5))
    warningTitle = "Warning: qat_script directory not found"
    pane.add(JLabel("Please, move qat_script directory to the following location and start the script again:\n"))
    defaultPathTextField = JTextField(scriptingPluginDir,
                                      editable=0,
                                      border=None,
                                      background=None)
    pane.add(defaultPathTextField)

    if not Desktop.isDesktopSupported():
        JOptionPane.showMessageDialog(
            Main.parent,
            pane,
            warningTitle,
            JOptionPane.WARNING_MESSAGE)
    else:
        #add a button to open default path with the files manager
        pane.add(JLabel("Do you want to open this folder?"))
        options = ["No", "Yes"]
        answer = JOptionPane.showOptionDialog(
            Main.parent,
            pane,
            warningTitle,
            JOptionPane.YES_NO_OPTION,
            JOptionPane.QUESTION_MESSAGE,
            None,
            options,
            options[1])
        if answer == 1:
            Desktop.getDesktop().open(File(scriptingPluginDir))
开发者ID:alex85k,项目名称:qat_script,代码行数:35,代码来源:qat_script.py

示例14: play_event

 def play_event(self, x1, y1, x2, y2):
       status = self.puzzle.play(x1, y1, x2, y2)
       self.draw_board()
       if status == SimplePyzzle.END_GAME:
           JOptionPane.showMessageDialog (None, \
                               "Grats! You solved the puzzle", \
                               "Puzzle solved!", \
                                JOptionPane.INFORMATION_MESSAGE);
开发者ID:pythonoob,项目名称:SimplePyzzle,代码行数:8,代码来源:Gui.py

示例15: aboutAction

    def aboutAction(self, e):
        aboutText = """Induction Applet v. 0.1

        (c) 2007 University of Düsseldorf

        Authors: Gerhard Schurz, Eckhart Arnold
        """
        aboutText = re_sub(" +", " ", aboutText)
        JOptionPane.showMessageDialog(self.getContentPane(), aboutText)
开发者ID:jecki,项目名称:MetaInductionSim,代码行数:9,代码来源:InductionApplet.py


注:本文中的javax.swing.JOptionPane类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。