def __init__(self,
                 title=_('Bug Report'),
                 summary=None,
                 description=None,
                 category=None,
                 crashreport=False,
                 description_dialog=None,
                 reuse_mainloop=True):
        HIGDialog.__init__(self,
                           title=title,
                           buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                                    gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))

        # If reuse_mainloop is true, then dialogs created inside this dialog
        # will not start another mainloop.
        self._reuse_mainloop = reuse_mainloop

        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.crashreport = crashreport
        self.description_dialog = description_dialog
        self._create_widgets()
        self._set_category_list()
        self._pack_widgets()
        self._connect_widgets()
        self.summary = summary or ''
        self.description_report = description
        if self.crashreport:
            self.description = _("CrashReport automatically created")
        else:
            if self.description_dialog is None:
                self.description = description or ''
            else:
                self.description = description_dialog or ''
        self.category = category or ''
 def _on_activated(self,widget,row,col):
     """"""
     self.install_btn.set_sensitive(True)
     #choice
     selection = self.treeview.get_selection()
     (model,iter) = selection.get_selected()
     if iter == None:
         return
     else:
         cur_version = self.store.get_value(iter,1)
         #fill self.current_record
         rs = g_db_helper.select("select * from updates where version = '%s'" % cur_version)
         if len(rs) != 1:
             g_logger.error("Record is ERROR in DB!!!! The window will be closed!!!")
             self.destroy()
         self.current_record = {}
         
         self.current_record["version"] = rs[0][0]
         self.current_record["news_date"] = rs[0][1]
         self.current_record["software_name"] = rs[0][2]
         self.current_record["description"] = rs[0][3]
         self.current_record["download_url"] = rs[0][4] 
         self.current_record["is_update"] = rs[0][5]
         self.current_record["check_code"] = rs[0][6]            
           
         
         self.statusbar.push(0,_("You have selected the %s version" % \
                             self.current_record["version"])) 
        
         self.details_textview.set_buffer(self._set_details_content(_(self.current_record["description"] + "\n" + 
                                     "download:"+self.current_record["download_url"] + "\n" +
                                     "Designed by Umit!" 
                                     ))) 
         self.details_textview.show_all()
         g_logger.debug("Selected the item %s" % (self.current_record))              
示例#3
0
 def _alter_network_informaiton(self,failure):
     failure_info_first = None
     failure_info_second = None
     
     if 'error.NoRouteError' in str(failure):
         failure_info_first  = 'Disconnect to Internet'
         failure_info_second = 'Please check your network card connection!'
     elif 'TimeoutError' in str(failure):
         failure_info_first = 'Cloud Aggregator Server Connect Error'
         failure_info_second = 'Please check your cloud aggregator URL'         
     elif 'Agent matching query does not exist' in str(failure) :# or\
                        # '500 Internal Server Error' in str(failure) or\
                        # '500 INTERNAL SERVER ERROR' in str(failure):
         failure_info_first = _('Username/Password Error')
         failure_info_second = _('Please check your username or password')
         #clear username and password (there maybe some bugs here)
         theApp.peer_info.clear_db()
     else: 
         print str(failure)
         pass
     
     if failure_info_first == None and failure_info_second == None:
         return
     else:
         self._alter_show(primary_text = failure_info_first,secondary_text =failure_info_second)    
 def __create_widgets(self):
     self.hbox1 = HIGHBox()
     self.hbox2 = HIGHBox()
     self.subbox = Tests()
     self.hbox1.add(self.subbox)
     self.checkbtn = gtk.CheckButton(_("Update tests module automatically"))
     self.checkbtn_throttled = gtk.CheckButton(_("Load HTTP Throttled Test"))
    def __init__(self, title=_('Bug Report'), summary=None, description=None,
                 category=None, crashreport=False, description_dialog=None,
                 reuse_mainloop=True):
        HIGDialog.__init__(self, title=title,
            buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))

        # If reuse_mainloop is true, then dialogs created inside this dialog
        # will not start another mainloop.
        self._reuse_mainloop = reuse_mainloop

        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.crashreport = crashreport
        self.description_dialog = description_dialog
        self._create_widgets()
        self._set_category_list()
        self._pack_widgets()
        self._connect_widgets()
        self.summary = summary or ''
        self.description_report = description
        if self.crashreport:
            self.description = _("CrashReport automatically created")
        else:
            if self.description_dialog is None:
                self.description = description or ''
            else:
                self.description = description_dialog or ''
        self.category = category or ''
 def _alter_network_informaiton(self,failure):
     failure_info_first = None
     failure_info_second = None
     
     if 'error.NoRouteError' in str(failure):
         failure_info_first  = 'Disconnect to Internet'
         failure_info_second = 'Please check your network card connection!'
     elif 'TimeoutError' in str(failure):
         failure_info_first = 'Cloud Aggregator Server Connect Error'
         failure_info_second = 'Please check your cloud aggregator URL'         
     elif 'Agent matching query does not exist' in str(failure) :# or\
                        # '500 Internal Server Error' in str(failure) or\
                        # '500 INTERNAL SERVER ERROR' in str(failure):
         failure_info_first = _('Username/Password Error')
         failure_info_second = _('Please check your username or password')
         #clear username and password (there maybe some bugs here)
         theApp.peer_info.clear_db()
     else: 
         print str(failure)
         pass
     
     if failure_info_first == None and failure_info_second == None:
         return
     else:
         self._alter_show(primary_text = failure_info_first,secondary_text =failure_info_second)    
 def show_failed(self, result):
     """
     """
     alert = HIGAlertDialog(message_format=_("Error."),
                            secondary_text=_("Send to aggregaetor failed."))
     alert.run()
     alert.destroy()
 def show_failed(self,result):
     """
     """
     alert = HIGAlertDialog(message_format=_("Error."),
                                secondary_text=_("Send to aggregaetor failed."))
     alert.run()
     alert.destroy()
    def finish_get_events(self, message):
        if message is None:
            self.statusbar.push(0, _("No new Events from Aggregator!"))
            return

        self.statusbar.push(
            0, _("Get %d Events from Aggregator" % (len(message.events))))
示例#10
0
 def __create_widgets(self):
     self.hbox1 = HIGHBox()
     self.hbox2 = HIGHBox()
     self.subbox = Tests()
     self.hbox1.add(self.subbox)
     self.checkbtn = gtk.CheckButton(_("Update tests module automatically"))
     self.checkbtn_throttled = gtk.CheckButton(
         _("Load HTTP Throttled Test"))
    def descr_by_graphmode(self):
        """
        Returns a description with graph meaning.
        """
        graph_descr = [
            _("end of a week"), _("end of 12 hours period"),
            _("end of half hour period"), _("end of a minute")
            ]

        return _("Each point break represents ") + \
               graph_descr[view_mode_order.index(self.graph_mode)]
 def send_website_suggestion(self):
     website_url = self.website_url_entry.get_text()
     if website_url == '':
         alert = HIGAlertDialog(message_format=_("Missing fields."),
                                secondary_text=_("Please input all fields "
                                                 "for website suggestion."))
         alert.run()
         alert.destroy()
         return
     d = theApp.aggregator.send_website_suggestion(website_url)
     d.addCallback(self.show_success)
     d.addErrback(self.show_failed)
 def send_website_suggestion(self):
     website_url = self.website_url_entry.get_text()
     if website_url == '':
         alert = HIGAlertDialog(message_format=_("Missing fields."),
                                secondary_text=_("Please input all fields "
                                                 "for website suggestion."))
         alert.run()
         alert.destroy()
         return
     d = theApp.aggregator.send_website_suggestion(website_url)
     d.addCallback(self.show_success)
     d.addErrback(self.show_failed)
 def show_success(self, result):
     """
     """
     if result is not None:
         alert = HIGAlertDialog(message_format=_("Succuss."),
                                secondary_text=_("Send to aggregaetor successfully."))
         alert.run()
         alert.destroy()
     else:
         alert = HIGAlertDialog(message_format=_("Error."),
                                secondary_text=_("Send to aggregaetor failed."))
         alert.run()
         alert.destroy()
示例#15
0
def show_report(reuse_mainloop, bug_page):
    if not bug_page:
        return
    try:
        webbrowser.open(bug_page)
    except: # XXX What exceptions should be caught here ?
        page_dialog = HIGAlertDialog(type=gtk.MESSAGE_ERROR,
                message_format=_("Could not open default Web Browser"),
                secondary_text=_("Open Monitor was unable to open your default "
                    "web browser to show the bug tracker page with the "
                    "report status. Try visiting Open Monitor's bug tracker "
                    "page to see if your bug was reported."))
        run_dialog(reuse_mainloop, page_dialog)
    def descr_by_graphmode(self):
        """
        Returns a description with graph meaning.
        """
        graph_descr = [
            _("end of a week"),
            _("end of 12 hours period"),
            _("end of half hour period"),
            _("end of a minute")
        ]

        return _("Each point break represents ") + \
               graph_descr[view_mode_order.index(self.graph_mode)]
    def __create_widgets(self):

        #box
        self.all_box = HIGVBox()
        self.input_box = HIGHBox()
        self.buttom_box = HIGHBox()
        self.check_btn_box = gtk.HButtonBox()

        #Add input
        self.title_text = HIGLabel(_("Locations"))
        self.longitude_text = HIGLabel(_("longitude:"))
        self.longitude_entry = HIGTextEntry()
        self.latitude_text = HIGLabel(_("latitude:"))
        self.latitude_entry = HIGTextEntry()

        #Add buttons
        self.get_event_btn = gtk.Button(_("Get Events"))
        self.refresh_btn = gtk.Button(_("Refresh"))

        #status bar
        self.statusbar = gtk.Statusbar()
        self.statusbar.push(0, 'Events in Database')

        self.listmodel = gtk.ListStore(str, str, str, str, str)

        # create the TreeView
        self.treeview = gtk.TreeView()

        # create the TreeViewColumns to display the data
        self.tvcolumn = [None] * len(self.column_names)
        cellpb = gtk.CellRendererText()

        self.tvcolumn[0] = gtk.TreeViewColumn(self.column_names[0], cellpb)
        self.tvcolumn[0].add_attribute(cellpb, 'text', 0)
        #cell = gtk.CellRendererText()
        #self.tvcolumn[0].set_cell_data_func(cell, self.test_type)
        self.treeview.append_column(self.tvcolumn[0])

        for n in range(1, len(self.column_names)):
            cell = gtk.CellRendererText()
            self.tvcolumn[n] = gtk.TreeViewColumn(self.column_names[n], cell)
            self.tvcolumn[n].add_attribute(cell, 'text', n)
            if n == 1:
                cell.set_property('xalign', 1.0)
            #self.tvcolumn[n].set_cell_data_func(cell, cell_data_funcs[n])
            self.treeview.append_column(self.tvcolumn[n])

        #self.treeview.connect('row-activated', self.open_file)
        self.scrolledwindow = gtk.ScrolledWindow()
        self.scrolledwindow.add(self.treeview)
        self.treeview.set_model(self.listmodel)
    def __create_widgets(self):
        
        #box
        self.all_box = HIGVBox()
        self.input_box = HIGHBox()
        self.buttom_box = HIGHBox()
        self.check_btn_box = gtk.HButtonBox()
        
        #Add input
        self.title_text = HIGLabel(_("Locations"))
        self.longitude_text = HIGLabel(_("longitude:"))
        self.longitude_entry = HIGTextEntry()
        self.latitude_text = HIGLabel(_("latitude:"))
        self.latitude_entry = HIGTextEntry()         
        
        #Add buttons
        self.get_event_btn = gtk.Button(_("Get Events"))
        self.refresh_btn = gtk.Button(_("Refresh"))
          
        #status bar
        self.statusbar = gtk.Statusbar()
        self.statusbar.push(0,'Events in Database')        
                                
        self.listmodel = gtk.ListStore(str, str, str, str, str)

        # create the TreeView
        self.treeview = gtk.TreeView()

        # create the TreeViewColumns to display the data
        self.tvcolumn = [None] * len(self.column_names)
        cellpb = gtk.CellRendererText()

        self.tvcolumn[0] = gtk.TreeViewColumn(self.column_names[0], cellpb)
        self.tvcolumn[0].add_attribute(cellpb, 'text', 0)
        #cell = gtk.CellRendererText()
        #self.tvcolumn[0].set_cell_data_func(cell, self.test_type)
        self.treeview.append_column(self.tvcolumn[0])

        for n in range(1, len(self.column_names)):
            cell = gtk.CellRendererText()
            self.tvcolumn[n] = gtk.TreeViewColumn(self.column_names[n], cell)
            self.tvcolumn[n].add_attribute(cell, 'text', n)
            if n == 1:
                cell.set_property('xalign', 1.0)
            #self.tvcolumn[n].set_cell_data_func(cell, cell_data_funcs[n])
            self.treeview.append_column(self.tvcolumn[n])

        #self.treeview.connect('row-activated', self.open_file)
        self.scrolledwindow = gtk.ScrolledWindow()
        self.scrolledwindow.add(self.treeview)
        self.treeview.set_model(self.listmodel)
    def __create_widgets(self):
        """"""

        self.update_switch_hbox = HIGHBox()
        self.update_settings_hbox = HIGHBox()
        self.update_db_hbox = HIGHBox()

        self.update_switch_section = HIGSectionLabel(_("Update News Detect"))
        self.update_switch_table = HIGTable()
        self.update_settings_section = HIGSectionLabel(_("Update Settings"))
        self.update_settings_table = HIGTable()
        self.update_db_section = HIGSectionLabel(_("Update Database"))
        self.update_db_table = HIGTable()

        self.update_check = gtk.CheckButton(_("Automatically update"))
        self.update_switch_check = gtk.CheckButton(
            _("Software Update Detect Switch"))
        self.update_times_label = HIGEntryLabel(_("Auto detect update news"))
        self.update_method_label = HIGEntryLabel(_("Update method"))

        self.update_time_store = gtk.ListStore(str)
        self.update_time_entry = gtk.ComboBoxEntry(self.update_time_store, 0)
        self.update_method_store = gtk.ListStore(str)
        self.update_method_entry = gtk.ComboBoxEntry(self.update_method_store,
                                                     0)

        self.update_db_label = HIGEntryLabel()
        self.update_db_clear_button = gtk.Button(_("Clear Update Information"))
    def __create_widgets(self):
        """"""
        
        self.update_switch_hbox = HIGHBox()
        self.update_settings_hbox = HIGHBox()
        self.update_db_hbox = HIGHBox()

        self.update_switch_section = HIGSectionLabel(_("Update News Detect"))        
        self.update_switch_table = HIGTable()
        self.update_settings_section = HIGSectionLabel(_("Update Settings"))        
        self.update_settings_table = HIGTable()  
        self.update_db_section = HIGSectionLabel(_("Update Database"))        
        self.update_db_table = HIGTable()
        
        self.update_check = gtk.CheckButton(_("Automatically update"))
        self.update_switch_check = gtk.CheckButton(_("Software Update Detect Switch"))
        self.update_times_label = HIGEntryLabel(_("Auto detect update news"))
        self.update_method_label = HIGEntryLabel(_("Update method"))       
        
        self.update_time_store = gtk.ListStore(str)
        self.update_time_entry = gtk.ComboBoxEntry(self.update_time_store, 0)
        self.update_method_store = gtk.ListStore(str)
        self.update_method_entry = gtk.ComboBoxEntry(self.update_method_store, 0)  
        
        self.update_db_label =  HIGEntryLabel()
        self.update_db_clear_button = gtk.Button(_("Clear Update Information")) 
 def __create_widgets(self):
     
     
     self.general_hbox = HIGHBox()    
     self.version_hbox = HIGHBox()
     
     ################
     #Version Section
     self.version_section = HIGSectionLabel(_("Version"))
     self.version_table = HIGTable()
     self.version_label  = HIGEntryLabel(_("Software Version:"))
     self.version2_label = HIGEntryLabel()
     self.testver_label  = HIGEntryLabel(_("Service Test Version:"))
     self.testver2_label = HIGEntryLabel()
     self.attribute_label = HIGEntryLabel(_("Agent Attribute:"))
     self.attribute2_label = HIGEntryLabel()
         
     ################
     #General Section
     self.general_section = HIGSectionLabel(_("General"))
     self.general_table = HIGTable()
             
     self.startup_check = gtk.CheckButton(_("Startup OpenMonitor on system startup"))
     self.notification_check = gtk.CheckButton(_("Show Desktop Notifications"))
     self.login_ckeck = gtk.CheckButton(_("Enable Auto login"))        
示例#22
0
    def __create_widgets(self):

        self.general_hbox = HIGHBox()
        self.version_hbox = HIGHBox()

        ################
        #Version Section
        self.version_section = HIGSectionLabel(_("Version"))
        self.version_table = HIGTable()
        self.version_label = HIGEntryLabel(_("Software Version:"))
        self.version2_label = HIGEntryLabel()
        self.testver_label = HIGEntryLabel(_("Service Test Version:"))
        self.testver2_label = HIGEntryLabel()
        self.attribute_label = HIGEntryLabel(_("Agent Attribute:"))
        self.attribute2_label = HIGEntryLabel()

        ################
        #General Section
        self.general_section = HIGSectionLabel(_("General"))
        self.general_table = HIGTable()

        self.startup_check = gtk.CheckButton(
            _("Startup OpenMonitor on system startup"))
        self.notification_check = gtk.CheckButton(
            _("Show Desktop Notifications"))
        self.login_ckeck = gtk.CheckButton(_("Enable Auto login"))
    def graph_kind_ui(self):
        """
        Graph kind: Line and Area
        """
        modes = _("Line Graph"), _("Area Graph")
        self.combo_graph_kind = gtk.combo_box_new_text()
        self.combo_graph_kind.append_text(_("Select a graph style"))
        
        for mode in modes:
            self.combo_graph_kind.append_text(mode)

        self.combo_graph_kind.set_active(1)
        self.combo_graph_kind.connect('changed',self.change_graph_kind)
        
        return self.packed(self.combo_graph_kind)
示例#24
0
    def graph_kind_ui(self):
        """
        Graph kind: Line and Area
        """
        modes = _("Line Graph"), _("Area Graph")
        self.combo_graph_kind = gtk.combo_box_new_text()
        self.combo_graph_kind.append_text(_("Select a graph style"))

        for mode in modes:
            self.combo_graph_kind.append_text(mode)

        self.combo_graph_kind.set_active(1)
        self.combo_graph_kind.connect('changed', self.change_graph_kind)

        return self.packed(self.combo_graph_kind)
 def show_success(self, result):
     """
     """
     if result is not None:
         alert = HIGAlertDialog(
             message_format=_("Succuss."),
             secondary_text=_("Send to aggregaetor successfully."))
         alert.run()
         alert.destroy()
     else:
         alert = HIGAlertDialog(
             message_format=_("Error."),
             secondary_text=_("Send to aggregaetor failed."))
         alert.run()
         alert.destroy()
 def send_service_suggestion(self):
     service_name = self.service_name_entry.child.get_text()
     host_name = self.service_host_entry.get_text()
     ip = self.service_ip_entry.get_text()
     port = int(self.service_port_entry.get_text())
     if service_name == '' or host_name == '' or ip == '' or port == "":
         alert = HIGAlertDialog(message_format=_("Missing fields."),
                                secondary_text=_("Please input all fields "\
                                                 "for service suggestion."))
         alert.run()
         alert.destroy()
         return
     d = theApp.aggregator.send_service_suggestion(service_name, host_name, ip,port)
     d.addCallback(self.show_success)
     d.addErrback(self.show_failed)
示例#27
0
    def _create_widgets(self):
        
        self.bug_text = gtk.Label(_("Bug report details that "
                                  "will be send!"))
        
        self.description_scrolled = gtk.ScrolledWindow()
        self.description_text = gtk.TextView()

        # Fill the text entry
        description =  _("Reporter: %s\nSummary: %s\nCategory: %s\n"
                         "Comments: %s\n\nDescription: %s" % 
                         (self._reporter, self._summary, self._category,
                          self._comments, self._description))
        self.description_text.get_buffer().set_text(description.replace("[[BR]]", "\n"))
        self.description_text.set_editable(False)
def show_report(reuse_mainloop, bug_page):
    if not bug_page:
        return
    try:
        webbrowser.open(bug_page)
    except:  # XXX What exceptions should be caught here ?
        page_dialog = HIGAlertDialog(
            type=gtk.MESSAGE_ERROR,
            message_format=_("Could not open default Web Browser"),
            secondary_text=_(
                "Open Monitor was unable to open your default "
                "web browser to show the bug tracker page with the "
                "report status. Try visiting Open Monitor's bug tracker "
                "page to see if your bug was reported."))
        run_dialog(reuse_mainloop, page_dialog)
示例#29
0
    def __create_widgets(self):
        """
        """
        cur_mode = view_mode_descr[self.timeline_base.graph_mode]
        self.select_label = gtk.Label(cur_mode)

        values = self.timeline_base.bounds_by_graphmode()

        self.date_select = gtk.SpinButton(
            gtk.Adjustment(value=values[2],
                           lower=values[0],
                           upper=values[1],
                           step_incr=1), 1)

        ###############
        #Refresh Button

        self.tooltips = gtk.Tooltips()

        self.refresh_button = gtk.Button()
        self.refresh_button.set_border_width(3)

        self.refresh_button.set_relief(gtk.RELIEF_NONE)

        self.tooltips.set_tip(self.refresh_button, _("Graph Refresh"))

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_BUTTON)
        box = gtk.HBox()
        box.pack_start(img, False, False, 0)
        self.refresh_button.add(box)
    def _create_widgets(self):
        self.username_label = HIGLabel(_("Username"))
        self.username_entry = gtk.Entry()

        self.password_label = HIGLabel(_("Password"))
        self.password_entry = HIGPasswordEntry()

        self.retype_password_label = HIGLabel(_("Retype password"))
        self.retype_password_entry = HIGPasswordEntry()

        self.registration_icon = gtk.Image()
        self.registration_text = gtk.Label(_("If you don't have an ICM account,"
                "please register a new account."))

        self.hbox = HIGHBox()
        self.table = HIGTable()
 def _refresh_list(self):
     """
     clear and load
     """
     self.listmodel.clear()
     self.__load_events()
     self.statusbar.push(0,_("Refresh the Events List!"))  
 def _refresh_list(self):
     """
     clear and load
     """
     self.listmodel.clear()
     self.__load_events()
     self.statusbar.push(0, _("Refresh the Events List!"))
    def _create_widgets(self):

        self.bug_text = gtk.Label(_("Bug report details that "
                                    "will be send!"))

        self.description_scrolled = gtk.ScrolledWindow()
        self.description_text = gtk.TextView()

        # Fill the text entry
        description = _("Reporter: %s\nSummary: %s\nCategory: %s\n"
                        "Comments: %s\n\nDescription: %s" %
                        (self._reporter, self._summary, self._category,
                         self._comments, self._description))
        self.description_text.get_buffer().set_text(
            description.replace("[[BR]]", "\n"))
        self.description_text.set_editable(False)
    def __create_widgets(self):
        """
        """
        cur_mode = view_mode_descr[self.timeline_base.graph_mode]
        self.select_label = gtk.Label(cur_mode)
        
        values = self.timeline_base.bounds_by_graphmode()
        
        self.date_select = gtk.SpinButton(gtk.Adjustment(value=values[2],
            lower=values[0], upper=values[1], step_incr=1), 1)
        
        ###############
        #Refresh Button
        
        self.tooltips = gtk.Tooltips()
        
        self.refresh_button = gtk.Button()
        self.refresh_button.set_border_width(3)

        self.refresh_button.set_relief(gtk.RELIEF_NONE)
        
        self.tooltips.set_tip(self.refresh_button, _("Graph Refresh"))
        
        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_REFRESH,gtk.ICON_SIZE_BUTTON)
        box = gtk.HBox()
        box.pack_start(img,False,False,0)
        self.refresh_button.add(box)
    def __create_widgets(self):
        """
        """
        # startup data
        line_filter, start, evts = self.base.grab_data()
        xlabel = self.base.xlabel
        glabel = self.base.title_by_graphmode()
        dlabel = self.base.descr_by_graphmode()

        #Box
        self.box = HIGVBox()

        #graph
        self.graph_box = gtk.HBox()
        self.graph = InteractiveGraph(evts,
                                      start,
                                      x_label=xlabel,
                                      y_label=_('Number of events'),
                                      graph_label=glabel,
                                      descr_label=dlabel,
                                      vdiv_labels=self.base.labels,
                                      line_filter=line_filter,
                                      connector=self.connector)

        #graph toolbar
        self.graphtb = TimeLineGraphToolbar(self.graph, self.connector,
                                            self.base.graph_mode,
                                            self.base.graph_kind, self.base)
 def _set_details_content(self,content=None):
     if content == None or content == "":
         content = str(_('Open Monitor Alpha is coming soon!\n Designed by UMIT'))
        
     buf = gtk.TextBuffer()
     buf.set_text(content)
     return buf
 def send_service_suggestion(self):
     service_name = self.service_name_entry.child.get_text()
     host_name = self.service_host_entry.get_text()
     ip = self.service_ip_entry.get_text()
     port = int(self.service_port_entry.get_text())
     if service_name == '' or host_name == '' or ip == '' or port == "":
         alert = HIGAlertDialog(message_format=_("Missing fields."),
                                secondary_text=_("Please input all fields "\
                                                 "for service suggestion."))
         alert.run()
         alert.destroy()
         return
     d = theApp.aggregator.send_service_suggestion(service_name, host_name,
                                                   ip, port)
     d.addCallback(self.show_success)
     d.addErrback(self.show_failed)
示例#38
0
    def _set_details_content(self, content=None):
        if content == None or content == "":
            content = str(
                _('Open Monitor Alpha is coming soon!\n Designed by UMIT'))

        buf = gtk.TextBuffer()
        buf.set_text(content)
        return buf
    def _create_widgets(self):
        self.username_label = HIGLabel(_("Username"))
        self.username_entry = gtk.Entry()

        self.password_label = HIGLabel(_("Password"))
        self.password_entry = HIGPasswordEntry()

        self.retype_password_label = HIGLabel(_("Retype password"))
        self.retype_password_entry = HIGPasswordEntry()

        self.registration_icon = gtk.Image()
        self.registration_text = gtk.Label(
            _("If you don't have an ICM account,"
              "please register a new account."))

        self.hbox = HIGHBox()
        self.table = HIGTable()
示例#40
0
    def __init__(self):
        HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
        self.set_title(_('Super Peers List'))
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.__create_widgets()
        self.__pack_widgets()
        self.__load_super_peers()
 def __init__(self):
     HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
     self.set_title(_('Super Peers List'))
     self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
     
     self.__create_widgets()
     self.__pack_widgets()
     self.__load_super_peers()
示例#42
0
 def __init__(self):
     HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
     self.set_title(_('OpenMonitor Preferences'))
     self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
             
     self.__create_widgets()
     self.__pack_widgets()
     self.load_preference()
    def __create_widgets(self):
        """
        """
        self.left_box = HIGVBox()
        self.right_box = HIGVBox()

        ##########
        #Grade Box
        self.grade_box = HIGVBox()
        self.grade_title = gtk.Label(
            "<span size='18000' weight='heavy'>Communication Grade</span>")
        self.grade_title.set_use_markup(True)
        self.grade_title.set_selectable(False)
        self.mark_box = gtk.HBox()
        self.mark_image = [None] * 5
        for i in range(0, 5):
            self.mark_image[i] = gtk.Image()
            self.mark_image[i].set_from_file(
                os.path.join(IMAGES_DIR, 'emptymark.png'))
            self.mark_box.pack_start(self.mark_image[i])

        #############
        #Website Test
        self.webtest_box = HIGVBox()
        self.webtest_title = gtk.Label(
            "<span size='18000' weight='heavy'>Website Test</span>")
        self.webtest_title.set_use_markup(True)
        self.webtest_title.set_selectable(False)

        status_str = "--"
        speed_str = "--"
        throtthled_str = "--"
        self.webtest_status_label = gtk.Label(
            "<span size='12500' weight='heavy'>Web Status: %s</span>" %
            (status_str))
        self.webtest_speed_label = gtk.Label(
            "<span size='12500' weight='heavy'>Network Speed: %s</span>" %
            (speed_str))
        self.webtest_throttled_label = gtk.Label(
            "<span size='12500' weight='heavy'>Throttled Status: %s</span>" %
            (throtthled_str))
        self.webtest_status_label.set_use_markup(True)
        self.webtest_status_label.set_selectable(False)
        self.webtest_speed_label.set_use_markup(True)
        self.webtest_speed_label.set_selectable(False)
        self.webtest_throttled_label.set_use_markup(True)
        self.webtest_throttled_label.set_selectable(False)
        ############
        #Service Box
        self.service_box = HIGVBox()
        #self.service_title =  gtk.Label(
        #    "<span size='12500' weight='heavy'>Service Statistics</span>")
        #self.service_title.set_use_markup(True)
        #self.service_title.set_selectable(False)
        self.refresh_btn = gtk.Button(_("Refresh Now!"))
        self.refresh_btn.set_size_request(108, 72)

        self.display_bar = TimeLineDisplayBar(self)
    def init_after_running(self, port=None, username=None, password=None,
                           server_enabled=True, skip_server_check=False):
        """
        """
        #####################################################
        # Create agent service(need to add the port confilct)
        if server_enabled:
            self.listen_port = port if port is not None else g_config.getint('network', 'listen_port')
            try:
                from umit.icm.agent.rpc.AgentService import AgentFactory
                self.factory = AgentFactory()
                g_logger.info("Listening on port %d.", self.listen_port)
                reactor.listenTCP(self.listen_port, self.factory)
            except Exception,info:
                #There can add more information

                self.quit_window_in_wrong(primary_text = _("The Listen Port has been used by other applications"), \
                                          secondary_text = _("Please check the Port") )
    def _create_widgets(self):
        self.category_label = HIGHintSectionLabel(
            _("Category (optional)"),
            _("If you know in which section of the program "
              "is the bug, please, select it from the choosebox. "
              "If you don't know what section to choose, leave it blank."))
        self.category_list = gtk.ListStore(str, str)
        self.category_combo = gtk.ComboBoxEntry(self.category_list, 0)

        self.email_label = HIGHintSectionLabel(
            _("Email"),
            _("Please inform a valid e-mail address from "
              "where you can be reached to be notified when the bug gets "
              "fixed. Not used for other purposes."))
        self.email_entry = gtk.Entry()

        self.summary_label = HIGHintSectionLabel(
            _("Summary"),
            _("This should be a quick description of the issue. "
              "Try to be clear and concise."))
        self.summary_entry = gtk.Entry()

        self.description_label = HIGHintSectionLabel(
            _("Description"),
            _("This is where you should write about the bug, "
              "describing it as clear as possible and giving as many "
              "informations as you can and how to reproduce the bug."))
        self.description_scrolled = gtk.ScrolledWindow()
        self.description_text = gtk.TextView()

        self.bug_icon = gtk.Image()
        self.bug_text = gtk.Label(
            _("This Bug Report dialog allows you "
              "to easily tell us about a problem that you may have found on "
              "Open Monitor. Doing so, you help us to help you, by fixing and "
              "improving Open Monitor faster than usual."))

        if self.crashreport:
            # Create a button to show details
            self.show_details = HIGStockButton(gtk.STOCK_DIALOG_INFO,
                                               _("Show Details"))

        self.hbox = HIGHBox()
        self.table = HIGTable()
    def title_by_graphmode(self, useselection=False):
        """
        Returns a formatted date based on current graph mode (Yearly,
        Monthly, .. ).
        """
        def adjust(date):
            # prepends a 0 in cases where a date is minor than 10,
            # so (example) hour 2 displays as 02.
            if date < 10:
                date = "0%s" % date

            return date


        if useselection and self.selection != -1:
            fmtddate = [
                  "%s, %s" % (monthname((self.selection + 1) % 12),
                              # % 12 above is used so we don't have
                              # problems in case self.selection > 12,
                              # that is, when someone is viewing in
                              # other mode different than "Yearly".
                              self.year),

                  "%s, %s %s, %s" % (self.get_weekday(self.year,
                                      self.month, (self.selection+1)%\
                                      (self.get_current_monthrange()[1]+1))[1],
                                     monthname(self.month), self.selection+1,
                                     self.year),

                  "%s, %s %s, %s (%s:00)" % (self.get_current_weekday_name(),
                                             monthname(self.month),
                                             self.day, self.year,
                                             adjust(self.selection % 23)),

                  "%s, %s %s, %s (%s:%s)" % (self.get_current_weekday_name(),
                                             monthname(self.month), self.day,
                                             self.year, adjust(self.hour),
                                             adjust(self.selection))
                       ]
        else:
            fmtddate = [

                  _("Year %(year)s") % {'year': self.year},

                  "%s, %s" % (monthname(self.month), self.year),

                  "%s, %s %s, %s" % (self.get_current_weekday_name(),
                                        monthname(self.month), self.day,
                                        self.year),

                  "%s, %s %s, %s (%s:00)" % (self.get_current_weekday_name(),
                                             monthname(self.month),
                                             self.day, self.year, self.hour)
                       ]

        return fmtddate[view_mode_order.index(self.graph_mode)]    
    def _create_widgets(self):
        """"""
        self.web_listen_port_label = HIGLabel(_("Web Listen PORT"))
        self.web_listen_port_entry = HIGTextEntry()

        self.aggregator_ip_label = HIGLabel(_("Aggregator URL"))
        self.aggregator_ip_entry = HIGTextEntry()

        self.network_listen_port_label = HIGLabel(_("Peer Listen PORT"))
        self.network_listen_port_entry = HIGTextEntry()

        self.save_button = HIGButton(title="Save")
        self.close_button = HIGButton(title="Close")

        self.hbox = HIGHBox(False, 2)
        self.table = HIGTable(4, 2, False)
        self.table.set_row_spacings(5)
        self.table.set_col_spacings(10)
        self.action_area.set_homogeneous(False)
 def __init__(self, summary, description, title=_('Crash Report'),\
              description_dialog=None):
     BugReport.__init__(self,
                        title,
                        summary,
                        description,
                        "CrashReport",
                        True,
                        reuse_mainloop=False,
                        description_dialog=description_dialog)
示例#49
0
 def __init__(self):
     HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
     self.set_title(_('Logs'))
     self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
     self.set_size_request(720,480)
     self.set_border_width(10)
     
     self.__create_widgets()
     self.__pack_widgets()
     self.__connect_widgets()
 def __init__(self):
     HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
     self.set_title(_('Logs'))
     self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
     self.set_size_request(720,480)
     self.set_border_width(10)
     
     self.__create_widgets()
     self.__pack_widgets()
     self.__connect_widgets()
    def _create_widgets(self):
        """"""
        self.web_listen_port_label = HIGLabel(_("Web Listen PORT"))
        self.web_listen_port_entry = HIGTextEntry()

        self.aggregator_ip_label = HIGLabel(_("Aggregator URL"))
        self.aggregator_ip_entry = HIGTextEntry()

        self.network_listen_port_label = HIGLabel(_("Peer Listen PORT"))
        self.network_listen_port_entry = HIGTextEntry()

        self.save_button = HIGButton(title="Save")
        self.close_button = HIGButton(title="Close")

        self.hbox = HIGHBox(False, 2)
        self.table = HIGTable(4, 2, False)
        self.table.set_row_spacings(5)
        self.table.set_col_spacings(10)
        self.action_area.set_homogeneous(False)
 def __create_widgets(self):
     """
     """        
     self.left_box = HIGVBox()
     self.right_box = HIGVBox()
     
     ##########
     #Grade Box
     self.grade_box   = HIGVBox()
     self.grade_title = gtk.Label(
         "<span size='18000' weight='heavy'>Communication Grade</span>")
     self.grade_title.set_use_markup(True)
     self.grade_title.set_selectable(False)   
     self.mark_box = gtk.HBox()
     self.mark_image = [None] * 5
     for i in range(0,5):
         self.mark_image[i] = gtk.Image()
         self.mark_image[i].set_from_file(os.path.join(IMAGES_DIR,'emptymark.png'))
         self.mark_box.pack_start(self.mark_image[i])
           
     
     #############
     #Website Test
     self.webtest_box = HIGVBox() 
     self.webtest_title = gtk.Label(
         "<span size='18000' weight='heavy'>Website Test</span>") 
     self.webtest_title.set_use_markup(True)
     self.webtest_title.set_selectable(False)   
     
     status_str = "--"
     speed_str  = "--"
     throtthled_str = "--"
     self.webtest_status_label = gtk.Label("<span size='12500' weight='heavy'>Web Status: %s</span>" % (status_str))      
     self.webtest_speed_label = gtk.Label("<span size='12500' weight='heavy'>Network Speed: %s</span>" % (speed_str)) 
     self.webtest_throttled_label = gtk.Label("<span size='12500' weight='heavy'>Throttled Status: %s</span>" % (throtthled_str)) 
     self.webtest_status_label.set_use_markup(True)
     self.webtest_status_label.set_selectable(False) 
     self.webtest_speed_label.set_use_markup(True)
     self.webtest_speed_label.set_selectable(False) 
     self.webtest_throttled_label.set_use_markup(True)
     self.webtest_throttled_label.set_selectable(False)         
     ############
     #Service Box
     self.service_box  = HIGVBox()
     #self.service_title =  gtk.Label(
     #    "<span size='12500' weight='heavy'>Service Statistics</span>") 
     #self.service_title.set_use_markup(True)
     #self.service_title.set_selectable(False)     
     self.refresh_btn = gtk.Button(_("Refresh Now!")) 
     self.refresh_btn.set_size_request(108,72)
       
     self.display_bar = TimeLineDisplayBar(self)              
    def title_by_graphmode(self, useselection=False):
        """
        Returns a formatted date based on current graph mode (Yearly,
        Monthly, .. ).
        """
        def adjust(date):
            # prepends a 0 in cases where a date is minor than 10,
            # so (example) hour 2 displays as 02.
            if date < 10:
                date = "0%s" % date

            return date

        if useselection and self.selection != -1:
            fmtddate = [
                  "%s, %s" % (monthname((self.selection + 1) % 12),
                              # % 12 above is used so we don't have
                              # problems in case self.selection > 12,
                              # that is, when someone is viewing in
                              # other mode different than "Yearly".
                              self.year),

                  "%s, %s %s, %s" % (self.get_weekday(self.year,
                                      self.month, (self.selection+1)%\
                                      (self.get_current_monthrange()[1]+1))[1],
                                     monthname(self.month), self.selection+1,
                                     self.year),

                  "%s, %s %s, %s (%s:00)" % (self.get_current_weekday_name(),
                                             monthname(self.month),
                                             self.day, self.year,
                                             adjust(self.selection % 23)),

                  "%s, %s %s, %s (%s:%s)" % (self.get_current_weekday_name(),
                                             monthname(self.month), self.day,
                                             self.year, adjust(self.hour),
                                             adjust(self.selection))
                       ]
        else:
            fmtddate = [
                _("Year %(year)s") % {
                    'year': self.year
                },
                "%s, %s" % (monthname(self.month), self.year),
                "%s, %s %s, %s" % (self.get_current_weekday_name(),
                                   monthname(self.month), self.day, self.year),
                "%s, %s %s, %s (%s:00)" %
                (self.get_current_weekday_name(), monthname(
                    self.month), self.day, self.year, self.hour)
            ]

        return fmtddate[view_mode_order.index(self.graph_mode)]
    def __init__(self, title=_('Registration')):
        """Constructor"""
        HIGDialog.__init__(self, title=title,
                           buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                                    gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))

        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        
        self._create_widgets()
        self._pack_widgets()

        # Register callbacks
        self.connect("response", self.check_response)
示例#55
0
    def _create_widgets(self):
        self.category_label = HIGHintSectionLabel(_("Category (optional)"),
            _("If you know in which section of the program "
            "is the bug, please, select it from the choosebox. "
            "If you don't know what section to choose, leave it blank."))
        self.category_list = gtk.ListStore(str, str)
        self.category_combo = gtk.ComboBoxEntry(self.category_list, 0)

        self.email_label = HIGHintSectionLabel(_("Email"),
            _("Please inform a valid e-mail address from "
            "where you can be reached to be notified when the bug gets "
            "fixed. Not used for other purposes."))
        self.email_entry = gtk.Entry()

        self.summary_label = HIGHintSectionLabel(_("Summary"),
            _("This should be a quick description of the issue. "
            "Try to be clear and concise."))
        self.summary_entry = gtk.Entry()

        self.description_label = HIGHintSectionLabel(_("Description"),
            _("This is where you should write about the bug, "
            "describing it as clear as possible and giving as many "
            "informations as you can and how to reproduce the bug."))
        self.description_scrolled = gtk.ScrolledWindow()
        self.description_text = gtk.TextView()

        self.bug_icon = gtk.Image()
        self.bug_text = gtk.Label(_("This Bug Report dialog allows you "
            "to easily tell us about a problem that you may have found on "
            "Open Monitor. Doing so, you help us to help you, by fixing and "
            "improving Open Monitor faster than usual."))
        
        if self.crashreport:
            # Create a button to show details 
            self.show_details = HIGStockButton(gtk.STOCK_DIALOG_INFO,
                                           _("Show Details"))

        self.hbox = HIGHBox()
        self.table = HIGTable()
示例#56
0
    def __init__(self):
        """Constructor"""
        HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
        self.set_title(_("Open Monitor Software Update Manager"))
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.set_size_request(480, 480)
        self.set_keep_above(True)
        self.set_border_width(10)

        self._create_record()
        self._create_widgets()
        self._pack_widgets()
        self._connect_widgets()
 def __init__(self):
     """Constructor"""
     HIGWindow.__init__(self, type=gtk.WINDOW_TOPLEVEL)
     self.set_title(_("Open Monitor Software Update Manager"))
     self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
     self.set_size_request(480,480)
     self.set_keep_above(True)
     self.set_border_width(10)
     
     self._create_record()
     self._create_widgets()
     self._pack_widgets()
     self._connect_widgets() 
示例#58
0
    def _on_activated(self, widget, row, col):
        """"""
        self.install_btn.set_sensitive(True)
        #choice
        selection = self.treeview.get_selection()
        (model, iter) = selection.get_selected()
        if iter == None:
            return
        else:
            cur_version = self.store.get_value(iter, 1)
            #fill self.current_record
            rs = g_db_helper.select(
                "select * from updates where version = '%s'" % cur_version)
            if len(rs) != 1:
                g_logger.error(
                    "Record is ERROR in DB!!!! The window will be closed!!!")
                self.destroy()
            self.current_record = {}

            self.current_record["version"] = rs[0][0]
            self.current_record["news_date"] = rs[0][1]
            self.current_record["software_name"] = rs[0][2]
            self.current_record["description"] = rs[0][3]
            self.current_record["download_url"] = rs[0][4]
            self.current_record["is_update"] = rs[0][5]
            self.current_record["check_code"] = rs[0][6]


            self.statusbar.push(0,_("You have selected the %s version" % \
                                self.current_record["version"]))

            self.details_textview.set_buffer(
                self._set_details_content(
                    _(self.current_record["description"] + "\n" + "download:" +
                      self.current_record["download_url"] + "\n" +
                      "Designed by Umit!")))
            self.details_textview.show_all()
            g_logger.debug("Selected the item %s" % (self.current_record))
示例#59
0
    def __init__(self, title=_('Open Monitor 2012')):
        """Constructor"""
        HIGDialog.__init__(self, title=title, flags=gtk.DIALOG_MODAL,
                           buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))

        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.set_default_response(gtk.RESPONSE_ACCEPT)
        self.set_keep_above(True)
        self.set_size_request(480, 240)
        self.set_border_width(2)

        self._create_widgets()
        self._pack_widgets()
        self._connect_widgets()