Exemplo n.º 1
0
	def run_algorithm (self, clicked, arg):
		alg = arg[0]
		label = arg[1]

		# desativando os controles que nao fazem sentido durante
		# o algoritmo
		self.left_box.set_sensitive (FALSE)
		if self.hide.get_active ():
			self.dyn_controls_box.set_sensitive (FALSE)
		self.hide.set_sensitive (FALSE)

		self.extra_label.set_text ('----------')
		self.canvas.grab_focus ()
		id = self.window.connect ('key_release_event', self.key_release)
		while events_pending (): mainiteration ()

		cont, extra_info = geocomp.run_algorithm (alg, self.points)

		self.window.disconnect (id)
		if self.hide.get_active ():
			self.dyn_controls_box.set_sensitive (TRUE)
		self.hide.set_sensitive (TRUE)
		self.left_box.set_sensitive (TRUE)
		label.set_text ("%6d"%cont)
		if extra_info is not None:
			self.extra_label.set_text (extra_info)
Exemplo n.º 2
0
    def run_algorithm(self, clicked, arg):
        alg = arg[0]
        label = arg[1]

        # desativando os controles que nao fazem sentido durante
        # o algoritmo
        self.left_box.set_sensitive(FALSE)
        if self.hide.get_active():
            self.dyn_controls_box.set_sensitive(FALSE)
        self.hide.set_sensitive(FALSE)

        self.extra_label.set_text('----------')
        self.canvas.grab_focus()
        id = self.window.connect('key_release_event', self.key_release)
        while events_pending():
            mainiteration()

        cont, extra_info = geocomp.run_algorithm(alg, self.points)

        self.window.disconnect(id)
        if self.hide.get_active():
            self.dyn_controls_box.set_sensitive(TRUE)
        self.hide.set_sensitive(TRUE)
        self.left_box.set_sensitive(TRUE)
        label.set_text("%6d" % cont)
        if extra_info is not None:
            self.extra_label.set_text(extra_info)
Exemplo n.º 3
0
def run_alg(func, localInput):
    init = time.clock()
    cont, extra = geocomp.run_algorithm(func, localInput)
    end = time.clock()

    delta = end - init

    print(repr(cont), '  ', '%.2f' % delta, 's', '  ', extra)
    sys.stdout.flush()
def run_alg (func, input):
	init = time.clock ()
	cont, extra = geocomp.run_algorithm (func, input)
	end = time.clock ()

	delta = end - init

	print `cont`, '  ','%.2f'%delta,'s', '  ', extra
	sys.stdout.flush ()
Exemplo n.º 5
0
def run_alg (func, input):
	init = time.clock ()
	cont, extra = geocomp.run_algorithm (func, input)
	end = time.clock ()

	delta = end - init

	print `cont`, '  ','%.2f'%delta,'s', '  ', extra
	sys.stdout.flush ()
Exemplo n.º 6
0
def run_alg (func, localInput):
	init = time.clock ()
	cont, extra = geocomp.run_algorithm (func, localInput)
	end = time.clock ()

	delta = end - init

	print(repr(cont), '  ','%.2f'%delta,'s', '  ', extra)
	sys.stdout.flush ()
Exemplo n.º 7
0
    def run_algorithm(self, alg, widget, alg_name):
        """roda o algoritmo alg"""
        self.file_cont = 0
        self.current_algorithm = alg_name

        if len(self.points) == 0:
            return

        self.bottom_label['text'] = '----------'
        self.disable()
        self.canvas.focus_set()
        self.tk.bind('<space>', self.step_cb)

        cont, extra = geocomp.run_algorithm(alg, self.points)

        widget.label['text'] = "%6d" % cont
        if extra is not None:
            self.bottom_label['text'] = extra

        self.tk.unbind('<space>')
        self.enable()
	def run_algorithm (self, alg, widget, alg_name):
		"""roda o algoritmo alg"""
		self.file_cont = 0
		self.current_algorithm = alg_name

		if len (self.input) == 0:
			return

		self.bottom_label['text'] = '----------'
		self.disable ()
		self.canvas.focus_set ()
		self.tk.bind ('<space>', self.step_cb)

		cont, extra = geocomp.run_algorithm (alg, self.input)

		widget.label['text'] = "%6d"%cont
		if extra is not None:
			self.bottom_label['text'] = extra

		self.tk.unbind ('<space>')
		self.enable ()