OSDN Git Service

add alchemy simulator
[amulettoolsmh4/main.git] / amulettool.py
index 91bd3b8..6c9911b 100644 (file)
@@ -52,6 +52,7 @@ class AmuletToolController(wx.App):
         self._init_notebook_skill1()
         self._init_notebook_skill2()
         self._init_notebook_setting()
+        self._init_notebook_simulator()
         self._init_notebook_amulet()
 
         self.frame_view.EnableNoteBook()
@@ -149,6 +150,13 @@ class AmuletToolController(wx.App):
         self.notebook_skill1_view.bind_button_search(self.OnClickSkill1Search)
         self.notebook_skill1_view.bind_button_clear(self.OnClickSkill1Clear)
 
+    def _init_notebook_simulator(self):
+        u""" Seed1,Seed2による錬金シミュレータータブのviewの初期化 """
+        self.notebook_simulator_view = self.frame_view.notebook_simulator_view
+        self.notebook_simulator_view.bind_button_search(self.OnClickSimulatorSearch)
+        self.notebook_simulator_view.bind_button_clear(self.OnClickSimulatorClear)
+
+
     def _update_notebook_amulet(self, amulet_id=None):
         u""" お守り検索タブのviewの更新
         amulet_id が Noneでない場合、お守りの種類に応じてComboboxを再設定する
@@ -330,6 +338,35 @@ class AmuletToolController(wx.App):
         self.notebook_skill2_view.clear_result_text()
         self.notebook_skill2_view.clear_inishie()
 
+    u""" Alchemy Simulator's event """
+    def OnClickSimulatorSearch(self, evt):
+        u""" alchemy simulation from seed1, seed2"""
+        seeds = self.notebook_simulator_view.get_seed_values()
+        alchemy_type = self.notebook_simulator_view.get_tenun_radio_key()
+        if seeds is not None:
+            seed1, seed2 = seeds
+            #try:
+            result = self.db_accessor.simulate_nazo(seed1, seed2)
+            self.notebook_simulator_view.set_values(view.KEY_NAZO, *result)
+            result = self.db_accessor.simulate_komyou(seed1, seed2)
+            self.notebook_simulator_view.set_values(view.KEY_KOMYOU, *result)
+            result = self.db_accessor.simulate_inishie(seed1, seed2)
+            self.notebook_simulator_view.set_values(view.KEY_INISHIE, *result)
+            result = self.db_accessor.simulate_tenun(seed1, seed2, alchemy_type)
+            self.notebook_simulator_view.set_tenun_values(result)
+            #except KeyError, e:
+            #   self._show_message_dialog(message=u"指定されたSeed値は存在しません")
+            #finally:
+            self.notebook_simulator_view.update_highlight(self._highlight_skills)
+        else:
+            self._show_message_dialog(message=u"Seed値には数字を入力してください")
+
+    def OnClickSimulatorClear(self, evt):
+        u""" clear simulator form """
+        self.notebook_simulator_view.clear_seed_values()
+        self.notebook_simulator_view.clear_grid()
+        self.notebook_simulator_view.clear_highlight()
+
     u""" amulet search event """
     def OnClickAmuletRadioAmulet(self, evt):
         u""" switch skill lists by amulet id """