Merge branch 'master' into py3EFFS
This commit is contained in:
@@ -169,7 +169,7 @@ class AttributeGauge(wx.Window):
|
||||
def SetValue(self, value, animate=True):
|
||||
""" Sets the current position of the gauge. """
|
||||
|
||||
print ("="*20, self._percentage)
|
||||
print("=" * 20, self._percentage)
|
||||
if self._value == value:
|
||||
return
|
||||
|
||||
@@ -248,14 +248,15 @@ class AttributeGauge(wx.Window):
|
||||
w = min(w, half) # Ensure that we don't overshoot our drawing area
|
||||
w = math.ceil(w) # round up to nearest pixel, this ensures that we don't lose representation for sub pixels
|
||||
|
||||
# print("Percentage: {}\t\t\t\t\tValue: {}\t\t\t\t\tWidth: {}\t\t\t\t\tHalf: {}\t\t\t\t\tRect Width: {}".format(round(self._percentage, 3), round(value,3), w, half, rect.width))
|
||||
# print("Percentage: {}\t\t\t\t\tValue: {}\t\t\t\t\tWidth: {}\t\t\t\t\tHalf: {}\t\t\t\t\tRect Width: {}".format(
|
||||
# round(self._percentage, 3), round(value,3), w, half, rect.width))
|
||||
|
||||
# set guide_lines every 10 pixels of the main gauge (not including borders)
|
||||
if self.guide_lines:
|
||||
for x in range(1, 20):
|
||||
dc.SetBrush(wx.Brush(wx.LIGHT_GREY))
|
||||
dc.SetPen(wx.Pen(wx.LIGHT_GREY))
|
||||
dc.DrawRectangle(x*10, 1, 1, rect.height)
|
||||
dc.DrawRectangle(x * 10, 1, 1, rect.height)
|
||||
|
||||
dc.SetBrush(wx.Brush(colour))
|
||||
dc.SetPen(wx.Pen(colour))
|
||||
@@ -264,10 +265,10 @@ class AttributeGauge(wx.Window):
|
||||
# However, if there is an odd width, the middle pixel is shared between the left and right gauge
|
||||
|
||||
if value >= 0:
|
||||
padding = (half if is_even else math.ceil(half-1)) + 1
|
||||
padding = (half if is_even else math.ceil(half - 1)) + 1
|
||||
dc.DrawRectangle(padding, 1, w, rect.height)
|
||||
else:
|
||||
padding = half - w + 1 if is_even else math.ceil(half)-(w-1)
|
||||
padding = half - w + 1 if is_even else math.ceil(half) - (w - 1)
|
||||
dc.DrawRectangle(padding, 1, w, rect.height)
|
||||
|
||||
if self.leading_edge and (self.edge_on_neutral or value != 0):
|
||||
@@ -277,7 +278,7 @@ class AttributeGauge(wx.Window):
|
||||
if value > 0:
|
||||
dc.DrawRectangle(min(padding + w, rect.width), 1, 1, rect.height)
|
||||
else:
|
||||
dc.DrawRectangle(max(padding-1, 1), 1, 1, rect.height)
|
||||
dc.DrawRectangle(max(padding - 1, 1), 1, 1, rect.height)
|
||||
|
||||
def OnTimer(self, event):
|
||||
old_value = self._old_percentage
|
||||
@@ -332,14 +333,12 @@ if __name__ == "__main__":
|
||||
wx.Panel.__init__(self, parent, size=size)
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
|
||||
|
||||
self.gauge = gauge = AttributeGauge(self, size=(204, 4))
|
||||
gauge.SetBackgroundColour(wx.Colour(52, 86, 98))
|
||||
gauge.SetBarColour(wx.Colour(255, 128, 0))
|
||||
gauge.SetValue(100)
|
||||
gauge.SetFractionDigits(1)
|
||||
box.Add(gauge, 0, wx.ALL|wx.CENTER, 10)
|
||||
box.Add(gauge, 0, wx.ALL | wx.CENTER, 10)
|
||||
|
||||
self.gauge11 = gauge = AttributeGauge(self, size=(204, 6))
|
||||
gauge.SetBackgroundColour(wx.Colour(52, 86, 98))
|
||||
@@ -473,16 +472,16 @@ if __name__ == "__main__":
|
||||
def UpdateValue2(self, event):
|
||||
num = self.spinCtrl2.GetValue()
|
||||
self.gauge2.SetValue(num)
|
||||
self.gauge3.SetValue(num*-1)
|
||||
self.gauge3.SetValue(num * -1)
|
||||
self.gauge4.SetValue(num)
|
||||
self.gauge5.SetValue(num*-1)
|
||||
self.gauge5.SetValue(num * -1)
|
||||
self.gauge6.SetValue(num)
|
||||
self.gauge7.SetValue(num*-1)
|
||||
self.gauge7.SetValue(num * -1)
|
||||
self.gauge8.SetValue(num)
|
||||
self.gauge9.SetValue(num*-1)
|
||||
self.gauge9.SetValue(num * -1)
|
||||
|
||||
def OnTimer(self, evt):
|
||||
num = random.randint(-100,100)
|
||||
num = random.randint(-100, 100)
|
||||
self.gauge.SetValue(num)
|
||||
self.gauge11.SetValue(num)
|
||||
self.gauge12.SetValue(num)
|
||||
|
||||
@@ -100,10 +100,10 @@ class AttributeSlider(wx.Panel):
|
||||
slider_percentage = 0
|
||||
if mod < 1:
|
||||
modEnd = self.UserMinValue
|
||||
slider_percentage = (1-mod)/(1 - modEnd) * -100
|
||||
slider_percentage = (1 - mod) / (1 - modEnd) * -100
|
||||
elif mod > 1:
|
||||
modEnd = self.UserMaxValue
|
||||
slider_percentage = ((mod-1)/(modEnd-1)) * 100
|
||||
slider_percentage = ((mod - 1) / (modEnd - 1)) * 100
|
||||
# print(slider_percentage)
|
||||
if self.inverse:
|
||||
slider_percentage *= -1
|
||||
@@ -111,6 +111,7 @@ class AttributeSlider(wx.Panel):
|
||||
if post_event:
|
||||
wx.PostEvent(self, ValueChanged(self, None, value, None, slider_percentage))
|
||||
|
||||
|
||||
class TestAttributeSlider(wx.Frame):
|
||||
|
||||
def __init__(self, parent, id):
|
||||
@@ -245,4 +246,3 @@ if __name__ == "__main__":
|
||||
# else:
|
||||
# self.statxt2.SetLabel("{0:.3f} ({1:+.3f})".format(newValue, newValue - self.base_value, ))
|
||||
# self.statxt2.SetToolTip("{0:+f}%".format(new_mod*100))
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ from gui.contextMenu import ContextMenu
|
||||
from .itemAttributes import ItemParams
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
import random
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class ItemMutator(wx.Panel):
|
||||
|
||||
def __init__(self, parent, stuff, item):
|
||||
@@ -77,7 +77,6 @@ class ItemMutator(wx.Panel):
|
||||
|
||||
headingSizer.Add(displayName, 3, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
|
||||
range_low = wx.StaticText(self, wx.ID_ANY, ItemParams.FormatValue(*m.attribute.unit.TranslateValue(worse_range[0])))
|
||||
range_low.SetForegroundColour(self.goodColor if worse_range[2] else self.badColor)
|
||||
|
||||
@@ -168,4 +167,3 @@ class ItemMutator(wx.Panel):
|
||||
|
||||
# Send signal to GUI to update stats with current active fit
|
||||
wx.PostEvent(mainFrame, GE.FitChanged(fitID=activeFit))
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class PFGeneralPref(PreferenceView):
|
||||
self.sFit = Fit.getInstance()
|
||||
|
||||
self.cbGlobalChar.SetValue(self.sFit.serviceFittingOptions["useGlobalCharacter"])
|
||||
self.cbDefaultCharImplants.SetValue(self.sFit.serviceFittingOptions["useCharecterImplantsByDefault"])
|
||||
self.cbDefaultCharImplants.SetValue(self.sFit.serviceFittingOptions["useCharacterImplantsByDefault"])
|
||||
self.cbGlobalDmgPattern.SetValue(self.sFit.serviceFittingOptions["useGlobalDamagePattern"])
|
||||
self.cbFitColorSlots.SetValue(self.sFit.serviceFittingOptions["colorFitBySlot"] or False)
|
||||
self.cbRackSlots.SetValue(self.sFit.serviceFittingOptions["rackSlots"] or False)
|
||||
@@ -194,7 +194,7 @@ class PFGeneralPref(PreferenceView):
|
||||
event.Skip()
|
||||
|
||||
def OnCBDefaultCharImplantsStateChange(self, event):
|
||||
self.sFit.serviceFittingOptions["useCharecterImplantsByDefault"] = self.cbDefaultCharImplants.GetValue()
|
||||
self.sFit.serviceFittingOptions["useCharacterImplantsByDefault"] = self.cbDefaultCharImplants.GetValue()
|
||||
event.Skip()
|
||||
|
||||
def OnCBGlobalDmgPatternStateChange(self, event):
|
||||
|
||||
@@ -130,7 +130,7 @@ class PyGauge(wx.Window):
|
||||
return self._max_range
|
||||
|
||||
def Animate(self):
|
||||
#sFit = Fit.getInstance()
|
||||
# sFit = Fit.getInstance()
|
||||
if True:
|
||||
if not self._timer:
|
||||
self._timer = wx.Timer(self, self._timer_id)
|
||||
|
||||
@@ -238,8 +238,8 @@ class exportHtmlThread(threading.Thread):
|
||||
HTML += (
|
||||
' <li data-role="collapsible" data-iconpos="right" data-shadow="false" data-corners="false">\n'
|
||||
' <h2>' + group.groupName + ' <span class="ui-li-count">' + str(groupFits) + '</span></h2>\n'
|
||||
' <ul data-role="listview" data-shadow="false" data-inset="true" data-corners="false">\n'
|
||||
+ HTMLgroup +
|
||||
' <ul data-role="listview" data-shadow="false" data-inset="true" data-corners="false">\n' +
|
||||
HTMLgroup +
|
||||
' </ul>\n'
|
||||
' </li>'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user