소스 검색

App information for CLI and GUI.

Iñigo Valentin 4 년 전
부모
커밋
b168354792

+ 8 - 2
src/RuneOptimizer/RuneOptimizer.c

@@ -67,8 +67,14 @@ int main(int argc, char *argv[]){
     }
     strcat(db_location, DB_NAME);
 
-    // Update command, TODO
-    if (strcmp(argv[1], "update") == 0){
+    // Version command
+    if (strcmp(argv[1], "version") == 0){
+        printf("%s\n", VERSION);
+        return SUCCESS;
+    }
+
+    // Update command
+    else if (strcmp(argv[1], "update") == 0){
         return update(argc - 2, argv + 2);
     }
 

+ 4 - 0
src/RuneOptimizer/RuneOptimizer.h

@@ -15,6 +15,10 @@
  * RuneOptimizer. If not, see <https://www.gnu.org/licenses/>.
  */
 
+#define VERSION "0.1-RC1"
+#define AUTHOR "Iñigo Valentin"
+#define MAIL "i@inigovalentin.com"
+
 #define DB_NAME "data.sqlite"
 
 #define TRUE 1

+ 2 - 1
src/RuneOptimizer/help/help.c

@@ -19,7 +19,8 @@
  * Displays the help text.
  */
 void show_help(){
-    printf("\nRune Optimizer v0.1\n");
+    printf("\nRune Optimizer %s\n", VERSION);
+    printf("%s <%s>\n", AUTHOR, MAIL);
     printf("\n  Usage:\n");
     printf("  RuneOptimizer [command] [options]\n");
     printf("\n\n  Command: helps\n");

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 19 - 13
src/RuneOptimizerGUI/RuneOptimizer.py


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

@@ -0,0 +1,117 @@
+"""
+This file is part of RuneOptimizer.
+
+RuneOptimizer is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or (at your option)
+any later version.
+
+RuneOptimizer is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+more details.
+
+You should have received a copy of the GNU General Public License along with
+RuneOptimizer. If not, see <https://www.gnu.org/licenses/>.
+
+"""
+
+class PanelInfo(wx.Panel):
+    """
+    The panel that shows info about the app.
+
+    """
+
+    def __init__(self, parent, id=wx.ID_ANY):
+        """Initializes the panel.
+
+        Sets up all the widgets.
+
+        Parameters
+        ----------
+        parent : wx.*
+            Panel parent.
+        id : int, optional
+            ID for the panel (default wx.ID_ANY).
+
+        """
+
+        # Parent constructor
+        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
+        )
+        labelFont = wx.Font(
+          pointSize=10, family=wx.FONTFAMILY_DEFAULT,
+          style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL
+        )
+        contentFont = wx.Font(
+          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"],
+          pos=(30, 30), size=(400, 40)
+        )
+        titleLabel.SetFont(titleFont)
+
+        text = wx.StaticText(
+          parent=self, id=wx.ID_ANY, label="Application version:",
+          pos=(40, 90), size=(150, 30), style=wx.ALIGN_RIGHT
+        )
+        text.SetFont(labelFont)
+        text = wx.StaticText(
+          parent=self, id=wx.ID_ANY, label=app_info["app_version"],
+          pos=(200, 90), size=(400, 30)
+        )
+        text.SetFont(contentFont)
+        text = wx.StaticText(
+          parent=self, id=wx.ID_ANY, label="GUI version:",
+          pos=(40, 120), size=(150, 30), style=wx.ALIGN_RIGHT
+        )
+        text.SetFont(labelFont)
+        text = wx.StaticText(
+          parent=self, id=wx.ID_ANY, label=app_info["gui_version"],
+          pos=(200, 120), size=(400, 30)
+        )
+        text.SetFont(contentFont)
+        text = wx.StaticText(
+          parent=self, id=wx.ID_ANY, label="Author:",
+          pos=(40, 150), size=(150, 30), style=wx.ALIGN_RIGHT
+        )
+        text.SetFont(labelFont)
+        text = wx.StaticText(
+          parent=self, id=wx.ID_ANY,
+          label=app_info["author"] + " <" +app_info["author_mail"] + ">",
+          pos=(200, 150), size=(400, 30)
+        )
+        text.SetFont(contentFont)
+        y = 180
+        for name, url in app_info["url"].items():
+            text = wx.StaticText(
+              parent=self, id=wx.ID_ANY, label=name + ":",
+              pos=(40, y), size=(150, 30), style=wx.ALIGN_RIGHT
+            )
+            text.SetFont(labelFont)
+            text = wx.adv.HyperlinkCtrl(
+                parent=self, id=wx.ID_ANY, label=url,
+                pos=(200-8, y-5), size=(400, 30), style=wx.adv.HL_ALIGN_LEFT
+            )
+            text.SetFont(contentFont)
+            y += 30

+ 1 - 1
src/RuneOptimizerGUI/classes/PanelResults.py

@@ -148,7 +148,7 @@ class PanelResults(wx.Panel):
         )
 
         # Unit name and id
-        self.unitNameLabel =wx.StaticText(
+        self.unitNameLabel = wx.StaticText(
             parent=self, id=wx.ID_ANY, label="Nothing yet. Optimize something!",
             pos=(0, 0), size=(400, 30)
         )

+ 12 - 1
src/RuneOptimizerGUI/classes/TabList.py

@@ -30,6 +30,8 @@ class TabList(wx.Listbook):
         Optimizer view.
     frameResults : PanelUnits
         Optimization results view.
+    frameInfo : PanelInfo
+        Info view.
 
     Methods
     -------
@@ -44,6 +46,7 @@ class TabList(wx.Listbook):
     frameTeams = None
     frameOptimizer = None
     frameResults = None
+    frameInfo = None
 
     def __init__(
       self, parent, id=wx.ID_ANY
@@ -94,6 +97,12 @@ class TabList(wx.Listbook):
           type=wx.BITMAP_TYPE_BMP
         )
         il.Add(bmp)
+        bmp.LoadFile(
+          name=os.path.dirname(os.path.realpath(__file__)) +
+          "/res/icon/info.bmp",
+          type=wx.BITMAP_TYPE_BMP
+        )
+        il.Add(bmp)
         self.AssignImageList(il)
 
         # Create the entries
@@ -101,11 +110,13 @@ class TabList(wx.Listbook):
         self.frameTeams = PanelTeams(self)
         self.frameOptimizer = PanelOptimizer(self)
         self.frameResults = PanelResults(self)
+        self.frameInfo = PanelInfo(self)
         pages = [
           (self.frameUnits, "Units"),
           (self.frameTeams, "Teams"),
           (self.frameOptimizer, "Optimize"),
-          (self.frameResults, "Results")
+          (self.frameResults, "Results"),
+          (self.frameInfo, "Info")
         ]
 
         # Add icons to the entries

BIN
src/RuneOptimizerGUI/res/icon/info.bmp


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.