source: src/mlx/gui/bugreport.py@ 483:a1b49fbab4f0

Last change on this file since 483:a1b49fbab4f0 was 483:a1b49fbab4f0, checked in by István Váradi <ivaradi@…>, 11 years ago

Implemented the dialog window (re #190)

File size: 3.7 KB
Line 
1
2from common import *
3
4from mlx.i18n import xstr
5import mlx.const as const
6import mlx.config as config
7
8import os
9
10#------------------------------------------------------------------------------
11
12## @package mlx.gui.bugreport
13#
14# The bug report dialog
15#
16# This module implements the bug report dialog.
17
18#------------------------------------------------------------------------------
19
20class BugReportDialog(gtk.Dialog):
21 """The dialog to report a bug."""
22 def __init__(self, gui):
23 super(BugReportDialog, self).__init__(WINDOW_TITLE_BASE + " - " +
24 xstr("bugreport_title"),
25 gui.mainWindow,
26 DIALOG_MODAL)
27
28 self.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)
29 self._sendButton = self.add_button(xstr("button_send"), RESPONSETYPE_ACCEPT)
30 self._sendButton.set_can_default(True)
31 self._gui = gui
32
33 contentArea = self.get_content_area()
34
35 contentAlignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
36 xscale = 0.0, yscale = 0.0)
37 contentAlignment.set_padding(padding_top = 4, padding_bottom = 16,
38 padding_left = 8, padding_right = 8)
39
40 contentArea.pack_start(contentAlignment, False, False, 0)
41
42 contentVBox = gtk.VBox()
43 contentAlignment.add(contentVBox)
44
45 label = gtk.Label(xstr("bugreport_summary"))
46 label.set_use_underline(True)
47 label.set_alignment(0.0, 0.5)
48
49 contentVBox.pack_start(label, False, False, 4)
50
51 self._summary = summary = gtk.Entry()
52 summary.connect("changed", self._summaryChanged)
53 summary.set_tooltip_text(xstr("bugreport_summary_tooltip"))
54 summary.set_width_chars(80)
55 label.set_mnemonic_widget(summary)
56 contentVBox.pack_start(summary, True, True, 4)
57
58 label = gtk.Label(xstr("bugreport_description"))
59 label.set_use_underline(True)
60 label.set_alignment(0.0, 0.5)
61
62 contentVBox.pack_start(label, False, False, 4)
63
64 self._description = description = gtk.TextView()
65 description.set_tooltip_text(xstr("bugreport_description_tooltip"))
66 label.set_mnemonic_widget(description)
67
68 scrolledWindow = gtk.ScrolledWindow()
69 scrolledWindow.add(description)
70 scrolledWindow.set_size_request(-1, 200)
71 scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
72 scrolledWindow.set_shadow_type(SHADOW_IN)
73
74 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.0, xscale = 1.0, yscale = 1.0)
75 alignment.add(scrolledWindow)
76
77 contentVBox.pack_start(alignment, True, True, 4)
78
79 emailBox = gtk.HBox()
80 contentVBox.pack_start(emailBox, False, False, 4)
81
82 label = gtk.Label(xstr("bugreport_email"))
83 label.set_use_underline(True)
84 label.set_alignment(0.0, 0.5)
85
86 emailBox.pack_start(label, False, False, 0)
87
88 alignment = gtk.Alignment()
89 emailBox.pack_start(alignment, False, False, 8)
90
91 self._email = email = gtk.Entry()
92 email.set_tooltip_text(xstr("bugreport_email_tooltip"))
93 label.set_mnemonic_widget(email)
94 emailBox.pack_start(email, True, True, 0)
95
96
97 def run(self):
98 """Run the checklist editor dialog."""
99 self._updateButtons()
100 self._sendButton.grab_default()
101 self.show_all()
102 response = super(BugReportDialog, self).run()
103 self.hide()
104
105 def _summaryChanged(self, entry):
106 """Called when the summary has changed."""
107 self._updateButtons()
108
109 def _updateButtons(self):
110 """Update the sensitivity of the buttoms."""
111 self._sendButton.set_sensitive(self._summary.get_text()!="")
Note: See TracBrowser for help on using the repository browser.