[Python-checkins] r64948 - in sandbox/trunk/ttk-gsoc/src/idlelib: configDialog.py tabbedpages.py tabbedpages_new.py tabbedpages_old.py
guilherme.polo
python-checkins at python.org
Mon Jul 14 16:36:24 CEST 2008
Author: guilherme.polo
Date: Mon Jul 14 16:36:24 2008
New Revision: 64948
Log:
Moved common exceptions used by the two versions of tabbedpages into the tabbedpages module; Added a function in the tabbedpages module that returns the available TabbedPageSet.
Modified:
sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py
sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py
sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py
sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py
Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py (original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py Mon Jul 14 16:36:24 2008
@@ -17,13 +17,14 @@
import tkMessageBox, tkColorChooser, tkFont
from stylist import PoorManStyle
-from tabbedpages import TabbedPageSet
+from tabbedpages import get_tabbedpage
from configHandler import idleConf
from keybindingDialog import GetKeysDialog
from dynOptionMenuWidget import DynOptionMenu
from configHelpSourceEdit import GetHelpSourceDialog
from configSectionNameDialog import GetCfgSectionNameDialog
+TabbedPageSet = get_tabbedpage()
TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int')
if TTK:
from ttk import Frame, Button, Checkbutton, LabelFrame, LabeledScale, \
Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py (original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py Mon Jul 14 16:36:24 2008
@@ -1,4 +1,12 @@
-try:
- from idlelib.tabbedpages_new import TabbedPageSet
-except ImportError:
- from idlelib.tabbedpages_old import TabbedPageSet
+# Exceptions used on both versions of tabbedpages
+class InvalidNameError(Exception): pass
+class AlreadyExistsError(Exception): pass
+
+def get_tabbedpage():
+ """Returns the TabbedPageSet available for use."""
+ try:
+ from idlelib.tabbedpages_new import TabbedPageSet
+ except ImportError:
+ from idlelib.tabbedpages_old import TabbedPageSet
+
+ return TabbedPageSet
Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py (original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py Mon Jul 14 16:36:24 2008
@@ -4,8 +4,7 @@
"""
from ttk import Frame, Notebook
-class InvalidNameError(Exception): pass
-class AlreadyExistsError(Exception): pass
+from tabbedpages import InvalidNameError, AlreadyExistsError
class FramePage(object):
def __init__(self, notebook):
Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py (original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py Mon Jul 14 16:36:24 2008
@@ -10,8 +10,7 @@
from Tkinter import Frame, Radiobutton
from Tkconstants import BOTH, TOP, X, RAISED, NSEW, FLAT, LEFT
-class InvalidNameError(Exception): pass
-class AlreadyExistsError(Exception): pass
+from tabbedpages import InvalidNameError, AlreadyExistsError
class TabSet(Frame):
More information about the Python-checkins
mailing list