소스 검색

Unit panel reorganization in the GUI.

Iñigo Valentin 4 년 전
부모
커밋
111e049aaf
3개의 변경된 파일137개의 추가작업 그리고 99개의 파일을 삭제
  1. 0 12
      src/RuneOptimizerGUI/classes/PanelInfo.py
  2. 135 85
      src/RuneOptimizerGUI/classes/PanelUnits.py
  3. 2 2
      src/RuneOptimizerGUI/classes/RuneOptimizerFrame.py

+ 0 - 12
src/RuneOptimizerGUI/classes/PanelInfo.py

@@ -52,18 +52,6 @@ class PanelInfo(wx.Panel):
           pointSize=10, family=wx.FONTFAMILY_DEFAULT,
           style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
         )
-        monospaceFont = wx.Font(
-          pointSize=10, family=wx.FONTFAMILY_TELETYPE,
-          style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL
-        )
-        monospaceFontBold = wx.Font(
-          pointSize=8, family=wx.FONTFAMILY_TELETYPE,
-          style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
-        )
-        monospaceFontItalic = wx.Font(
-          pointSize=8, family=wx.FONTFAMILY_TELETYPE,
-          style=wx.FONTSTYLE_ITALIC, weight=wx.FONTWEIGHT_NORMAL
-        )
 
         titleLabel = wx.StaticText(
           parent=self, id=wx.ID_ANY, label=app_info["name"],

+ 135 - 85
src/RuneOptimizerGUI/classes/PanelUnits.py

@@ -36,6 +36,8 @@ class PanelUnits(wx.Panel):
         Checkbox to include or exclude units in no teams.
     detailsSizer : wx.BoxSizer
         Hold the unit detail elements. Hidden until unit selction.
+    nameLabel : wx.StaticText
+        Label for the unit name.
     statGrid : wx.Grid.grid
         Table with the unit base and current stats.
     setLabelList : wx.StaticText[6]
@@ -69,6 +71,7 @@ class PanelUnits(wx.Panel):
     filterNoRunesCheck = None
     filterNoTeamsCheck = None
     detailsSizer = None
+    nameLabel = None
     statGrid = None
     setLabelList = None
     idLabelList = None
@@ -94,16 +97,20 @@ class PanelUnits(wx.Panel):
         wx.Panel.__init__(self, parent=parent, id=id)
 
         # Prepare some fonts
+        titleFont = wx.Font(
+          pointSize=14, family=wx.FONTFAMILY_DEFAULT,
+          style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
+        )
         monospaceFont = wx.Font(
           pointSize=10, family=wx.FONTFAMILY_TELETYPE,
           style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL
         )
         monospaceFontBold = wx.Font(
-          pointSize=8, family=wx.FONTFAMILY_TELETYPE,
+          pointSize=10, family=wx.FONTFAMILY_TELETYPE,
           style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
         )
         monospaceFontItalic = wx.Font(
-          pointSize=8, family=wx.FONTFAMILY_TELETYPE,
+          pointSize=10, family=wx.FONTFAMILY_TELETYPE,
           style=wx.FONTSTYLE_ITALIC, weight=wx.FONTWEIGHT_NORMAL
         )
 
@@ -120,7 +127,6 @@ class PanelUnits(wx.Panel):
         self.unitList.InsertColumn(0, "Name", width=120)
         self.unitList.InsertColumn(1, "Prio.", width=40)
         self.unitList.InsertColumn(2, "Sto.", width=30)
-
         self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.unitSelected, self.unitList)
 
         # List filters
@@ -160,16 +166,42 @@ class PanelUnits(wx.Panel):
         self.Bind(
           wx.EVT_CHECKBOX, self.populateUnitList, self.filterNoTeamsCheck
         )
-
         self.populateUnitList(None)
 
         # Sizer for all the unit details. It will be hidden until a unit is
         # selected.
         self.detailsSizer = wx.BoxSizer(wx.VERTICAL)
 
+        # Unit name
+        self.nameLabel = wx.StaticText(
+          parent=self, label="", pos=(220, 0), size=(120, 100)
+        )
+        self.detailsSizer.Add(self.nameLabel)
+        self.nameLabel.SetFont(titleFont)
+
+        # Team list
+        teamBox = wx.StaticBox(
+          parent=self, label="Teams:",id=wx.ID_ANY,
+          pos=(390, 0), size=(145, 200)
+        )
+        self.detailsSizer.Add(teamBox)
+        self.teamsLabel = wx.StaticText(
+          parent=teamBox, label="", pos=(5, 5), size=(135, 190)
+        )
+        monospaceFont.PointSize -= 2
+        self.teamsLabel.SetFont(monospaceFont)
+        monospaceFont.PointSize += 2
+
+        optimizeButton = wx.Button(
+          parent=self, id=wx.ID_ANY, pos=(230, 120), size=(120, 50),
+          style=wx.LC_REPORT, label="Optimize"
+        )
+        self.detailsSizer.Add(optimizeButton)
+        self.Bind(wx.EVT_BUTTON, self.goToOptimizer, optimizeButton)
+
         # Stats table
         self.statGrid = wx.grid.Grid(
-          parent=self, id=wx.ID_ANY, pos=(210, 260), size=(165, 220)
+          parent=self, id=wx.ID_ANY, pos=(550, 00), size=(165, 220)
         )
         self.detailsSizer.Add(self.statGrid)
         self.statGrid.CreateGrid(
@@ -209,32 +241,31 @@ class PanelUnits(wx.Panel):
         self.statGrid.SetRowLabelValue(row=9, value="DMG")
 
         # Rune list
-        # Decrease fonts for rune tables
-        monospaceFont.PointSize -= 2
+
         runeBoxList = [
           wx.StaticBox(
             parent=self, label="Slot1:",id=wx.ID_ANY,
-            pos=(500, 255), size=(105, 110)
+            pos=(390, 225), size=(145, 150)
           ),
           wx.StaticBox(
             parent=self, label="Slot2:",id=wx.ID_ANY,
-            pos=(610, 255), size=(105, 110)
+            pos=(560, 225), size=(145, 150)
           ),
           wx.StaticBox(
             parent=self, label="Slot3:",id=wx.ID_ANY,
-            pos=(610, 370), size=(105, 110)
+            pos=(560, 390), size=(145, 150)
           ),
           wx.StaticBox(
             parent=self, label="Slot4:",id=wx.ID_ANY,
-            pos=(500, 370), size=(105, 110)
+            pos=(390, 390), size=(145, 150)
           ),
           wx.StaticBox(
             parent=self, label="Slot5:",id=wx.ID_ANY,
-            pos=(390, 370), size=(105, 110)
+            pos=(220, 390), size=(145, 150)
           ),
           wx.StaticBox(
             parent=self, label="Slot6:",id=wx.ID_ANY,
-            pos=(390, 255), size=(105, 110)
+            pos=(220, 225), size=(145, 150)
           )
         ]
         for i in range(0, 6):
@@ -244,105 +275,105 @@ class PanelUnits(wx.Panel):
         self.setLabelList = [
           wx.StaticText(
             parent=runeBoxList[0], id=wx.ID_ANY, label="",
-            pos=(0, 0), size=(105, 10)
+            pos=(0, 0), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[1], id=wx.ID_ANY, label="",
-            pos=(0, 0), size=(105, 10)
+            pos=(0, 0), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[2], id=wx.ID_ANY, label="",
-            pos=(0, 0), size=(105, 10)
+            pos=(0, 0), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[3], id=wx.ID_ANY, label="",
-            pos=(0, 0), size=(105, 10)
+            pos=(0, 0), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[4], id=wx.ID_ANY, label="",
-            pos=(0, 0), size=(105, 10)
+            pos=(0, 0), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[5], id=wx.ID_ANY, label="",
-            pos=(0, 0), size=(105, 10)
+            pos=(0, 0), size=(145, 10)
           ),
         ]
 
         self.idLabelList = [
           wx.StaticText(
             parent=runeBoxList[0], id=wx.ID_ANY, label="",
-            pos=(0, 10), size=(105, 10)
+            pos=(0, 15), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[1], id=wx.ID_ANY, label="",
-            pos=(0, 10), size=(105, 10)
+            pos=(0, 15), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[2], id=wx.ID_ANY, label="",
-            pos=(0, 10), size=(105, 10)
+            pos=(0, 15), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[3], id=wx.ID_ANY, label="",
-            pos=(0, 10), size=(105, 10)
+            pos=(0, 15), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[4], id=wx.ID_ANY, label="",
-            pos=(0, 10), size=(105, 10)
+            pos=(0, 15), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[5], id=wx.ID_ANY, label="",
-            pos=(0, 10), size=(105, 10)
+            pos=(0, 15), size=(145, 10)
           )
         ]
         wx.StaticLine(
           parent=runeBoxList[0], id=wx.ID_ANY,
-          pos=(0, 20), size=(105, 1), style=wx.LC_REPORT
+          pos=(0, 30), size=(145, 1), style=wx.LC_REPORT
         )
         wx.StaticLine(
           parent=runeBoxList[1], id=wx.ID_ANY,
-          pos=(0, 20), size=(105, 1), style=wx.LC_REPORT
+          pos=(0, 30), size=(145, 1), style=wx.LC_REPORT
         )
         wx.StaticLine(
           parent=runeBoxList[2], id=wx.ID_ANY,
-          pos=(0, 20), size=(105, 1), style=wx.LC_REPORT
+          pos=(0, 30), size=(145, 1), style=wx.LC_REPORT
         )
         wx.StaticLine(
           parent=runeBoxList[3], id=wx.ID_ANY,
-          pos=(0, 20), size=(105, 1), style=wx.LC_REPORT
+          pos=(0, 30), size=(145, 1), style=wx.LC_REPORT
         )
         wx.StaticLine(
           parent=runeBoxList[4], id=wx.ID_ANY,
-          pos=(0, 20), size=(105, 1), style=wx.LC_REPORT
+          pos=(0, 30), size=(145, 1), style=wx.LC_REPORT
         )
         wx.StaticLine(
           parent=runeBoxList[5], id=wx.ID_ANY,
-          pos=(0, 20), size=(105, 1), style=wx.LC_REPORT
+          pos=(0, 30), size=(145, 1), style=wx.LC_REPORT
         )
 
         self.mainLabelList = [
           wx.StaticText(
             parent=runeBoxList[0], id=wx.ID_ANY, label="",
-            pos=(0, 30), size=(105, 10)
+            pos=(0, 35), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[1], id=wx.ID_ANY, label="",
-            pos=(0, 30), size=(105, 10)
+            pos=(0, 35), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[2], id=wx.ID_ANY, label="",
-            pos=(0, 30), size=(105, 10)
+            pos=(0, 35), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[3], id=wx.ID_ANY, label="",
-            pos=(0, 30), size=(105, 10)
+            pos=(0, 35), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[4], id=wx.ID_ANY, label="",
-            pos=(0, 30), size=(105, 10)
+            pos=(0, 35), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[5], id=wx.ID_ANY, label="",
-            pos=(0, 30), size=(105, 10)
+            pos=(0, 35), size=(145, 10)
           )
         ]
         for i in range(0, 6):
@@ -351,27 +382,27 @@ class PanelUnits(wx.Panel):
         self.innateLabelList = [
           wx.StaticText(
             parent=runeBoxList[0], id=wx.ID_ANY, label="",
-            pos=(0, 40), size=(105, 10)
+            pos=(0, 50), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[1], id=wx.ID_ANY, label="",
-            pos=(0, 40), size=(105, 10)
+            pos=(0, 50), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[2], id=wx.ID_ANY, label="",
-            pos=(0, 40), size=(105, 10)
+            pos=(0, 50), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[3], id=wx.ID_ANY, label="",
-            pos=(0, 40), size=(105, 10)
+            pos=(0, 50), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[4], id=wx.ID_ANY, label="",
-            pos=(0, 40), size=(105, 10)
+            pos=(0, 50), size=(145, 10)
           ),
           wx.StaticText(
             parent=runeBoxList[5], id=wx.ID_ANY, label="",
-            pos=(0, 40), size=(105, 10)
+            pos=(0, 50), size=(145, 10)
           )
         ]
         for i in range(0, 6):
@@ -381,120 +412,113 @@ class PanelUnits(wx.Panel):
           [
             wx.StaticText(
               parent=runeBoxList[0], id=wx.ID_ANY, label="",
-              pos=(0, 50), size=(105, 10)
+              pos=(0, 70), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[0], id=wx.ID_ANY, label="",
-              pos=(0, 60), size=(105, 10)
+              pos=(0, 85), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[0], id=wx.ID_ANY, label="",
-              pos=(0, 70), size=(105, 10)
+              pos=(0, 100), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[0], id=wx.ID_ANY, label="",
-              pos=(0, 80), size=(105, 10)
+              pos=(0, 115), size=(145, 10)
             )
           ],
           [
             wx.StaticText(
               parent=runeBoxList[1], id=wx.ID_ANY, label="",
-              pos=(0, 50), size=(105, 10)
+              pos=(0, 70), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[1], id=wx.ID_ANY, label="",
-              pos=(0, 60), size=(105, 10)
+              pos=(0, 85), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[1], id=wx.ID_ANY, label="",
-              pos=(0, 70), size=(105, 10)
+              pos=(0, 100), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[1], id=wx.ID_ANY, label="",
-              pos=(0, 80), size=(105, 10)
+              pos=(0, 115), size=(145, 10)
             )
           ],
           [
             wx.StaticText(
               parent=runeBoxList[2], id=wx.ID_ANY, label="",
-              pos=(0, 50), size=(105, 10)
+              pos=(0, 70), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[2], id=wx.ID_ANY, label="",
-              pos=(0, 60), size=(105, 10)
+              pos=(0, 85), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[2], id=wx.ID_ANY, label="",
-              pos=(0, 70), size=(105, 10)
+              pos=(0, 100), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[2], id=wx.ID_ANY, label="",
-              pos=(0, 80), size=(105, 10)
+              pos=(0, 115), size=(145, 10)
             )
           ],
           [
             wx.StaticText(
               parent=runeBoxList[3], id=wx.ID_ANY, label="",
-              pos=(0, 50), size=(105, 10)
+              pos=(0, 70), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[3], id=wx.ID_ANY, label="",
-              pos=(0, 60), size=(105, 10)
+              pos=(0, 85), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[3], id=wx.ID_ANY, label="",
-              pos=(0, 70), size=(105, 10)
+              pos=(0, 100), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[3], id=wx.ID_ANY, label="",
-              pos=(0, 80), size=(105, 10)
+              pos=(0, 115), size=(145, 10)
             )
           ],
           [
             wx.StaticText(
               parent=runeBoxList[4], id=wx.ID_ANY, label="",
-              pos=(0, 50), size=(105, 10)
+              pos=(0, 70), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[4], id=wx.ID_ANY, label="",
-              pos=(0, 60), size=(105, 10)
+              pos=(0, 85), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[4], id=wx.ID_ANY, label="",
-              pos=(0, 70), size=(105, 10)
+              pos=(0, 100), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[4], id=wx.ID_ANY, label="",
-              pos=(0, 80), size=(105, 10)
+              pos=(0, 115), size=(145, 10)
             )
           ],
           [
             wx.StaticText(
               parent=runeBoxList[5], id=wx.ID_ANY, label="",
-              pos=(0, 50), size=(105, 10)
+              pos=(0, 70), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[5], id=wx.ID_ANY, label="",
-              pos=(0, 60), size=(105, 10)
+              pos=(0, 85), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[5], id=wx.ID_ANY, label="",
-              pos=(0, 70), size=(105, 10)
+              pos=(0, 100), size=(145, 10)
             ),
             wx.StaticText(
               parent=runeBoxList[5], id=wx.ID_ANY, label="",
-              pos=(0, 80), size=(105, 10)
+              pos=(0, 115), size=(145, 10)
             )
           ]
         ]
 
-        optimizeButton = wx.Button(
-          parent=self, id=wx.ID_ANY, pos=(500, 500), size=(105, 30),
-          style=wx.LC_REPORT, label="Optimize"
-        )
-        self.detailsSizer.Add(optimizeButton)
-        self.Bind(wx.EVT_BUTTON, self.goToOptimizer, optimizeButton)
-
         # By default, hide all optimization options
         self.detailsSizer.ShowItems(False)
 
@@ -593,13 +617,23 @@ class PanelUnits(wx.Panel):
             current_res,
             current_acc,
             id,
-            name
+            name,
+            level
           FROM units
           WHERE
             id = """ + id + """;
         """)
         row = cursor.fetchone()
         self.selectedId = id
+        nameLabelText = ""
+        unitName = row[17][0:15]
+        if len(unitName) > 8:
+            nameLabelText = \
+              unitName + "\n(Lv." + str(row[18]) + ")\n\n#" + row[16]
+        else:
+            nameLabelText = \
+              unitName + " (Lv." + str(row[18]) + ")\n\n#" + row[16]
+        self.nameLabel.SetLabel(nameLabelText)
         self.detailsSizer.ShowItems(True)
         for i in range(0, 8):
             value = str(row[i])
@@ -650,6 +684,18 @@ class PanelUnits(wx.Panel):
         )
         self.statGrid.SetCellValue(row=9, col=1, s=str(currentDmg))
 
+        # Get the team list
+        cursorTeams = conn.execute("""
+            SELECT id, name FROM teams
+            WHERE id IN (SELECT DISTINCT team FROM units_teams WHERE unit = ?)
+          """,
+          (self.selectedId,)
+        )
+        teamLabelText = ""
+        for row in cursorTeams:
+            teamLabelText += "-" + row[1][0:16].ljust(16, " ")
+            teamLabelText += ("(#" + row[0] + ")").rjust(6) + "\n"
+        self.teamsLabel.SetLabel(teamLabelText)
         # Populate the runes
         cursor = conn.execute("""
           SELECT
@@ -667,15 +713,19 @@ class PanelUnits(wx.Panel):
         """)
         i = 0
         for row in cursor:
-            # Rows are 19 charactes width
-            self.setLabelList[i].SetLabel(set_names[row[2]])
-            rid = ("#" + str(row[0])).rjust(13, " ")
-            self.idLabelList[i].SetLabel(rid)
-            #setname = set_names[row[2]][0:6].ljust(6, " ")
+            # Rows are 18 charactes width
+
+            # First line: Powerup level, ID
+            labelLvId = ("+" + str(row[3])).ljust(3, " ")
+            labelLvId += ("#" + str(row[0])).rjust(15, " ")
+            self.setLabelList[i].SetLabel(labelLvId)
 
-            level = "+" + str(row[3]).ljust(2, " ")
-            effv = ("{:.2f}".format(row[6])).rjust(5, " ")
-            eff = effv + "%"
+            # Second line: Set name, efficiency
+            lvlSetEff = set_names[row[2]][0:6].ljust(6, " ")
+            effv = str(("{:.2f}".format(row[6])).rjust(5, " "))
+            eff = ("  Eff:" + str(effv) + "%")
+            lvlSetEff += eff
+            self.idLabelList[i].SetLabel(lvlSetEff)
 
             # Get all stats
             cursorStats = conn.execute("""
@@ -714,10 +764,10 @@ class PanelUnits(wx.Panel):
                         value = value + "%"
                 line = name + value
                 if slot == -1: # main
-                    self.mainLabelList[i].SetLabel(line + "|   " + level)
+                    self.mainLabelList[i].SetLabel(line)
                 elif slot == 0: # innate
                     innateLabel = line
                 else: # normal stats
                     self.statLabelList[i][slot - 1].SetLabel(line)
-            self.innateLabelList[i].SetLabel(innateLabel + "|" + eff)
+            self.innateLabelList[i].SetLabel(innateLabel)
             i = i + 1

+ 2 - 2
src/RuneOptimizerGUI/classes/RuneOptimizerFrame.py

@@ -71,9 +71,9 @@ class RuneOptimizerFrame(wx.Frame):
         status = row[1] + ", Lv" + str(row[2]) + " (ID #" +str(row[0]) + ")."
         status += " Last updated " + str(row[3])
         if (row[4] == 1):
-            status += ". Modifications aplied since."
+            status += ". Modifications applied since."
         else:
-            status += ". No modifications aplied since."
+            status += ". No modifications applied since."
         self.CreateStatusBar()
         self.SetStatusText(status)