Edgewall Software
Modify

Opened 15 years ago

Closed 9 years ago

Last modified 9 years ago

#9162 closed enhancement (fixed)

More modularity for preferences

Reported by: anonymous Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.6
Component: general Version: 0.12dev
Severity: normal Keywords: preferences
Cc: Branch:
Release Notes:

Preference panels are modular and can be individually enabled and disabled.

API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Current PreferencesModule is extension point for IPreferencePanelProvider and still implements few IPreferencePanelProviders itself.

I think this should be divided in the way that all preference panels (even the built in ones) are separate Components. This way it is possible to disable some of the preference panels from the trac.ini components section.

Use case
In our project we do not need some of the views that built in panels offers. We can't disable General section even though we have a different implementation that works in our case and end up having similar fields twice in different panels.

Attachments (2)

prefs_panels_as_separate_modules.path (7.7 KB ) - added by Bartosz Szatkowski <bulislaw@…> 14 years ago.
Patch for moving preferences panel to separate modules
prefs_panels_as_separate_modules.patch (9.2 KB ) - added by Bartosz Szatkowski <bulislaw@…> 14 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 by Christian Boos, 15 years ago

Description: modified (diff)

Why not, yes.

But if you were able to build your own IPreferencePanelProviders, I'm sure you're also able to provide a patch for this feature.

comment:2 by Christian Boos, 15 years ago

Description: modified (diff)

in reply to:  1 comment:3 by steeni <niko.sten@…>, 15 years ago

Replying to cboos:

But if you were able to build your own IPreferencePanelProviders, I'm sure you're also able to provide a patch for this feature.

Good point :). I will do that when I have some time.

comment:4 by Christian Boos, 14 years ago

Milestone: next-minor-0.12.xunscheduled

PatchWelcome, until then it's unscheduled.

by Bartosz Szatkowski <bulislaw@…>, 14 years ago

Patch for moving preferences panel to separate modules

comment:5 by Bartosz Szatkowski <bulislaw@…>, 14 years ago

HI, iam working on my bs. project and needed similar behavior, so here's go the patch for modular preferences panel.

Its my first patch for Trac so please let me know what needs to be changed or what ever.

TESTS: Ran 1055 tests in 157.186s

comment:6 by Christian Boos, 14 years ago

Hello Bartosz,

The patch is a good start, however:

  • you seem to have mixed space/tabs inside, please fix that first
  • if you split in different panel provider, then I think it makes more sense to have a render_preference_panel method in each, doing only the part it needs to do, rather than an inherited render_preference_panel that still knows about all…

by Bartosz Szatkowski <bulislaw@…>, 14 years ago

comment:7 by Bartosz Szatkowski <bulislaw@…>, 14 years ago

Ok - fixed both

1) Sorry for that, i may use "stock" vim on my vm

2) You're right - ive refactored my patch further:

  • Added _name and _title - keeping panels name and tab title
  • get_preference_panels moved to base class (using _name and _title)
  • common part of render_preference_panel moved to base class
  • render_preference_panel in each panel know only about itself

Tests: all ok

comment:8 by Ryan J Ollos, 10 years ago

Milestone: unscheduled1.1.4
Owner: set to Ryan J Ollos
Status: newassigned

comment:9 by Ryan J Ollos, 10 years ago

Milestone: 1.1.41.1.5

Narrowing focus for 1.1.4.

comment:10 by Ryan J Ollos, 10 years ago

Keywords: prefs removed

comment:11 by Ryan J Ollos, 10 years ago

Release Notes: modified (diff)

comment:12 by Ryan J Ollos, 10 years ago

Removed duplicated logging statement on 1.0-stable in [13989], on trunk in [13990:13991].

comment:13 by Ryan J Ollos, 10 years ago

Proposed changes in log:rjollos.git:t9162-preferences-modularity. I haven't tested any use cases of preference pages with child panels (#11853). I'll look into testing the changes in #11870.

comment:14 by Ryan J Ollos, 10 years ago

Milestone: 1.1.51.1.6

Fixed some issue with child preference panel rendering in log:rjollos.git:t9162-preferences-modularity.2. I'll wait until the next milestone to commit the changes.

comment:15 by Jun Omae, 10 years ago

Functional tests still failing.

python trac/tests/functional/__init__.py 
..............................................................................................................................................................................F.......................................
======================================================================
FAIL: runTest (trac.prefs.tests.functional.RegressionTestTicket11515)
Test for regression of http://trac.edgewall.org/ticket/11515
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/run/shm/b6bed89f1c1d21161b83f909ba005d7ac3d1fe96/py27-sqlite/trac/prefs/tests/functional.py", line 207, in runTest
    tc.find('Your preferences have been saved')
  File "/run/shm/b6bed89f1c1d21161b83f909ba005d7ac3d1fe96/py27-sqlite/trac/tests/functional/better_twill.py", line 229, in better_find
    (to_unicode(e), filename))
TwillAssertionError: no match to 'Your preferences have been saved' at file:///run/shm/b6bed89f1c1d21161b83f909ba005d7ac3d1fe96/py27-sqlite/testenv/trac/log/RegressionTestTicket11515.html

----------------------------------------------------------------------
Ran 214 tests in 334.885s

FAILED (failures=1)
make: *** [functional-test] Error 1

comment:16 by Ryan J Ollos, 9 years ago

I didn't see the test failure because message catalogs were not compiled in my environment. I've added log messages to make it easier to notice the test being skipped.

Revised changes in log:rjollos.git:t9162-preferences-modularity.3.

comment:17 by Ryan J Ollos, 9 years ago

Resolution: fixed
Status: assignedclosed

Committed to trunk in [14097:14098].

comment:18 by Ryan J Ollos, 9 years ago

In [14100]: Allow xhr when all preference panels are disabled but PreferencesModule is enabled.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.