How to use bitmapPath method in fMBT

Best Python code snippet using fMBT_python

resourceutil.py

Source:resourceutil.py Github

copy

Full Screen

1from zoundry.appframework.global_services import getResourceRegistry2from zoundry.base.util.i18n import ZLocale3from zoundry.base.util.fileutil import getDirectoryListing4import os5import string67# -------------------------------------------------------------------------------------8# Gets the flag bitmap path for the given locale.9# -------------------------------------------------------------------------------------10def getFlagPathForLocale(localeStr):11 u"""getFlagPathForLocale(string) -> string12 Gets the flag bitmap path for the given locale.""" #$NON-NLS-1$1314 locale = ZLocale(localeStr)15 bitmapPath = None16 if locale.hasCountryCode():17 bitmapPath = getResourceRegistry().getImagePath(u"images/common/flags/%s.png" % string.lower(locale.getCountryCode())) #$NON-NLS-1$18 if bitmapPath is None or not os.path.isfile(bitmapPath):19 bitmapPath = getResourceRegistry().getImagePath(u"images/common/flags/%s.png" % locale.getLanguageCode()) #$NON-NLS-1$20 if bitmapPath is None or not os.path.isfile(bitmapPath):21 bitmapPath = None22 return bitmapPath23# end getFlagPathForLocale()242526# -------------------------------------------------------------------------------------27# Gets the flag bitmap for the given locale.28# -------------------------------------------------------------------------------------29def getFlagBitmapForLocale(locale):30 u"""getFlagBitmapForLocale(string|ZLocale) -> wx.Bitmap31 Gets the flag bitmap for the given ZLocale or locale string.""" #$NON-NLS-1$3233 if not isinstance(locale, ZLocale):34 locale = ZLocale(locale)35 bitmap = None36 if locale.hasCountryCode():37 bitmap = getResourceRegistry().getBitmap(u"images/common/flags/%s.png" % string.lower(locale.getCountryCode())) #$NON-NLS-1$38 if bitmap is None:39 bitmap = getResourceRegistry().getBitmap(u"images/common/flags/%s.png" % locale.getLanguageCode()) #$NON-NLS-1$40 return bitmap41# end getFlagBitmapForLocale()424344# -------------------------------------------------------------------------------------45# Gets an empty bitmap.46# -------------------------------------------------------------------------------------47def getEmptyFlagBitmap():48 return getResourceRegistry().getBitmap(u"images/common/flags/empty.png") #$NON-NLS-1$49# end getEmptyFlagBitmap()505152# -------------------------------------------------------------------------------------53# Gets all of the flag bitmaps: returns a list of (langCode, bitmap) tuples54# -------------------------------------------------------------------------------------55def getAllFlagBitmaps():56 u"returns a list of (countryCode, bitmap) tuples" #$NON-NLS-1$57 rval = []58 flagPath = getResourceRegistry().getResourcePath(u"images/common/flags", True) #$NON-NLS-1$59 for filePath in getDirectoryListing(flagPath):60 baseFileName = os.path.basename(filePath)61 countryCode = os.path.splitext(baseFileName)[0]62 bitmap = getResourceRegistry().getBitmap(u"images/common/flags/%s" % baseFileName) #$NON-NLS-1$63 if countryCode and bitmap is not None and len(countryCode) == 2:64 rval.append( (countryCode, bitmap) )65 return rval ...

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