Changeset 72 in main for trunk/plugins
- Timestamp:
- 07/06/10 14:54:39 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/gedit/openplm.py
r71 r72 113 113 _("Check out"), lambda a: self.check_out_cb()), 114 114 ("checkin", None, _("Check-in"), None, 115 _("Check-in"), lambda a: self.check_in ()),115 _("Check-in"), lambda a: self.check_in_cb()), 116 116 ]) 117 117 self._action_group2.set_sensitive(False) … … 222 222 gdoc.set_data("openplm_path", path) 223 223 224 def check_in(self ):224 def check_in(self, unlock): 225 225 gdoc = self._window.get_active_document() 226 226 doc = gdoc.get_data("openplm_doc") … … 236 236 request = urllib2.Request(url, datagen, headers) 237 237 res = self.opener.open(request) 238 if not unlock: 239 self.get_data("api/object/%s/lock/%s/" % (doc["id"], doc_file_id)) 238 240 else: 239 241 # TODO 242 print 'can not check in' 240 243 pass 241 244 245 def check_in_cb(self): 246 gdoc = self._window.get_active_document() 247 doc = gdoc.get_data("openplm_doc") 248 name = os.path.basename(gdoc.get_data("openplm_path")) 249 diag = CheckInDialog(self._window, self, doc, name) 250 resp = diag.run() 251 if resp == gtk.RESPONSE_ACCEPT: 252 self.check_in(diag.get_unlocked()) 253 diag.destroy() 254 255 256 class CheckInDialog(gtk.Dialog): 257 258 def __init__(self, window, instance, doc, filename): 259 super(CheckInDialog, self).__init__(_("Check-in"), window, 260 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, 261 (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, 262 "Check-in", gtk.RESPONSE_ACCEPT)) 263 self.instance = instance 264 label = gtk.Label("%s|%s|%s"% (doc["reference"], doc["revision"], 265 doc["type"])) 266 self.vbox.pack_start(label) 267 label2 = gtk.Label(filename) 268 self.vbox.pack_start(label2) 269 self.unlock_button = gtk.CheckButton("Unlock ?") 270 self.vbox.pack_start(self.unlock_button) 271 self.vbox.show_all() 272 273 def get_unlocked(self): 274 return self.unlock_button.get_active() 275 276 242 277 class CheckOutDialog(gtk.Dialog): 243 278 244 279 def __init__(self, window, instance): 245 super(CheckOutDialog, self).__init__(_(" Login"), window,280 super(CheckOutDialog, self).__init__(_("Check-out"), window, 246 281 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, 247 282 (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
Note: See TracChangeset
for help on using the changeset viewer.