Logo Search packages:      
Sourcecode: namebench version File versions  Download package

def libnamebench::tk::MainWindow::DrawWindow (   self  ) 

Draws the user interface.

Definition at line 183 of file tk.py.

00183                       :
    """Draws the user interface."""
    self.nameserver_form = StringVar()
    self.status = StringVar()
    self.query_count = IntVar()
    self.run_count = IntVar()
    self.data_source = StringVar()
    self.selection_mode = StringVar()
    self.use_global = IntVar()
    self.use_regional = IntVar()
    self.use_censor_checks = IntVar()

    self.master.title("namebench")
    outer_frame = Frame(self.master)
    outer_frame.grid(row=0, padx=16, pady=16)
    inner_frame = Frame(outer_frame, relief=GROOVE, bd=2, padx=12, pady=12)
    inner_frame.grid(row=0, columnspan=2)
    status = Label(outer_frame, text='...', textvariable=self.status)
    status.grid(row=15, sticky=W, column=0)

    bold_font = tkFont.Font(font=status['font'])
    bold_font['weight'] = 'bold'

    ns_label = Label(inner_frame, text="Nameservers")
    ns_label.grid(row=0, columnspan=2, sticky=W)
    ns_label['font'] = bold_font

    nameservers = Entry(inner_frame, bg="white", textvariable=self.nameserver_form, width=80)
    nameservers.grid(row=1, columnspan=2, sticky=W, padx=4, pady=2)
    self.nameserver_form.set(', '.join(util.InternalNameServers()))

    global_button = Checkbutton(inner_frame, text="Include global DNS providers (Google Public DNS, OpenDNS, UltraDNS, etc.)", variable=self.use_global)
    global_button.grid(row=2, columnspan=2, sticky=W)
    global_button.toggle()

    regional_button = Checkbutton(inner_frame, text="Include best available regional DNS services", variable=self.use_regional)
    regional_button.grid(row=3, columnspan=2, sticky=W)
    regional_button.toggle()

    censorship_button = Checkbutton(inner_frame, text="Include censorship checks", variable=self.use_censor_checks)
    censorship_button.grid(row=4, columnspan=2, sticky=W)

    if sys.platform[:3] == 'win':
      seperator_width = 470
    else:
      seperator_width = 585
    separator = Frame(inner_frame, height=2, width=seperator_width, bd=1, relief=SUNKEN)
    separator.grid(row=5, padx=5, pady=5, columnspan=2)

    ds_label = Label(inner_frame, text="Test Data Source")
    ds_label.grid(row=10, column=0, sticky=W)
    ds_label['font'] = bold_font

    numqueries_label = Label(inner_frame, text="Number of queries")
    numqueries_label.grid(row=10, column=1, sticky=W)
    numqueries_label['font'] = bold_font

    self.LoadDataSources()
    source_titles = self.data_src.ListSourceTitles()
    data_source = OptionMenu(inner_frame, self.data_source, *source_titles)
    data_source.configure(width=40)
    data_source.grid(row=11, column=0, sticky=W)
    self.data_source.set(source_titles[0])

    query_count = Entry(inner_frame, bg="white", textvariable=self.query_count)
    query_count.grid(row=11, column=1, sticky=W, padx=4)
    self.query_count.set(self.options.query_count)

    bds_label = Label(inner_frame, text="Test Selection Mode")
    bds_label.grid(row=12, column=0, sticky=W)
    bds_label['font'] = bold_font

    run_count_label = Label(inner_frame, text="Number of runs")
    run_count_label.grid(row=12, column=1, sticky=W)
    run_count_label['font'] = bold_font

    modes = [x.title() for x in selectors.GetTypes()]
    selection_mode = OptionMenu(inner_frame, self.selection_mode, *modes)
    selection_mode.configure(width=40)
    selection_mode.grid(row=13, column=0, sticky=W)
    self.selection_mode.set(modes[0])

    run_count = Entry(inner_frame, bg="white", textvariable=self.run_count)
    run_count.grid(row=13, column=1, sticky=W, padx=4)
    self.run_count.set(self.options.run_count)

    self.button = Button(outer_frame, command=self.StartJob)
    self.button.grid(row=15, sticky=E, column=1, pady=4, padx=1)
    self.UpdateRunState(running=True)
    self.UpdateRunState(running=False)
    self.UpdateStatus('namebench %s is ready!' % self.version)

  def MessageHandler(self, event):


Generated by  Doxygen 1.6.0   Back to index