def clickShowProfile(event):
    datas = srv.getTeacherInfo()
    if (datas == False):
        JOptionPane.showMessageDialog(None,
                                      "Failed to get the teacher information")
    elif (len(datas) != 0):
        updateTeacherForm(datas)
コード例 #2
0
ファイル: PTManager.py プロジェクト: anhnt4288/PT-Manager
    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)
コード例 #3
0
ファイル: tictacdax.py プロジェクト: mikilabarda/TicTac_AI
    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)
コード例 #4
0
 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)
コード例 #5
0
 def showDialog(self, event):
     msg = self.message.getText()
     title = self.title.getText()
     opt = self.optionDict[self.optType.getSelectedItem()]
     kind = self.msgDict[self.msgType.getSelectedItem()]
     if msg:
         if title:
             if kind:
                 result = JOptionPane.showConfirmDialog(
                     self.frame, msg, title, opt, kind)
             else:
                 result = JOptionPane.showConfirmDialog(
                     self.frame, msg, title, opt)
         else:
             result = JOptionPane.showConfirmDialog(
                 self.frame,
                 msg,
             )
         self.statusUpdate('result = %d' % result)
     else:
         JOptionPane.showMessageDialog(self.frame,
                                       'A message value is required!',
                                       'Required value not specified',
                                       JOptionPane.ERROR_MESSAGE)
         self.statusUpdate('Enter a message, and try again.')
コード例 #6
0
 def makeRequest(self, method, url, data=None, src=None):
     if self.ddurl[0] == 'http':
         conn = httplib.HTTPConnection(self.ddurl[1])
     elif self.ddurl[0] == 'https':
         conn = httplib.HTTPSConnection(self.ddurl[1])
     else:
         return None
     if data:
         conn.request(method, url, body=data, headers=self.headers)
     else:
         conn.request(method, url, headers=self.headers)
     response = conn.getresponse()
     self.req_data = response.read()
     conn.close()
     if url == '/api/v1/importscan/':
         try:
             lbl = ClickableLink(
                 str("Successfully Imported selected Issues ! Access Test : "
                     + response.getheader('location').split('/')[4]),
                 str(self.ddurl[0] + "://" + self.ddurl[1] + "/test/" +
                     response.getheader('location').split('/')[4]))
             JOptionPane.showMessageDialog(src, lbl.getClickAbleLink())
         except:
             JOptionPane.showMessageDialog(src, "Import possibly failed!",
                                           "Error",
                                           JOptionPane.WARNING_MESSAGE)
     try:
         os.remove("./Data.txt")
     except:
         pass
     if self.headers['Content-Type'] != 'application/json':
         self.headers['Content-Type'] = 'application/json'
     return
コード例 #7
0
def decryptMessage(event):
    myPK = [int(alpha.text), int(beta.text), int(genPrima.text)]
    A = int(privateKeyTextBox.text)

    try:
        myPath = ""
        myPath = encryptedTextPath.text
        myPath = encryptedTextPath.text + "\\" + encryptedTextFile.text
        myPath = myPath.replace("\\", "/")
        #print "current path = ",myPath
        C = IOController.cypherTxtToList(myPath)
        #print "C =",C
        C = IOController.arraySplitter(C)
        #print "C2D = ",C
        dStart = timeit.default_timer()
        M = elGamal.Dekripsi(myPK, C, A)
        dEnd = timeit.default_timer()
        #print "hasil dekripsi =", M
        M = myIOControl.returnItToString(M)
        print "berhasil mengembalikan pesan M = \n", M
        pesanTerenkripsi.text = M
        saveToFile.saveDecryptedText(M, "pesan asli", ".txt")
        tTpD = "berhasil mengembalikan pesan"
        tTpD += "\nrunning time = "
        tTpD += str(dEnd - dStart)
        tTpD += " detik"
        print tTpD
        JOptionPane.showMessageDialog(naiveForm, tTpD, "info",
                                      JOptionPane.INFORMATION_MESSAGE)
        #JOptionPane.showMessageDialog(naiveForm, "Gagal mengenkripsi pesan", "Gagal!", JOptionPane.ERROR_MESSAGE)
    except:
        JOptionPane.showMessageDialog(naiveForm, "Gagal mengenkripsi pesan",
                                      "Gagal!", JOptionPane.ERROR_MESSAGE)
コード例 #8
0
def encryptMessage(event):
    try:
        eStart = timeit.default_timer()
        print "initiating"
        intToPrint = ""
        publicKey = [int(alpha.text), int(beta.text), int(genPrima.text)]
        message = parseMyStringToInt(pesanAsli.text)
        encryptedMessage = elGamal.Enkripsi(publicKey, message)
        c = 0
        myString = ''
        while (c < len(message)):
            myString += str(encryptedMessage[c][0])
            myString += str(encryptedMessage[c][1])
            if (c % 5 == 0):
                intToPrint += "\n"
            intToPrint += str(encryptedMessage[c][0])
            intToPrint += " "
            intToPrint += str(encryptedMessage[c][1])
            intToPrint += " "
            c += 1
        pesanTerenkripsi.setText("")
        pesanTerenkripsi.text = intToPrint
        writeToTxt(intToPrint, 'encryptedText', '.txt')
        eEnd = timeit.default_timer()
        tTp = "berhasil melakukan enkripsi pesan\n"
        tTp += "running time = "
        tTp += str(eEnd - eStart)
        tTp += " detik"
        JOptionPane.showMessageDialog(naiveForm, tTp, "info",
                                      JOptionPane.INFORMATION_MESSAGE)
    except:
        JOptionPane.showMessageDialog(naiveForm, "ada kesalahan", "info",
                                      JOptionPane.ERROR_MESSAGE)
コード例 #9
0
ファイル: signatures.py プロジェクト: l9sk/signatures
    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
コード例 #10
0
 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)
def takeMonthYearSpecificTeacher(month, year):
    # monthyear in local variable and teacherName is in global variable

    global globalTeacherName
    global table

    datas = srv.getSpecificTeacherAttendenceInMonth(globalTeacherName, month,
                                                    year)
    if (datas == False):
        # some  problem to get the data
        JOptionPane.showMessageDialog(
            None, "Failed to get the  teacher attendence list n month ")
    elif (len(datas) == 0):
        # means no datas is available, so we have to show thw attendence list for today
        JOptionPane.showMessageDialog(None,
                                      "No any attendence is mantained yet ")

    elif (len(datas) != 0):
        # means we  had done the attendence  on today
        showAttendenceSheet()
        adjustFrame()
        tableModel = MyTableModel6(
            datas
        )  # object has been created  ,the class is avialable in gui package and in showtable module
        table.setModel(tableModel)  # in table we set the model
コード例 #12
0
    def getMessage(self):
        """Transform the JSON format back to the binary protobuf message"""
        try:
            if self.message_type is None or not self.isModified():
                return self._original_content

            json_data = self._text_editor.getText().tostring()

            protobuf_data = blackboxprotobuf.protobuf_from_json(
                json_data, self.message_type)

            protobuf_data = self.encodePayload(protobuf_data)
            if 'set_protobuf_data' in dir(user_funcs):
                result = user_funcs.set_protobuf_data(
                    protobuf_data, self._original_content, self._is_request,
                    self._content_info, self._helpers, self._request,
                    self._request_content_info)
                if result is not None:
                    return result

            headers = self._content_info.getHeaders()
            return self._helpers.buildHttpMessage(headers, str(protobuf_data))

        except Exception as exc:
            self._callbacks.printError(traceback.format_exc())
            JOptionPane.showMessageDialog(
                self._component, "Error encoding protobuf: " + str(exc))
            # Resets state
            return self._original_content
コード例 #13
0
def updateCourse(courseObj):
    con = util.getCon()
    try:
        sno = getattr(courseObj, 'sno')
        print sno
        instituteId = domain.Institute.instId  # act as foreignKey. domain is package in which Institute is class andwe get static variable instId
        courseName = getattr(courseObj, 'courseName')
        courseId = getattr(courseObj, 'courseId')
        courseFee = getattr(courseObj, 'courseFee')
        sql = ""
        sql = sql + " update course set courseName='" + str(
            courseName) + "' , courseId = '" + str(
                courseId) + "', courseFee='" + str(
                    courseFee) + "' where sno='" + str(sno) + "'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,
                                      "Successfully course has been updated")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None, "Failed to the update the course ")
        return False
コード例 #14
0
ファイル: qat_script.py プロジェクト: alex85k/qat_script
    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()
コード例 #15
0
ファイル: NammuController.py プロジェクト: jenshnielsen/nammu
 def promptInfoPane(self, text):
     '''
     1. Show popup with given information text
     '''
     JOptionPane.showMessageDialog( \
             self.view.getContentPane(), text, "Information", \
             JOptionPane.INFORMATION_MESSAGE)
コード例 #16
0
def main( installDir, isUpdate, is_development, platforms, selectedVersion="CURRENT", isWindows=False ):
    info("Running getbirch installer process")

    if (not os.path.lexists(installDir)):
        os.mkdir(installDir)

    if (check_depends()):
        if ( os.path.lexists(installDir) ):
            info('Fetching archives')
            os.chdir(installDir)

            valid = True

            if ( isWindows ):
                from cyglib import setupCygwin
                valid = valid and setupCygwin(installDir)
            valid = valid and getFramework(installDir, is_development)
            valid = valid and getBinaries(installDir, is_development, platforms)
            valid = valid and getInstallScripts( installDir )
            valid = valid and extractInstallScripts( installDir )

            if not valid:
                message = "An error has occurred in fetching the latest version of BIRCH - installion aborted! Please report this problem and email the install log."
                error(mesage)
                JOptionPane.showMessageDialog(None,message );


            #perform the actual install here
    
    shutdown()
コード例 #17
0
 def openFile(self, fileext, filedesc, fileparm):
     myFilePath = ''
     chooseFile = JFileChooser()
     myFilter = FileNameExtensionFilter(filedesc, [fileext])
     chooseFile.setFileFilter(myFilter)
     ret = chooseFile.showOpenDialog(self.tab)
     if ret == JFileChooser.APPROVE_OPTION:
         file = chooseFile.getSelectedFile()
         myFilePath = str(file.getCanonicalPath()).lower()
         if not myFilePath.endswith(fileext):
             myFilePath += '.' + fileext
         okWrite = JOptionPane.YES_OPTION
         if os.path.isfile(myFilePath):
             okWrite = JOptionPane.showConfirmDialog(
                 self.tab, 'File already exists. Ok to over-write?', '',
                 JOptionPane.YES_NO_OPTION)
             if okWrite == JOptionPane.NO_OPTION:
                 return
         j = True
         while j:
             try:
                 f = open(myFilePath, mode=fileparm)
                 j = False
             except IOError:
                 okWrite = JOptionPane.showConfirmDialog(
                     self.tab, 'File cannot be opened. Correct and retry?',
                     '', JOptionPane.YES_NO_OPTION)
                 if okWrite == JOptionPane.NO_OPTION:
                     return None, False
         return f, True
コード例 #18
0
ファイル: __init__.py プロジェクト: dalehamel/getbirch
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
コード例 #19
0
ファイル: utils.py プロジェクト: s1kr10s/BurpFuzz
    def save_settings(self, evnt):

        config = {
            #'isEnabled': 0,
            #'Randomize': 0,
            #'Payloads': [],
            'Path_Template': []
        }

        #config['isEnabled'] = self.enable.isSelected()
        #config['Randomize'] = self.randomize.isSelected()

        for payload in self.get_payloads():
            config['Path_Template'].append(payload)

        f = open("./config.json", "w")
        f.write(json.dumps(config))
        f.close(
        )  # For some reason jython doesn't close the file without this line

        JOptionPane.showMessageDialog(self.panel, "Settings saved",
                                      "Configuration",
                                      JOptionPane.INFORMATION_MESSAGE)
        print("[+] Settings saved")
        return
コード例 #20
0
    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
コード例 #21
0
ファイル: ElasticBurp.py プロジェクト: minight/WASE
 def applyConfig(self):
     try:
         print("Connecting to '%s', index '%s'" %
               (self.confESHost, self.confESIndex))
         self.es = connections.create_connection(hosts=[self.confESHost])
         self.idx = Index(self.confESIndex)
         self.idx.doc_type(HTTPRequestResponse)
         if self.idx.exists():
             self.idx.open()
         else:
             print("creating index")
             self.idx.create()
         self.callbacks.saveExtensionSetting("elasticburp.host",
                                             self.confESHost)
         self.callbacks.saveExtensionSetting("elasticburp.index",
                                             self.confESIndex)
         self.callbacks.saveExtensionSetting("elasticburp.tools",
                                             str(self.confBurpTools))
         self.callbacks.saveExtensionSetting(
             "elasticburp.onlyresp", str(int(self.confBurpOnlyResp)))
     except Exception as e:
         JOptionPane.showMessageDialog(
             self.panel,
             "<html><p style='width: 300px'>Error while initializing ElasticSearch: %s</p></html>"
             % (str(e)), "Error", JOptionPane.ERROR_MESSAGE)
         print(e)
コード例 #22
0
def updateTeacherService(trObj):
    con = util.getCon()
    try:
        teacherId = getattr(trObj, 'teacherId')
        teacherName = getattr(trObj, 'teacherName')
        teacherPhone = getattr(trObj, 'teacherPhone')
        teacherEmail = getattr(trObj, 'teacherEmail')
        teacherAddress = getattr(trObj, 'teacherAddress')
        teacherCourse = getattr(trObj, 'teacherCourse')
        teacherPayment = getattr(trObj, 'teacherPayment')
        teacherLoginId = getattr(trObj, 'teacherLoginId')

        sql = " update teacher set teacherName='" + str(
            teacherName) + "' , teacherPhone = '" + str(
                teacherPhone) + "', teacherEmail='" + str(
                    teacherEmail) + "', teacherAddress='" + str(
                        teacherAddress) + "', teacherCourse='" + str(
                            teacherCourse) + "', teacherPayment='" + str(
                                teacherPayment) + "',teacherLoginId='" + str(
                                    teacherLoginId
                                ) + "'  where teacherId='" + str(
                                    teacherId) + "'"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,
                                      "Successfully teacher has been Updated")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None, "Failed to update the teacher ")
        return False
コード例 #23
0
def addTeacherService(trObj):
    con = util.getCon()
    try:
        instituteId = domain.Institute.instId  # act as foreignKey. domain is package in which Institute is class andwe get static variable instId
        teacherName = getattr(trObj, 'teacherName')
        teacherPhone = getattr(trObj, 'teacherPhone')
        teacherEmail = getattr(trObj, 'teacherEmail')
        teacherAddress = getattr(trObj, 'teacherAddress')
        teacherCourse = getattr(trObj, 'teacherCourse')
        teacherPayment = getattr(trObj, 'teacherPayment')
        teacherLoginId = getattr(trObj, 'teacherLoginId')
        teacherPassword = getattr(trObj, 'teacherPassword')
        print "hello"

        sql = "insert into teacher (instituteId,teacherName,teacherPhone,teacherEmail,teacherAddress,teacherCourse,teacherPayment,teacherLoginId,teacherPassword) values ('" + str(
            instituteId
        ) + "','" + str(teacherName) + "','" + str(teacherPhone) + "','" + str(
            teacherEmail) + "','" + str(teacherAddress) + "','" + str(
                teacherCourse) + "','" + str(teacherPayment) + "','" + str(
                    teacherLoginId) + "','" + str(teacherPassword) + "')"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,
                                      "Successfully teacher has been added")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None, "Failed to add the teacher ")
        return False
コード例 #24
0
 def clsProjectId(self, _):
     self.project_id.setText(None)
     self.project = False
     self.projectId = None
     JOptionPane.showMessageDialog(
         None, "Redefinido envio de Issues sem Projeto.", "Informativo",
         JOptionPane.INFORMATION_MESSAGE)
コード例 #25
0
def f2_clic_next(event):
   if 'path_label_image' not in gvars:
      JOptionPane.showMessageDialog(None, "You have to choose at least a label image")

   elif 'path_original_image' in gvars:
      imp = IJ.openImage(gvars['path_original_image']) # IF there isn't an original image, we'll work only and display the results on the label image

   else:
      gvars['path_original_image'] = gvars['path_label_image']
      imp = IJ.openImage(gvars['path_label_image']) # If there is not an original image and only working with the lable, then show the results of the label

   if 'path_original_image' in gvars and 'path_label_image' in gvars:
      RM = RoiManager()        # we create an instance of the RoiManager class
      rm = RM.getRoiManager()

      gvars["workingImage"] = imp
      imp.show()
      IJ.run(imp, "Enhance Contrast", "saturated=0.35");

      imp2 = IJ.openImage(gvars['path_label_image'])
      task = LabelToRoi_Task(imp2) # Executes the LabelToRoi function defined on top of this script. It is wrapped into a SwingWorker in order for the windows not to freeze
      task.addPropertyChangeListener(update_progress) # To update the progress bar
      task.execute()

      rm.runCommand(imp,"Show All without labels")

      f3_txt1.setText("0")
コード例 #26
0
ファイル: signatures.py プロジェクト: vergl4s/signatures
    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
コード例 #27
0
    def save_config(self, _):
        """Save settings."""
        url = self.host_api.getText()
        token = self.api_token.getText()

        if re.match('https?://', url):
            url = re.sub('https?://', '', url)

        if url[-1:] == "/":
            url = url[:-1]

        if re.match('^(?i)Bearer ', token):
            token = re.sub('^(?i)Bearer ', '', token)

        if not re.match(
                '([a-f\d]{8})-([a-f\d]{4})-([a-f\d]{4})-([a-f\d]{4})-([a-f\d]{12})',
                token):
            JOptionPane.showMessageDialog(None, "Formato de TOKEN invalido!",
                                          "Error", JOptionPane.ERROR_MESSAGE)
            return

        save_setting = self._callbacks.saveExtensionSetting
        save_setting('host_api', url)
        save_setting('api_token', token)
        self.msgrel = True
        self.reload_config()
        return
コード例 #28
0
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()
コード例 #29
0
 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))
コード例 #30
0
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)
def addStudentService(stObj):   
    con = util.getCon()
    try:
        instituteId = domain.Institute.instId # act as foreignKey. domain is package in which Institute is class andwe get static variable instId 
        studentName = getattr(stObj,'studentName')
        studentPhone = getattr(stObj,'studentPhone')
        studentEmail = getattr(stObj,'studentEmail')
        studentAddress = getattr(stObj,'studentAddress')
        courseName = getattr(stObj,'courseName')
        courseFee = getattr(stObj,'courseFee')
        studentAssignTeacher = getattr(stObj,'studentAssignTeacher')
        studentLoginId = getattr(stObj,'studentLoginId')
        studentPassword = getattr(stObj,'studentPassword')
        
        
        sql = "insert into student (instituteId,studentName,studentPhone,studentEmail,studentAddress,courseName,courseFee,studentAssignTeacher,studentLoginId,studentPassword) values ('" + str(instituteId) + "','" + str(studentName) + "','" + str(studentPhone) + "','" + str(studentEmail) +"','"+str(studentAddress)+"','"+str(courseName)+"','"+str(courseFee)+"','"+str(studentAssignTeacher)+"','"+str(studentLoginId)+"','"+str(studentPassword)+"')"
        print sql
        cursor = util.getCursor()
        cursor.execute(sql)
        con.commit()
        JOptionPane.showMessageDialog(None,"Successfully student has been added")
        return True
    except:
        con.rollback()
        JOptionPane.showMessageDialog(None,"Failed to add the student ")
        return False   
コード例 #32
0
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
コード例 #33
0
 def promptInfoPane(self, text):
     '''
     1. Show popup with given information text
     '''
     JOptionPane.showMessageDialog(self.view.getContentPane(), text,
                                   "Information",
                                   JOptionPane.INFORMATION_MESSAGE)
コード例 #34
0
 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)
コード例 #35
0
ファイル: qat_script.py プロジェクト: alex85k/qat_script
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))
コード例 #36
0
def decryptMessage(event):

    myPK = [
        int(alphaTextField.text),
        int(betaTextField.text),
        int(primaTextField.text)
    ]
    A = int(myKey.text)
    try:
        myPath = ""
        myPath = alamatFile.text
        myPath = alamatFile.text + "\\" + namaFile.text
        myPath = myPath.replace("\\", "/")
        print "current path = ", myPath
        C = IOController.cypherTxtToList(myPath)
        print "C =", C
        C = IOController.arraySplitter(C)
        print "C2D = ", C
        M = elGamal.Dekripsi(myPK, C, A)
        print "hasil dekripsi =", M
        M = IOController.returnItToString(M)
        print "berhasil mengembalikan pesan =", M
        plainText.text = M
        myLabel.text = "Isi pesan asli"
        saveToFile.saveDecryptedText(M, "pesan setelah didekripsi", ".txt")
        JOptionPane.showMessageDialog(mainForm, "Berhasil mengembalikan pesan",
                                      "Info", JOptionPane.INFORMATION_MESSAGE)
    except:
        JOptionPane.showMessageDialog(mainForm, "Gagal mengenkripsi pesan",
                                      "Gagal!", JOptionPane.ERROR_MESSAGE)
コード例 #37
0
    def saveAsNewType(self):
        """Copy the current type into known_messages"""
        name = self._new_type_field.getText().strip()
        if not NAME_REGEX.match(name):
            JOptionPane.showMessageDialog(
                self._component,
                "%s is not a valid "
                "message name. Message names should be alphanumeric." % name,
            )
            return
        if name in default_config.known_types:
            JOptionPane.showMessageDialog(
                self._component, "Message name %s is " "already taken." % name
            )
            return

        # Do a deep copy on the dictionary so we don't accidentally modify others
        default_config.known_types[name] = copy.deepcopy(self.message_type)
        # update the list of messages. This should trickle down to known message model
        self._extension.known_message_model.addElement(name)
        self._new_type_field.setText("")
        self._extension.saved_types[self._message_hash] = name

        # force select our new type
        self.forceSelectType(name)
コード例 #38
0
def clickShowStudentProfile(event):
    datas = srv.getStudentInfo()
    if (datas == False):
        JOptionPane.showMessageDialog(None,
                                      "Failed to get the Student information")
    elif (len(datas) != 0):
        studentProfileForm(datas)
コード例 #39
0
ファイル: NewZoneDialog.py プロジェクト: alex85k/qat_script
 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)
コード例 #40
0
    def createNewInstance(self,event=None):
        self.args = self._jTextFieldParameters.getText()
        print self.args
        if len(self.args) == 0:
            JOptionPane.showMessageDialog(None, "please input url")
        else:

            headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0",
                       "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
                       "Accept-Language": "en-US,en;q=0.5",
                       "Accept-Encoding": "gzip, deflate",
                       "Range":"bytes=0-18446744073709551615",
                       "Host":"stuff"}
            try:
                t = urllib2.Request(self.args, headers=headers,timeout=5)
                r = urllib2.urlopen(t)
                JOptionPane.showMessageDialog(None, "working")
                if r.status_code == 416:

                    JOptionPane.showMessageDialog(None, "IIS Http.sys RCE")

                else:
                    JOptionPane.showMessageDialog(None, "don't have IIS Http.sys RCE")
                    # JOptionPane.showMessageDialog(None, "set over")
                # return r
            except KeyboardInterrupt:
                sys.exit(0)
            except:
                JOptionPane.showMessageDialog(None, "time out or something wrong")
                return None
コード例 #41
0
ファイル: fix.py プロジェクト: jeremi360/jythonfx
def getJavaFX():
    ver = jsys.getProperty("java.version")
    ver = ver.split(".")
    ver[-1] = float(ver[-1].replace("_", "."))
    ver[0] = float(str(ver[0]) + "." + str(ver[1]))
    ver.pop(1)

    print  ver

    if ver[0] <= 1.6:
        mess()

    elif ver[0] == 1.7:
        if ver[1] <= 0.11:
            mess()
            home = jsys.getProperty("java.home")

            try:
                jfxrt = os.path.join(home, "lib", "jfxrt.jar")
                sys.path.insert(0, jfxrt)

            except:
                part01 = "Nie można odnalesc biblioteki JavaFX(jfxrt.jar).\n"
                message = part01 + "Unable to find JavaFX lib (jfxrt.jar)."
                jop.showMessageDialog(None, message)
                sys.exit()

    else:
        pass
コード例 #42
0
 def notice( self, event ) :
     JOptionPane.showMessageDialog(
         self.frame,
         disclaimer,
         'Notice',
         JOptionPane.WARNING_MESSAGE
     )
コード例 #43
0
ファイル: qat_script.py プロジェクト: ypid/qat_script
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))
コード例 #44
0
ファイル: Gui.py プロジェクト: pythonoob/SimplePyzzle
 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);
コード例 #45
0
    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)
コード例 #46
0
ファイル: hand_reco_writer.py プロジェクト: Yinhai/HandReco
 def instructions(event):
     instr = '''
     The program can just recognise capital English characters.
     See Info -> Available Words... for available word corrections.
     
     Good Luck with the writing!'''
     JOptionPane.showMessageDialog(self, instr, 
                   "Instructions", 
                   JOptionPane.INFORMATION_MESSAGE)
コード例 #47
0
ファイル: Dialogs.py プロジェクト: superbaby11/autoOMC
    class InputDialog(_AbstractSwingDialog):

        def __init__(self, message, default):
            self._default = default
            _AbstractSwingDialog.__init__(self, message)

        def _init_dialog(self, message):
            self._pane = JOptionPane(message, PLAIN_MESSAGE, OK_CANCEL_OPTION)
            self._pane.setWantsInput(True)
            self._pane.setInitialSelectionValue(self._default)
コード例 #48
0
ファイル: Dialogs.py プロジェクト: superbaby11/autoOMC
    class SelectionDialog(_AbstractSwingDialog):

        def __init__(self, message, options):
            self._options = options
            _AbstractSwingDialog.__init__(self, message)

        def _init_dialog(self, message):
            self._pane = JOptionPane(message, PLAIN_MESSAGE, OK_CANCEL_OPTION)
            self._pane.setWantsInput(True)
            self._pane.setSelectionValues(self._options)
コード例 #49
0
 def itemStateChanged(self, e):
     """A ttol has been activated/deactivated.
        Check if at least one tool is on.
     """
     if all(not button.isSelected() for button in self.toolsCBtns):
         JOptionPane.showMessageDialog(
             Main.parent,
             self.app.strings.getString("tools_disabled_warning"),
             self.app.strings.getString("tools_disabled_warning_title"),
             JOptionPane.WARNING_MESSAGE)
         source = e.getItemSelectable()
         source.setSelected(True)
コード例 #50
0
def getActiveLayers():
	view=gvSIG.getActiveDocument()
	if view.getClass().getCanonicalName() <> 'com.iver.cit.gvsig.project.documents.view.gui.View':
		JOptionPane.showMessageDialog(None, 
			"The active document is not a view.", "Border Symbology", JOptionPane.WARNING_MESSAGE)
		return
	else:
		mctrl=view.getMapControl()
		mctxt=mctrl.getMapContext()
		layers=mctxt.getLayers()
		activeLayers=layers.getActives()
		return activeLayers
コード例 #51
0
ファイル: ElasticBurp.py プロジェクト: thomaspatzke/WASE
 def menuAddToES(e):
     progress = ProgressMonitor(component, "Feeding ElasticSearch", "", 0, len(msgs))
     i = 0
     docs = list()
     for msg in msgs:
         if not Burp_onlyResponses or msg.getResponse():
             docs.append(self.genESDoc(msg, timeStampFromResponse=True).to_dict(True))
         i += 1
         progress.setProgress(i)
     success, failed = bulk(self.es, docs, True, raise_on_error=False)
     progress.close()
     JOptionPane.showMessageDialog(self.panel, "<html><p style='width: 300px'>Successful imported %d messages, %d messages failed.</p></html>" % (success, failed), "Finished", JOptionPane.INFORMATION_MESSAGE)
コード例 #52
0
ファイル: ui.py プロジェクト: eboda/burp-sessions
    def new_session(self, evt):
        """Listener for New Session button."""

        name = JOptionPane.showInputDialog(None, "Name the new session:", "Session name")
        if name != None:
            from_request = JOptionPane.showConfirmDialog(None, "Create session from current request?", "From current request?", JOptionPane.YES_NO_OPTION)
            self._extender.sm.new_session(name)
            self.refresh_sessions()

            # let user select parameters for new session
            if from_request == JOptionPane.OK_OPTION:
                dialog = SessionFromRequestDialog(self)
                dialog.setVisible(True)
コード例 #53
0
ファイル: ElasticBurp.py プロジェクト: Cyber-Forensic/WASE
 def applyConfig(self):
     try:
         print("Connecting to '%s', index '%s'" % (self.confESHost, self.confESIndex))
         res = connections.create_connection(hosts=[self.confESHost])
         idx = Index(self.confESIndex)
         idx.doc_type(DocHTTPRequestResponse)
         DocHTTPRequestResponse.init()
         try:
             idx.create()
         except:
             pass
     except Exception as e:
         JOptionPane.showMessageDialog(self.panel, "<html><p style='width: 300px'>Error while initializing ElasticSearch: %s</p></html>" % (str(e)), "Error", JOptionPane.ERROR_MESSAGE)
コード例 #54
0
ファイル: metastudio.py プロジェクト: tommytracx/metastudio
def messageBox(msg, title="", type="normal"):
    from javax.swing import JOptionPane

    if type == "normal": 
       JOptionPane.showMessageDialog(getIDEInstance(), msg, title, JOptionPane.INFORMATION_MESSAGE)
    elif type == "warning":
       JOptionPane.showMessageDialog(getIDEInstance(), msg, title, JOptionPane.WARNING_MESSAGE)
    elif type == "warn":
       JOptionPane.showMessageDialog(getIDEInstance(), msg, title, JOptionPane.WARNING_MESSAGE)
    elif type == "error":
       JOptionPane.showMessageDialog(getIDEInstance(), msg, title, JOptionPane.ERROR_MESSAGE)
    else:
       JOptionPane.showMessageDialog(getIDEInstance(), msg, title, JOptionPane.INFORMATION_MESSAGE)
コード例 #55
0
ファイル: __init__.py プロジェクト: HenryStevens/jes
 def unwatchVariable(self):
     """
     Opens a dialog, asking the user to remove a variable from the watcher.
     """
     allVars = self.watcher.variablesToTrack
     if len(allVars) > 0:
         var = JOptionPane.showInputDialog(self.gui,
             "Choose a variable to stop watching.", "Watcher",
             JOptionPane.INFORMATION_MESSAGE, None, allVars, allVars[0])
         if var is not None:
             self.watcher.removeVariable(var)
     else:
         JOptionPane.showMessageDialog(self.gui,
             "There are no variables being watched.", "Watcher",
             JOptionPane.ERROR_MESSAGE)
コード例 #56
0
 def clearClick(self,e):
     result = JOptionPane.showConfirmDialog(self._splitpane, "Clear AuthMatrix Configuration?", "Clear Config", JOptionPane.YES_NO_OPTION)
     if result == JOptionPane.YES_OPTION:
         self._db.clear()
         self._tabs.removeAll()
         self._userTable.redrawTable()
         self._messageTable.redrawTable()
コード例 #57
0
    def OnRegularReloadOfModule(self, event):
        if jython:
            moduleName = self.fileNamesList.getSelectedValue()
        else:
            moduleName = GetListSelection(self.fileNamesList)
        print "Module to reload:", moduleName
        if moduleName:
            warning = """You are about to do a regular reload of module %s.
If you do this, any currently open windows defined in that specific module
will no longer respond to special reloads until the entire program is restarted.
Any other module will not neccessarily use the reloaded code unless it too is reloaded.
Any subsequently opened windows will only use the new code regularly reloaded in this module
if the calling module does an explicit import of the reloaded module before referencing the window and
if the code snippet opening the new window explicitely accesses the reloaded module's window class
as a "module.className()" reference, as opposed to "from module import name" and "className()"
(where the classname would then still point to the previous version).
Confusing? Yes! I'm still not sure I understand it thoroughly myself. :-)
Proceed anyway?""" % moduleName
            title = "Confirm regular reload"
            if jython:
                result = JOptionPane.showConfirmDialog(self, warning, title, JOptionPane.YES_NO_CANCEL_OPTION)
                proceed = (result == JOptionPane.YES_OPTION)
            else:
                proceed = AskYesNoDialog(self.window, warning, title)
            if proceed:
                print "==== starting regular reload of module", moduleName
                reload(sys.modules[moduleName])
                print "== done with regular reload\n"
            else:
                print "reload cancelled"
コード例 #58
0
ファイル: ElasticBurp.py プロジェクト: thomaspatzke/WASE
 def applyConfig(self):
     try:
         print("Connecting to '%s', index '%s'" % (self.confESHost, self.confESIndex))
         self.es = connections.create_connection(hosts=[self.confESHost])
         self.idx = Index(self.confESIndex)
         self.idx.doc_type(DocHTTPRequestResponse)
         if self.idx.exists():
             self.idx.open()
         else:
             self.idx.create()
         self.callbacks.saveExtensionSetting("elasticburp.host", self.confESHost)
         self.callbacks.saveExtensionSetting("elasticburp.index", self.confESIndex)
         self.callbacks.saveExtensionSetting("elasticburp.tools", str(self.confBurpTools))
         self.callbacks.saveExtensionSetting("elasticburp.onlyresp", str(int(self.confBurpOnlyResp)))
     except Exception as e:
         JOptionPane.showMessageDialog(self.panel, "<html><p style='width: 300px'>Error while initializing ElasticSearch: %s</p></html>" % (str(e)), "Error", JOptionPane.ERROR_MESSAGE)