| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
om> |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
from breezy import controldir, osutils |
| 21 |
|
| 22 |
from breezy.info import show_bzrdir_info |
| 23 |
|
| 24 |
from breezy.plugins.qbrz.lib.i18n import gettext |
| 25 |
from breezy.plugins.qbrz.lib.ui_info import Ui_InfoForm |
| 26 |
from breezy.plugins.qbrz.lib.util import ( |
| 27 |
BTN_CLOSE, |
| 28 |
QBzrWindow, |
| 29 |
url_for_display, |
| 30 |
) |
| 31 |
|
| 32 |
import io |
| 33 |
|
| 34 |
|
| 35 |
class QBzrInfoWindow(QBzrWindow): |
| 36 |
|
| 37 |
def __init__(self, location, parent=None): |
| 38 |
QBzrWindow.__init__(self, [gettext("Info")], parent) |
| 39 |
self.restoreSize("info", (580, 250)) |
| 40 |
self.buttonbox = self.create_button_box(BTN_CLOSE) |
| 41 |
self.ui = Ui_InfoForm() |
| 42 |
self.ui.setupUi(self.centralwidget) |
| 43 |
self.ui.verticalLayout.addWidget(self.buttonbox) |
| 44 |
self.refresh_view(location) |
| 45 |
self.ui.tabWidget.setCurrentIndex(0) |
| 46 |
|
| 47 |
def refresh_view(self, location): |
| 48 |
self._set_location(location) |
| 49 |
self.populate_unparsed_info(location) |
| 50 |
|
| 51 |
def _set_location(self, location): |
| 52 |
if not location: |
| 53 |
self.ui.local_location.setText('-') |
| 54 |
return |
| 55 |
if location != '.': |
| 56 |
self.ui.local_location.setText(url_for_display(location)) |
| 57 |
return |
| 58 |
self.ui.local_location.setText(osutils.abspath(location)) |
| 59 |
|
| 60 |
def populate_unparsed_info(self, location): |
| 61 |
basic = io.StringIO() |
| 62 |
detailed = io.StringIO() |
| 63 |
a_controldir = controldir.ControlDir.open_containing(location)[0] |
| 64 |
show_bzrdir_info(a_controldir, 0, basic) |
| 65 |
show_bzrdir_info(a_controldir, 2, detailed) |
| 66 |
self.ui.basic_info.setText(basic.getvalue()) |
| 67 |
self.ui.detailed_info.setText(detailed.getvalue()) |
| 68 |
basic.close() |
| 69 |
detailed.close() |