我正在从Material UI转换到Material UI-Next。它们很好地一起玩,但是Material UI非常具有侵入性,并且我们必须在CSS中使用过多的def add_Matplotlib_Widgets(self):
"""Calling these instances creates another self.background in memory. Because the widget classes
restores their self-made background after the widget closes it interferes with the restoring of
our leftPanel self.background. In order to compesate for this problem, all background instances
should be equal to eachother. They are made equal in the update_All_Background_Instances(self)
function"""
"""Creating a widget that serves as the selector to draw a square on the plot"""
self.rectangleSelector = matplotlib.widgets.RectangleSelector(self.axes, self.onselect,
drawtype="box", useblit=True,
button=[3], interactive=False
)
def onselect(self, eclick, erelease):
self.tstart = time.time()
x1, y1 = eclick.xdata, eclick.ydata
x2, y2 = erelease.xdata, erelease.ydata
height = y2-y1
width = x2-x1
square = matplotlib.patches.Rectangle((x1,y1), width,
height, angle=0.0, edgecolor='red',
fill=False
#blit=True gives Unknown property blit
)
"""In order to keep the right background and not save any rectangle drawing animations
on the background, the RectangleSelector widget has to be closed first before saving
or restoring the background"""
wx.CallLater(0, lambda: self.tbd(square))
def tbd(self, square):
"""leftPanel background is restored"""
self.canvas.restore_region(self.background)
self.axes.add_patch(square)
self.axes.draw_artist(square)
self.canvas.blit(self.axes.bbox)
"""leftPanel background is updated"""
self.background = self.canvas.copy_from_bbox(self.axes.bbox)
"""Setting all backgrounds equal to the leftPanel self.background"""
self.update_All_Background_Instances()
print('Took '+ str(time.time()-self.tstart) + ' s')
def update_All_Background_Instances(self):
"""This function sets all of the background instance variables equal
to the lefPanel self.background instance variable"""
self.rectangleSelector.background = self.background
规则来覆盖其中包含的一些样式。我发现SvgIcon库强制颜色为黑色,正如你在文件中看到的那样
!important
如果我评论它,我的样式是有效的,因为颜色不限于使用它们的颜色属性。 我不想使用他们的语法来定义颜色。我正在使用mdi-material-icons,它使用来自MaterialUI的SvgIcon.js,而MaterialUI-Next的语法也不同,我也使用了主题。对我来说最好的方法是忽略SvgIcon库,同时在我的node_modules中保留materialui以用于仍然需要的其他依赖项。
P.S。我不能简单地在上面的代码中评论该颜色线,因为如果Material UI更新(我怀疑它因为它不再被维护而只是以防万一),它将还原注释块。另外,node_modules将被忽略并安装在每台开发人员计算机中。
所以...有没有人这样做过?将MaterialUI保留在node_modules中,但是卸载其中的特定库?此外,其他开发人员需要能够运行npm install --save或某些npm代码来更新其计算机中的此更改。
提前致谢