Example #1
0
	def MakeButtons(self):
		self.run_button = wx.Button(self, wx.ID_ANY, _('Run'))
		self.cancel_button = wx.Button(self, wx.ID_STOP, _('Cancel Mission'))
		self.cancel_button.Disable()
		self.Bind(wx.EVT_BUTTON, self.OnRun, self.run_button)
		self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancel_button)
		button_sizer = wx.BoxSizer(wx.HORIZONTAL)
		button_sizer.Add(self.run_button, wx.ALIGN_RIGHT)
		button_sizer.Add(self.cancel_button, wx.ALIGN_RIGHT)
		return button_sizer
Example #2
0
	def __init__(self, parent):
		wx.Panel.__init__(self, parent)
		self.mission_player = None
		self.parent = parent
		sizer = wx.BoxSizer(wx.HORIZONTAL)		
		min, max = difficulty_range()
		slider = LabeledSlider(self, _('Difficulty'), lambda x: _(self.TranslateDifficulty(x)), minValue = min, maxValue = max)
		sizer.Add(slider, 1, wx.EXPAND | wx.ALL, border=5)
		sizer.Add(self.MakeButtons(), 0, wx.CENTER | wx.ALL | wx.ALIGN_RIGHT, border=5)
		self.SetSizer(sizer)
Example #3
0
	def OnClose(self, event):
		#TODO: make mission player
		self.mission_player = None
		if not self.mission_player is None:
			dial = wx.MessageDialog(None, _('Are really that scared?!?'), _('Abort mission?'),
				wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
			ret = dial.ShowModal()
			if ret == wx.ID_YES:
				self.Destroy()
			else:
				event.Veto()
		else: 
			self.Destroy()
Example #4
0
	def OnRun(self, evt):
		if self.mission_player is None:
			self.cancel_button.Enable()
			self.run_button.SetLabel(_('Pause'))
			mission_player = Mission.generate(self.slider.GetValue())
			mission_player.subscribe(parent.OnMissionPlayer)
			mission_player.start()
		elif not self.mission_player.done:
			self.mission_player.pause()
			self.run_button.SetLabel(_('Resume'))
		else:
			self.mission_player.resume()
			self.run_button.SetLabel(_('Pause'))
Example #5
0
	def _makeFeedback(self):
		sizer = wx.BoxSizer(wx.HORIZONTAL)
		right = wx.BoxSizer(wx.VERTICAL)
		left = wx.BoxSizer(wx.VERTICAL)
		label = wx.StaticText(self, label=_('Mission Log'))
		missionLog = wx.TextCtrl(self, style=wx.TE_MULTILINE)
		left.Add(label, 0, wx.TOP | wx.LEFT, border=5)
		left.Add(missionLog, 1, wx.EXPAND | wx.ALL, border=5)
		description = wx.StaticText(self, label=_('Stuff happens'))
		right.Add(description, 1, wx.CENTER | wx.EXPAND)
		sizer.Add(left, 1, wx.EXPAND)
		sizer.Add(right, 1, wx.EXPAND)
		return sizer
 def _setup_wildcard(self):
     
     self._wildcard = []
     
     all_filenames = set()
     for io_class in medipy.io.schemes.file.io_classes :
         for filename in io_class.filenames :
             all_filenames.add(filename)
     all_filenames.add("DICOMDIR")
     all_filenames.add("dicomdir")
     
     # All known images
     self._wildcard += [_("All known images"), ";".join(all_filenames)]
     # One entry for each filename
     for filename in all_filenames :
         self._wildcard += [filename, filename]
     # DICOMDIR
     self._wildcard += ["DICOMDIR", "DICOMDIR;dicomdir"]
     # Everything else
     self._wildcard += [_("All"), "*"]
     
     self._wildcard = "|".join(self._wildcard)
Example #7
0
	def _makeMenu(self):
		menuBar = wx.MenuBar()
		with addMenu(menuBar, _("File")) as filemenu:
			quit = filemenu.Append(wx.ID_EXIT, _("Quit"))
			self.Bind(wx.EVT_MENU, self.OnQuit, quit)
		with addMenu(menuBar, _("Settings")) as settingsmenu:
			with addMenu(settingsmenu, _("Languages")) as languagemenu:
				for language in languages.getAllLanguages():
					langEntry = languagemenu.Append(wx.ID_ANY, language['name'], kind=wx.ITEM_CHECK)
					def setToLanguage(l, languagemenu, langEntry):
						return lambda evt: self.SetLanguage(l, languagemenu, langEntry)
					self.Bind(wx.EVT_MENU, setToLanguage(language, languagemenu, langEntry), langEntry)
		with addMenu(menuBar, _("Help")) as helpmenu:
			about = helpmenu.Append(wx.ID_ABOUT, _("About"))
			self.Bind(wx.EVT_MENU, self.OnAbout, about)
		self.SetMenuBar(menuBar)
Example #8
0
	def TranslateDifficulty(self, value):
		return _(self.parent.TranslateDifficulty(value))