def __init__(self, *args, **kwargs): self.crosshairs = False self.magnifier = False wx.Panel.__init__(self, *args, **kwargs) self.sizer = wx.GridBagSizer(0, 0) crosshairsbitmap = icons.icon('crosshairs') self.crosshairsbitmap = wx.StaticBitmap(self, -1, crosshairsbitmap) self.crosshairsbitmap.SetToolTipString('Crosshairs') magnifierbitmap = icons.icon('zoom') self.magnifierbitmap = wx.StaticBitmap(self, -1, magnifierbitmap) self.magnifierbitmap.SetToolTipString('Magnifier') self.sizer.Add(self.crosshairsbitmap, (0, 0), (1, 1), wx.ALIGN_CENTER) self.sizer.Add(self.magnifierbitmap, (0, 1), (1, 1), wx.ALIGN_CENTER) self.sizer.AddGrowableCol(0) self.sizer.AddGrowableCol(1) self.SetSizer(self.sizer) self.sizer.Layout() self.crosshairsbitmap.Bind(wx.EVT_LEFT_UP, self.onCrosshairsBitmap) self.magnifierbitmap.Bind(wx.EVT_LEFT_UP, self.onMagnifierBitmap)
def create_actions_menubar(self): self.action_new_file = QtWidgets.QAction( self.centralwidget, triggered=self.create_new_calc) self.action_new_file.setIcon(icon('./icon/new_file.png')) self.action_new_file.setObjectName("action_new_file") self.action_new_file.setText( self._translate("MainWindow", "Новый расчет")) self.action_close_file = QtWidgets.QAction(self.centralwidget, triggered=self.close_calc) self.action_close_file.setIcon(icon('./icon/close_file.png')) self.action_close_file.setObjectName("action_close_file") self.action_close_file.setText( self._translate("MainWindow", "Закрыть расчет"))
def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) infobitmap = icons.icon('info') displaybitmap = icons.icon('display') self.infobitmap = wx.StaticBitmap(self, -1, infobitmap) self.displaybitmap = wx.StaticBitmap(self, -1, displaybitmap) self.sizescaler = tools.SizeScaler(self, -1) self.valuescalebitmap = tools.ValueScaleBitmap(self, -1) self.infobitmap.SetToolTipString('Info') self.displaybitmap.SetToolTipString('Display') self.infotool = tools.Information(self, -1) self.displaytool = tools.Display(self, -1) self.valuescaletool = tools.ValueScaler(self, -1) bitmapsizer = wx.GridBagSizer(0, 10) bitmapsizer.Add(self.infobitmap, (0, 0), (1, 1), wx.ALIGN_CENTER) bitmapsizer.Add(self.displaybitmap, (0, 1), (1, 1), wx.ALIGN_CENTER) self.sizer = wx.GridBagSizer(0, 5) self.sizer.SetEmptyCellSize((0, 0)) self.sizer.Add(bitmapsizer, (0, 0), (1, 1), wx.ALIGN_CENTER) self.sizer.Add(self.sizescaler, (0, 1), (1, 1), wx.ALIGN_CENTER) self.sizer.Add(self.valuescalebitmap, (0, 2), (1, 1), wx.ALIGN_CENTER) self.sizer.Add(wx.StaticLine(self, -1), (1, 0), (1, 3), wx.EXPAND) self.sizer.Add(self.infotool, (2, 0), (1, 3), wx.EXPAND) self.sizer.Add(wx.StaticLine(self, -1), (3, 0), (1, 3), wx.EXPAND) self.sizer.Add(self.displaytool, (4, 0), (1, 3), wx.EXPAND) self.sizer.Add(wx.StaticLine(self, -1), (5, 0), (1, 3), wx.EXPAND) self.sizer.Add(self.valuescaletool, (6, 0), (1, 3), wx.EXPAND) self.sizer.Add(wx.StaticLine(self, -1), (7, 0), (1, 3), wx.EXPAND) self.showTool(self.infotool, False) self.showTool(self.displaytool, False) self.showTool(self.valuescaletool, False) self.sizer.AddGrowableCol(0) self.sizer.AddGrowableCol(1) self.sizer.AddGrowableCol(2) self.SetSizer(self.sizer) self.SetAutoLayout(True)
def getTargetBitmap(self): bitmap = icons.icon('target') image = bitmap.ConvertToImage() r1, g1, b1 = 0, 0, 0 r2, g2, b2 = self.color.Red(), self.color.Green(), self.color.Blue() image.Replace(r1, g1, b1, r2, g2, b2) bitmap = image.ConvertToBitmap() return bitmap
def create_actions_toolbar(self): self.action_geometry = QtWidgets.QAction( self.centralwidget, triggered=self.create_geometry_interface) self.action_geometry.setEnabled(False) self.action_geometry.setCheckable(True) self.action_geometry.setIcon(icon('./icon/geometry.png')) self.action_geometry.setShortcut('Ctrl+G') self.action_geometry.setIconText('Геометрия Ctrl+G') self.action_calculation = QtWidgets.QAction( self.centralwidget, triggered=self.create_calculation_interface) self.action_calculation.setEnabled(False) self.action_calculation.setCheckable(True) self.action_calculation.setIcon(icon('./icon/shoot_2.png')) self.action_calculation.setShortcut('Ctrl+C') self.action_calculation.setIconText('Расчет Ctrl+C') self.action_postprocessing = QtWidgets.QAction( self.centralwidget, triggered=self.create_postprocessing_interface) self.action_postprocessing.setEnabled(False) self.action_postprocessing.setCheckable(True) self.action_postprocessing.setIcon(icon('./icon/plot.png')) self.action_postprocessing.setShortcut('Ctrl+P') self.action_postprocessing.setIconText('Постобработка Ctrl+P')
import sys from PyQt5 import QtWidgets from Interface.main_interface import MainWindow from icons import icon if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) window = MainWindow() window.setWindowTitle('Bang') window.setWindowIcon(icon('./icon/bang.png')) window.resize(1440, 942) window.show() sys.exit(app.exec_())