OSDN Git Service

marshal database generator & accessor
[amulettoolsmh4/main.git] / view / notebookseed1view.py
index 0105ce4..29446bd 100644 (file)
@@ -160,32 +160,32 @@ class NoteBookSeed1View():
                     #cannot unpack
                     self.grid_seed1.SetCellBackgroundColour(row, col, wx.NullColor)
 
-    def set_seed1_dict(self, seed1_dict, select_seed1=None):
-        u""" seed1から(no, table_no, result_num, amulet_names, skill_names)への辞書を元に、
+    def set_no2seed1s_dict(self, no2seed1s_dict, select_no=None):
+        u""" 通し番号から(seed1, result_num, amulet_names, skill_names)への辞書を元に、
         noを列ラベルとする表を作成する
-        select_seed1がNoneでなければ、対応する行を選択状態とする"""
-        row_num = len(seed1_dict)
+        select_noがNoneでなければ、対応する行を選択状態とする"""
+        row_num = len(no2seed1s_dict)
         diff = row_num - self.grid_seed1.GetNumberRows()
         if diff > 0:
             self.grid_seed1.AppendRows(diff, False)
         elif diff < 0:
             self.grid_seed1.DeleteRows(0, -diff, False)
 
-        for row, seed1 in enumerate(
-                sorted(seed1_dict.keys(), key=lambda x: seed1_dict[x][0])): # order by no
-            no, table_no, result_num, amu_names, skill_names = seed1_dict[seed1]
+        for row, no in enumerate(sorted(no2seed1s_dict.keys())): # order by no
+            seed1, result_num, amu_names, skill_names = no2seed1s_dict[no]
             self.grid_seed1.SetRowLabelValue(row, u"{0}".format(no))
             self.grid_seed1.SetCellValue(row, 0, "{0}".format(seed1))
             self.grid_seed1.SetCellValue(row, 1, "{0}".format(result_num))
             for col, amu_name, skill_name in zip(
                     range(2, constnumbers.NUM_SEED1_GRID_COL), amu_names, skill_names):
-                if amu_name is not None and skill_name is not None:
+                if ((amu_name is not None and amu_name is not u"") and 
+                    (skill_name is not None and skill_name is not u"")):
                     val = u"{0}{1}{2}".format(
                         constnumbers.AMULET_NAME_TO_SHORT_NAME_DICT[amu_name], self.SEPARATER, skill_name)
                     self.grid_seed1.SetCellValue(row, col, val)
                 else:
                     self.grid_seed1.SetCellValue(row, col, u"")
-            if seed1 == select_seed1:
+            if no == select_no:
                 self.grid_seed1.MakeCellVisible(row, 0)
                 self.grid_seed1.SelectRow(row)