How to use findBitmap method in fMBT

Best Python code snippet using fMBT_python

ic_bmp.py

Source:ic_bmp.py Github

copy

Full Screen

...108 """109 if ImgName_ in ic.imglib.common.__dict__:110 return ic.imglib.common.__dict__[ImgName_]111 return None112def findBitmap(*img_filenames):113 """114 Поиск и создание объекта Bitmap по списку имен файлов картинок.115 @param img_filenames: Имена файлов, которые необходимо просмотреть.116 @return: Возвращает созданный объект Bitmap или117 None в случае если ни один из предложенных файлов не существует.118 """119 for img_filename in img_filenames:120 if os.path.exists(img_filename):121 return createBitmap(img_filename)...

Full Screen

Full Screen

tree.py

Source:tree.py Github

copy

Full Screen

...34 self.rootId = id + '-root'35 self.clear()36 # Load the tree icons.37 #images = wx.ImageList(16, 16)38 #images.Add(wx.Bitmap(paths.findBitmap('unchecked')))39 #images.Add(wx.Bitmap(paths.findBitmap('checked')))40 #images.Add(wx.Bitmap(paths.findBitmap('defcheck')))41 #if host.isWindows():42 # images.Add(wx.Bitmap(paths.findBitmap('closedfolder')))43 # images.Add(wx.Bitmap(paths.findBitmap('openfolder')))44 #self.getWxWidget().AssignImageList(images)45 ## @todo Should this be LEFT_UP?46 #wx.EVT_LEFT_DOWN(self.getWxWidget(), self.onItemClick)47 # Right-clicking in the tree must change the selection in48 # addition to displaying the context menu.49 #wx.EVT_RIGHT_DOWN(self.getWxWidget(), self.onRightClick)50 # We will not allow expanding totally empty categories.51 #wx.EVT_TREE_ITEM_EXPANDING(parent, wxId, self.onItemExpanding)52 wx.EVT_TREE_SEL_CHANGED(parent, wxId, self.onSelectionChanged)53 #self.grayColour = wx.Colour(192, 192, 192)54 # The root items.55 #self.removeAll()56 # Clear the list of item ancestors (addon name -> [parent items]).57 #self.itemAncestors = {}...

Full Screen

Full Screen

widgets.py

Source:widgets.py Github

copy

Full Screen

...85 if language.isDefined(identifier):86 imageName = language.translate(identifier)87 else:88 imageName = identifier89 fileName = paths.findBitmap(imageName)90 if len(fileName) == 0:91 # Fallback icon.92 fileName = paths.findBitmap('deng')93 bmp = wx.Bitmap(fileName)94 self.imageList.Add(bmp)95 self.bitmaps.append(identifier)96 return len(self.bitmaps) - 197 98 def getBitmapPath(self, identifier, scaledSize=None):99 """Locates a bitmap and scales it, if necessary.100 101 @param identifier Bitmap identifier.102 @param scaledSize Tuple (width, height). If specified, determines 103 the size of the image. If this does not match the104 size of the existing image on disk, a new image 105 file will be created.106 107 @return Path of the image file.108 """109 if scaledSize is None:110 return paths.findBitmap(identifier)111 112 # A scaled size has been specified.113 # Let's generate the scaled name of the bitmap.114 ident = 'scaled%ix%i-' % scaledSize + identifier115 # Try to locate an existing copy of the image.116 imagePath = paths.findBitmap(ident)117 118 if imagePath != '':119 return imagePath120 # We have to generate it. First try loading the original image.121 originalPath = paths.findBitmap(identifier)122 if originalPath == '':123 # No such image.124 return ''125 # Scale and save. PNG should work well with all source images.126 image = wx.Image(originalPath)127 originalSize = (image.GetWidth(), image.GetHeight())128 if originalSize[0] == scaledSize[0] and originalSize[1] == scaledSize[1]:129 # No need to scale.130 return originalPath131 if scaledSize[0] < originalSize[0] or scaledSize[1] < originalSize[1]:132 # Upscale first to cause some extra blurring.133 image.Rescale(originalSize[0]*2, originalSize[1]*2, wx.IMAGE_QUALITY_HIGH)134 image.Rescale(scaledSize[0], scaledSize[1], wx.IMAGE_QUALITY_HIGH)135 imagePath = os.path.join(paths.getUserPath(paths.GRAPHICS), ident + '.png')136 image.SaveFile(imagePath, wx.BITMAP_TYPE_PNG)137 138 return imagePath139class Line (sb.widget.base.Widget):140 """A static horizontal divider line."""141 def __init__(self, parent):142 """Construct a new divider line.143 @param parent The parent panel.144 """145 sb.widget.base.Widget.__init__(self, 146 wx.StaticLine(parent, -1, style=wx.LI_HORIZONTAL))147class Image (sb.widget.base.Widget):148 """A static image widget. The user will not be able to interact149 with instances of the Image widget."""150 def __init__(self, parent, imageName):151 """Construct a new Image widget.152 @param imageName Base name of the image file. It must be153 located in one of the graphics directories.154 """155 # Create a new panel so we can control the background color.156 self.panel = wx.Panel(parent, -1)157 self.panel.SetBackgroundColour(wx.WHITE)158 sb.widget.base.Widget.__init__(self, self.panel)159 # See if we can find the right image.160 bmp = wx.Image(paths.findBitmap(imageName)).ConvertToBitmap()161 self.bitmap = wx.StaticBitmap(self.panel, -1, bmp)162 self.panel.SetMinSize(bmp.GetSize())163 def setImage(self, imageName):164 """Change the image displayed in the widget.165 @param imageName Base name of the image file. It must be166 located in one of the graphics directories.167 """168 bmp = wx.Image(paths.findBitmap(imageName)).ConvertToBitmap()169 self.bitmap.Freeze()170 self.bitmap.SetBitmap(bmp)171 self.panel.SetMinSize(bmp.GetSize())172 self.bitmap.Thaw()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful