Пример #1
0
    def __init__(self, parent, mainWindow, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        self.mainWindow = mainWindow

        self.columnconfigure(0, weight=1)
        self.columnconfigure(4, weight=1)
        self.configure(pady=10)
        tk.Frame(self, height="0", width="1").grid(row="0", column="0")
        tk.Frame(self, height="0", width="1").grid(row="0", column="4")
        self.counter = 0

        checkboxValue = tk.BooleanVar()
        checkboxValue.set(settings.getGraphDisabled())
        self.graphDisabled = tk.Checkbutton(self,
                                            text="完全禁用图象",
                                            variable=checkboxValue)
        self.graphDisabled.var = checkboxValue
        self.graphDisabled.grid(row=self.counter, column="1", columnspan="2")
        descriptor = tk.Label(self, text="数据标签将仍被显示")
        font = tkFont.Font(font=descriptor['font'])
        font.config(slant='italic')
        descriptor['font'] = font
        descriptor.grid(row=self.counter + 1, column="1", columnspan="2")
        tk.Frame(self, height="20", width="10").grid(row=self.counter + 2,
                                                     column="1",
                                                     columnspan="5")
        self.counter += 3

        self.secondsVar = tk.StringVar()
        self.secondsVar.set(settings.getSeconds())
        self.addSetting(self.secondsVar, "每求一次数据平均值的时间间隔(秒):",
                        "建议将此值设定为高于你武器射速的数值。")

        self.intervalVar = tk.StringVar()
        self.intervalVar.set(settings.getInterval())
        self.addSetting(self.intervalVar, "更新图象与数据标签的时间间隔(毫秒):",
                        "该值越低,电脑CPU的占用越高。")

        self.transparencyVar = tk.StringVar()
        self.transparencyVar.set(settings.getCompactTransparency())
        self.addSetting(self.transparencyVar, "紧凑模式下的窗口透明度:",
                        "100为完全可见,0为完全不可见。")
Пример #2
0
 def __init__(self, parent, mainWindow, **kwargs):
     tk.Frame.__init__(self, parent, **kwargs)
     self.mainWindow = mainWindow
     
     self.columnconfigure(0, weight=1)
     self.columnconfigure(4, weight=1)
     self.configure(pady=10)
     tk.Frame(self, height="0", width="1").grid(row="0", column="0")
     tk.Frame(self, height="0", width="1").grid(row="0", column="4")
     self.counter = 0
     
     checkboxValue = tk.BooleanVar()
     checkboxValue.set(settings.getGraphDisabled())
     self.graphDisabled = tk.Checkbutton(self, text="禁用统计图", variable=checkboxValue)
     self.graphDisabled.var = checkboxValue
     self.graphDisabled.grid(row=self.counter, column="1", columnspan="2")
     descriptor = tk.Label(self, text="标签仍然会显示")
     font = tkFont.Font(font=descriptor['font'])
     font.config(slant='italic')
     descriptor['font'] = font
     descriptor.grid(row=self.counter+1, column="1", columnspan="2")
     tk.Frame(self, height="20", width="10").grid(row=self.counter+2, column="1", columnspan="5")
     self.counter += 3
     
     self.secondsVar = tk.StringVar()
     self.secondsVar.set(settings.getSeconds())
     self.addSetting(self.secondsVar, "DPS计算周期(秒):", 
                     "建议将此条设置为比你武器循环时间高一点的整数")
     
     self.intervalVar = tk.StringVar()
     self.intervalVar.set(settings.getInterval())
     self.addSetting(self.intervalVar, "图形绘制周期(毫秒):", 
                     "数值越低CPU负担越大")
     
     self.transparencyVar = tk.StringVar()
     self.transparencyVar.set(settings.getCompactTransparency())
     self.addSetting(self.transparencyVar, "Compat模式的透明度:", 
                     "100为不透明,0为全透明")
Пример #3
0
 def __init__(self, parent, mainWindow, **kwargs):
     tk.Frame.__init__(self, parent, **kwargs)
     self.mainWindow = mainWindow
     
     self.columnconfigure(0, weight=1)
     self.columnconfigure(4, weight=1)
     self.configure(pady=10)
     tk.Frame(self, height="0", width="1").grid(row="0", column="0")
     tk.Frame(self, height="0", width="1").grid(row="0", column="4")
     self.counter = 0
     
     checkboxValue = tk.BooleanVar()
     checkboxValue.set(settings.getGraphDisabled())
     self.graphDisabled = tk.Checkbutton(self, text="Disable graph entirely", variable=checkboxValue)
     self.graphDisabled.var = checkboxValue
     self.graphDisabled.grid(row=self.counter, column="1", columnspan="2")
     descriptor = tk.Label(self, text="Labels will still be shown")
     font = tkFont.Font(font=descriptor['font'])
     font.config(slant='italic')
     descriptor['font'] = font
     descriptor.grid(row=self.counter+1, column="1", columnspan="2")
     tk.Frame(self, height="20", width="10").grid(row=self.counter+2, column="1", columnspan="5")
     self.counter += 3
     
     self.secondsVar = tk.StringVar()
     self.secondsVar.set(settings.getSeconds())
     self.addSetting(self.secondsVar, "Number of seconds to average values:", 
                     "Recommended to set this value higher than your weapon cycle time")
     
     self.intervalVar = tk.StringVar()
     self.intervalVar.set(settings.getInterval())
     self.addSetting(self.intervalVar, "How often to update graph/labels in milliseconds:", 
                     "The lower you set this value, the higher your CPU usage will be")
     
     self.transparencyVar = tk.StringVar()
     self.transparencyVar.set(settings.getCompactTransparency())
     self.addSetting(self.transparencyVar, "Window transparency percentage in compact mode:", 
                     "100 is fully visible, 0 is invisible")
Пример #4
0
    def changeSettings(self):
        """This function is called when a user changes settings after the settings are verified"""
        if self.is_alive():
            self.paused = True
            self.mainWindow.after_cancel(self.animate)
            self.graph.subplot.clear()
        if self.simulationEnabled:
            self.simulationSettings(enable=False)
            self.mainWindow.mainMenu.menu.delete(7)
            self.mainWindow.mainMenu.menu.insert_command(
                7,
                label="Simulate Input",
                command=lambda: simulationWindow.SimulationWindow(self.
                                                                  mainWindow))
            self.mainWindow.topLabel.grid_remove()
            self.mainWindow.mainMenu.menu.entryconfig(5, state="normal")

        self.slowDown = False
        self.seconds = settings.getSeconds()
        self.interval = settings.getInterval()
        self.categories["dpsOut"]["settings"] = settings.getDpsOutSettings()
        self.categories["dpsIn"]["settings"] = settings.getDpsInSettings()
        self.categories["logiOut"]["settings"] = settings.getLogiOutSettings()
        self.categories["logiIn"]["settings"] = settings.getLogiInSettings()
        self.categories["capTransfered"][
            "settings"] = settings.getCapTransferedSettings()
        self.categories["capRecieved"][
            "settings"] = settings.getCapRecievedSettings()
        self.categories["capDamageOut"][
            "settings"] = settings.getCapDamageOutSettings()
        self.categories["capDamageIn"][
            "settings"] = settings.getCapDamageInSettings()
        self.categories["mining"]["settings"] = settings.getMiningSettings()
        self.graphDisabled = settings.getGraphDisabled()

        if self.graphDisabled:
            self.graph.grid_remove()
        else:
            self.graph.grid()

        self.labelHandler.redoLabels()
        self.mainWindow.makeAllChildrenDraggable(self.labelHandler)

        if settings.detailsWindowShow:
            self.mainWindow.detailsWindow.deiconify()
        else:
            self.mainWindow.detailsWindow.withdraw()

        if self.fleetMode and settings.fleetWindowShow:
            self.mainWindow.fleetWindow.deiconify()
        else:
            self.mainWindow.fleetWindow.withdraw()

        self.arrayLength = int((self.seconds * 1000) / self.interval)
        historicalTemplate = [0] * self.arrayLength
        yValuesTemplate = np.array([0] * self.arrayLength)
        ySmooth = self.graph.smoothListGaussian(yValuesTemplate, 5)
        # resets all the arrays to contain no values
        showAnyPeakOrTotal = False
        for category, items in self.categories.items():
            if items["settings"]:
                self.labelHandler.enableLabel(category, True)
                showPeak = items["settings"][0].get("showPeak", False)
                self.labelHandler.enablePeak(category, showPeak)
                showTotal = items["settings"][0].get("showTotal", False)
                findColor = lambda x, category=category: self.findColor(
                    category, x)
                showAnyPeakOrTotal = showAnyPeakOrTotal or showPeak or showTotal
                self.labelHandler.enableTotal(category, findColor, showTotal)
                self.detailsHandler.enableLabel(category, True)
                items["historical"] = historicalTemplate.copy()
                items["historicalDetails"] = [[]] * self.arrayLength
                items["yValues"] = yValuesTemplate.copy()
                items["labelOnly"] = items["settings"][0].get(
                    "labelOnly", False)
                if not items["labelOnly"]:
                    plotLine, = self.graph.subplot.plot(ySmooth,
                                                        zorder=items["zorder"])
                    items["lines"] = [plotLine]
            else:
                self.labelHandler.enableLabel(category, False)
                self.labelHandler.enablePeak(category, False)
                self.detailsHandler.enableLabel(category, False)

        self.mainWindow.showClearMenuOption(
            showAnyPeakOrTotal,
            lambda: self.labelHandler.clearValues(self.findColor))

        if not self.graphDisabled:
            self.graph.subplot.margins(0, 0)
            self.graph.graphFigure.axes[0].set_ylim(bottom=0, top=100)
            self.graph.graphFigure.canvas.draw()

        # reset fleet data
        characterName = self.mainWindow.fleetWindow.characterName
        if self.dataQueue:
            self.fleetData = {
                'aggregate': {
                    'dpsOut': {
                        'historical': historicalTemplate.copy(),
                        'yValues': yValuesTemplate.copy()
                    },
                    'dpsIn': {
                        'historical': historicalTemplate.copy(),
                        'yValues': yValuesTemplate.copy()
                    },
                    'logiOut': {
                        'historical': historicalTemplate.copy(),
                        'yValues': yValuesTemplate.copy()
                    }
                },
                'dpsOut': {
                    characterName: {
                        'historical': historicalTemplate.copy(),
                        'yValues': yValuesTemplate.copy()
                    }
                },
                'dpsIn': {
                    characterName: {
                        'historical': historicalTemplate.copy(),
                        'yValues': yValuesTemplate.copy()
                    }
                },
                'logiOut': {
                    characterName: {
                        'historical': historicalTemplate.copy(),
                        'yValues': yValuesTemplate.copy()
                    }
                }
            }
        self.mainWindow.fleetWindow.resetGraphs(ySmooth)
        self.mainWindow.fleetWindow.changeSettings()

        self.paused = False
Пример #5
0
 def changeSettings(self):
     """This function is called when a user changes settings after the settings are verified"""
     if self.is_alive():
         self.paused = True
         self.mainWindow.after_cancel(self.animate)
         self.graph.subplot.clear()
     if self.simulationEnabled:
         self.simulationSettings(enable=False)
         self.mainWindow.mainMenu.menu.delete(5)
         self.mainWindow.mainMenu.menu.insert_command(5, label="Simulate Input", command=lambda: simulationWindow.SimulationWindow(self.mainWindow))
         self.mainWindow.topLabel.grid_remove()
         self.mainWindow.mainMenu.menu.entryconfig(3, state="normal")
     
     self.slowDown = False
     self.seconds = settings.getSeconds()
     self.interval = settings.getInterval()
     self.categories["dpsOut"]["settings"] = settings.getDpsOutSettings()
     self.categories["dpsIn"]["settings"] = settings.getDpsInSettings()
     self.categories["logiOut"]["settings"] = settings.getLogiOutSettings()
     self.categories["logiIn"]["settings"] = settings.getLogiInSettings()
     self.categories["capTransfered"]["settings"] = settings.getCapTransferedSettings()
     self.categories["capRecieved"]["settings"] = settings.getCapRecievedSettings()
     self.categories["capDamageOut"]["settings"] = settings.getCapDamageOutSettings()
     self.categories["capDamageIn"]["settings"] = settings.getCapDamageInSettings()
     self.categories["mining"]["settings"] = settings.getMiningSettings()
     self.graphDisabled = settings.getGraphDisabled()
     
     if self.graphDisabled:
         self.graph.grid_remove()
     else:
         self.graph.grid()
     
     self.labelHandler.redoLabels()
     
     if settings.detailsWindowShow:
         self.mainWindow.detailsWindow.deiconify()
     else:
         self.mainWindow.detailsWindow.withdraw()
     
     # resets all the arrays to contain no values
     for category, items in self.categories.items():
         if items["settings"]:
             self.labelHandler.enableLabel(category, True)
             self.detailsHandler.enableLabel(category, True)
             items["historical"] = [0] * int((self.seconds*1000)/self.interval)
             items["historicalDetails"] = [[]] * int((self.seconds*1000)/self.interval)
             items["yValues"] = np.array([0] * int((self.seconds*1000)/self.interval))
             try:
                 items["labelOnly"] = items["settings"][0]["labelOnly"]
             except KeyError:
                 items["settings"][0]["labelOnly"] = False
                 items["labelOnly"] = items["settings"][0]["labelOnly"]
             if not items["labelOnly"]:
                 ySmooth = self.graph.smoothListGaussian(items["yValues"], 5)
                 plotLine, = self.graph.subplot.plot(ySmooth, zorder=items["zorder"])
                 items["lines"] = [plotLine]
         else:
             self.labelHandler.enableLabel(category, False)
             self.detailsHandler.enableLabel(category, False)
     
     if not self.graphDisabled:
         self.graph.subplot.margins(0,0)
         self.graph.graphFigure.axes[0].set_ylim(bottom=0, top=100)
         self.graph.graphFigure.canvas.draw()
     
     self.paused = False