Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
modulename = fname[:-3]
try:
importlib.import_module(modulename)
except Exception as e:
logger.exception(e)
msg = _("Failed to load custom widget module: \n'{0}'")
msg = msg.format(path)
messagebox.showerror(_('Error'), msg)
#Initialize images
DESIGNER_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGES_DIR = os.path.join(DESIGNER_DIR, "images")
StockImage.register_from_dir(IMAGES_DIR)
StockImage.register_from_dir(
os.path.join(IMAGES_DIR, 'widgets', '22x22'), '22x22-')
StockImage.register_from_dir(
os.path.join(IMAGES_DIR, 'widgets', '16x16'), '16x16-')
class StatusBarHandler(logging.Handler):
def __init__(self, tklabel, level=logging.NOTSET):
super(StatusBarHandler, self).__init__(level)
self.tklabel = tklabel
self._clear = True
self._cb_id = None
def emit(self, record):
try:
msg = self.format(record)
if not self._clear and self._cb_id is not None:
self.tklabel.after_cancel(self._cb_id)
self._clear = False
if dirname not in sys.path:
sys.path.append(dirname)
modulename = fname[:-3]
try:
importlib.import_module(modulename)
except Exception as e:
logger.exception(e)
msg = _("Failed to load custom widget module: \n'{0}'")
msg = msg.format(path)
messagebox.showerror(_('Error'), msg)
#Initialize images
DESIGNER_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGES_DIR = os.path.join(DESIGNER_DIR, "images")
StockImage.register_from_dir(IMAGES_DIR)
StockImage.register_from_dir(
os.path.join(IMAGES_DIR, 'widgets', '22x22'), '22x22-')
StockImage.register_from_dir(
os.path.join(IMAGES_DIR, 'widgets', '16x16'), '16x16-')
class StatusBarHandler(logging.Handler):
def __init__(self, tklabel, level=logging.NOTSET):
super(StatusBarHandler, self).__init__(level)
self.tklabel = tklabel
self._clear = True
self._cb_id = None
def emit(self, record):
try:
msg = self.format(record)
if not self._clear and self._cb_id is not None:
if fname.endswith('.py'):
if dirname not in sys.path:
sys.path.append(dirname)
modulename = fname[:-3]
try:
importlib.import_module(modulename)
except Exception as e:
logger.exception(e)
msg = _("Failed to load custom widget module: \n'{0}'")
msg = msg.format(path)
messagebox.showerror(_('Error'), msg)
#Initialize images
DESIGNER_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGES_DIR = os.path.join(DESIGNER_DIR, "images")
StockImage.register_from_dir(IMAGES_DIR)
StockImage.register_from_dir(
os.path.join(IMAGES_DIR, 'widgets', '22x22'), '22x22-')
StockImage.register_from_dir(
os.path.join(IMAGES_DIR, 'widgets', '16x16'), '16x16-')
class StatusBarHandler(logging.Handler):
def __init__(self, tklabel, level=logging.NOTSET):
super(StatusBarHandler, self).__init__(level)
self.tklabel = tklabel
self._clear = True
self._cb_id = None
def emit(self, record):
try:
msg = self.format(record)
try:
import tkinter as tk
import tkinter.ttk as ttk
except:
import Tkinter as tk
import ttk
from pygubu.stockimage import StockImage, StockImageException
from pygubu.widgets.scrollbarhelper import ScrollbarHelper
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGES_DIR = os.path.join(FILE_DIR, "..", "images", "widgets", "propertyeditor")
IMAGES_DIR = os.path.abspath(IMAGES_DIR)
StockImage.register_from_dir(IMAGES_DIR)
class PropertyEditor(ttk.Frame):
def __init__(self, master=None, **kw):
self._variable = tk.StringVar()
self._initvalue = None
self.value = ''
ttk.Frame.__init__(self, master, **kw)
self._create_ui()
def _create_ui(self):
pass
def _validate(self):
return True
import tkinter.ttk as ttk
import tkinter.font
except:
import Tkinter as tk
import ttk
import tkFont
tk.font = tkFont
from pygubu.stockimage import StockImage, StockImageException
from pygubudesigner.widgets.propertyeditor import *
RE_FONT = re.compile("(?P\{\w+(\w|\s)*\}|\w+)\s?(?P-?\d+)?\s?(?P\{\w+(\w|\s)*\}|\w+)?")
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGES_DIR = os.path.join(FILE_DIR, "..", "images", "widgets", "fontentry")
IMAGES_DIR = os.path.abspath(IMAGES_DIR)
StockImage.register_from_dir(IMAGES_DIR)
PREDEFINED_FONTS = [
'TkDefaultFont', 'TkTextFont', 'TkFixedFont',
'TkMenuFont', 'TkHeadingFont', 'TkCaptionFont',
'TkSmallCaptionFont', 'TkIconFont', 'TkTooltipFont']
WIN_FONTS = (
'system', 'ansi', 'device', 'systemfixed', 'ansifixed', 'oemfixed')
MAC_FONTS = (
'system','application','menu',
'systemSystemFont', 'systemEmphasizedSystemFont', 'systemSmallSystemFont',
'systemSmallEmphasizedSystemFont', 'systemApplicationFont',
'systemLabelFont', 'systemViewsFont', 'systemMenuTitleFont',
'systemMenuItemFont', 'systemMenuItemMarkFont', 'systemMenuItemCmdKeyFont',
'systemWindowTitleFont', 'systemPushButtonFont',
'systemUtilityWindowTitleFont', 'systemAlertHeaderFont',
'systemToolbarFont', 'systemMiniSystemFont', 'systemDetailSystemFont',