détails dans le gtk

This commit is contained in:
fpeters 2004-01-04 19:11:50 +00:00
parent 0da3d1a35f
commit 3489a0c75e
8 changed files with 49 additions and 28 deletions

View File

@ -69,10 +69,11 @@ from glasnost.common.cache import cache
import glasnost.gtk.MainWindow
import glasnost.gtk.LoginBox
try:
import gtkexcepthook
except ImportError:
pass
if not '-d' in sys.argv:
try:
import gtkexcepthook
except ImportError:
pass
class Application(applications.Application):

View File

@ -97,6 +97,7 @@ class GnomeMainWindow:
self.objectLabel.set_text('')
self.frameObject = xmlGlade.get_widget('frame-object')
self.sclWinObject = xmlGlade.get_widget('sclwin-object')
self.objectTable = None
paned = xmlGlade.get_widget('hpaned-content')
@ -152,7 +153,8 @@ class GnomeMainWindow:
self.objectTable.destroy()
self.objectTable = object.getViewTable()
self.objectTable.show_all()
self.frameObject.add(self.objectTable)
#self.frameObject.add(self.objectTable)
self.sclWinObject.add_with_viewport(self.objectTable)
class MainWindow(gtk.Window):

View File

@ -71,16 +71,6 @@ class ObjectGtkMixin(things.ThingMixin):
def getListValues(self):
return [self.id, self.getLabel()]
def getViewTable(self):
slotNames = self.getViewLayoutSlotNames(self)
table = gtk.Table(len(slotNames), 2, gtk.FALSE)
for slotName, i in zip(slotNames, range(len(slotNames))):
slot = self.getSlot(slotName)
widget = slot.getWidget()
table.attach(widget.getWidgetLabel(slot), 0, 1, i, i+1)
table.attach(widget.getWidgetView(slot), 1, 2, i, i+1)
return table
class GtkMixin(things.ThingMixin):
thingCategory = 'gtk'

View File

@ -317,7 +317,18 @@
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<placeholder/>
<widget class="GtkScrolledWindow" id="sclwin-object">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<placeholder/>
</child>
</widget>
</child>
<child>

View File

@ -50,6 +50,7 @@ import glasnost.common.things as commonThings
import glasnost.proxy.things as proxyThings
from tools import *
class ThingClasses(commonThings.ThingClasses):
def loadObjectModule(self, serverRoleDotobjectName):
@ -151,5 +152,16 @@ class ThingMixin:
return slotNames
def getViewTable(self):
slotNames = self.getViewLayoutSlotNames(self)
table = gtk.Table(len(slotNames), 2, gtk.FALSE)
for slotName, i in zip(slotNames, range(len(slotNames))):
slot = self.getSlot(slotName)
widget = slot.getWidget()
table.attach(widget.getWidgetLabel(slot), 0, 1, i, i+1)
table.attach(widget.getWidgetView(slot), 1, 2, i, i+1)
return table
class BaseThing(ThingMixin, proxyThings.BaseThing):
pass

View File

@ -39,14 +39,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import glasnost.common.context as context
import glasnost.common.faults as faults
import glasnost.common.tools_new as commonTools
from glasnost.proxy.tools import *
from glasnost.gtk.things import *
import pygtk
pygtk.require('2.0')
import gtk
@ -71,6 +63,15 @@ import locale
import os
import imp
import glasnost.common.context as context
import glasnost.common.faults as faults
import glasnost.common.tools_new as commonTools
from glasnost.proxy.tools import *
from glasnost.gtk.things import *
_cachedGtksByServerRole = {}
def getGtk(id):

View File

@ -69,6 +69,7 @@ class WidgetMixin(things.ThingMixin):
value = slot.getValue()
if type(value) is not type(''):
value = repr(value)
value = utf8(value)
return gtk.Label(value)
def getWidgetEdit(self, slot):
@ -283,6 +284,10 @@ class Multi(WidgetMixin, proxyWidgets.Multi):
return self.actual_content
register(Multi)
class MultiCheck(WidgetMixin, proxyWidgets.MultiCheck):
pass
register(MultiCheck)
class Path(WidgetMixin, proxyWidgets.Path):
pass

View File

@ -899,9 +899,8 @@ class ObjectsProxy(ObjectsCommonMixin, AdministrableProxyMixin, Proxy):
'deleteObject',
[commonTools.extractServerId(objectId), getApplicationToken(),
userToken, objectId])
def getIdsAllowedToDeleteObject(self, objectId):
userToken = context.getVar('userToken', default = '')
return callServer(
commonTools.extractServerId(objectId),
@ -910,7 +909,6 @@ class ObjectsProxy(ObjectsCommonMixin, AdministrableProxyMixin, Proxy):
userToken, objectId])
def getIdsAllowedToModifyObject(self, objectId):
userToken = context.getVar('userToken', default = '')
return callServer(
commonTools.extractServerId(objectId),
@ -1311,7 +1309,8 @@ class ObjectsProxy(ObjectsCommonMixin, AdministrableProxyMixin, Proxy):
return ''
label, language = self.getObjectLabelAndLanguage(objectId)
if destinationLanguages[0] == context.getVar('readLanguages')[0] and \
language == 'en' and hasattr(_.im_self, '_catalog') and \
language == 'en' and hasattr(_, 'im_self') and \
hasattr(_.im_self, '_catalog') and \
_.im_self._catalog.has_key(label):
return _(label)
translationsProxy = getProxyForServerRole('translations')